Author Topic: Equip() and GiveGold()  (Read 2440 times)

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Equip() and GiveGold()
« on: May 26, 2006, 05:02:19 PM »
Since Equip() doesn't work for items other then weapons, is there a way to force a creature to equip an item?

Also, can you create and give a NPC gold? As in,
If
Something
Then
GiveCreature 1000 gold

If
Something else
Then
GiveCreature 5000 gold

I tried GiveItemCreate, but it doesn't like "Gold" as a string ref.
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
Re: Equip() and GiveGold()
« Reply #1 on: May 27, 2006, 12:22:26 AM »
Try "MISC07" instead of "GOLD". This is the ITM file for gold.

-Echon

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: Equip() and GiveGold()
« Reply #2 on: May 27, 2006, 01:07:51 AM »
Oh. That works. Thank you  ;D
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline Avenger_teambg

  • Planewalker
  • *****
  • Posts: 399
Re: Equip() and GiveGold()
« Reply #3 on: May 27, 2006, 03:31:58 AM »
GiveGoldForce is the safest action to give gold to the party cash.
GivePartyGold gives only the amount available on the actor, but it works too.

To Equip an armour, you can create it right in the armour slot (but this will destroy the original armour in that slot).

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: Equip() and GiveGold()
« Reply #4 on: May 27, 2006, 01:19:14 PM »
But how do you create it in the right armor slot? The parameters don't provide for a slot.

For the gold, I don't want to give it to the party, I wanted to give varying amounts to a hostile .cre based on certian conditions. In that case, is using MISC07 preferable?
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1944
  • Gender: Male
    • The Fields of the Dead
Re: Equip() and GiveGold()
« Reply #5 on: May 27, 2006, 01:59:20 PM »
For the gold, I don't want to give it to the party, I wanted to give varying amounts to a hostile .cre based on certian conditions. In that case, is using MISC07 preferable?

Yes. It will create the gold in the CRE's inventory which drops when it dies and is then picked up by you.

-Echon

Offline jastey

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1524
  • Gender: Female
Re: Equip() and GiveGold()
« Reply #6 on: May 27, 2006, 02:02:07 PM »
For the gold, I don't want to give it to the party, I wanted to give varying amounts to a hostile .cre based on certian conditions. In that case, is using MISC07 preferable?
There is also TakePartyGold(I:Amount*) for removing gold from the party. It sais "Note that this spell will transfer objects to the creature running the script. Useful for thieves." in IESDP. But transferring from the party to the cre is probably not what you wanted.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Equip() and GiveGold()
« Reply #7 on: May 27, 2006, 03:45:16 PM »
But how do you create it in the right armor slot? The parameters don't provide for a slot.
You can use the ReplaceItem effect (called Create item in slot), or CreateItem("whatever",a,b,c) and FillSlot(whatever) (see SLOTS.ids). Note that both will replace (destroy) any existing item in the referenced slot.

The engine doesn't have any way to elegantly handle this (whether for NPCs or PCs).

Offline Avenger_teambg

  • Planewalker
  • *****
  • Posts: 399
Re: Equip() and GiveGold()
« Reply #8 on: May 28, 2006, 02:55:14 AM »
Well, for random treasure, there is also the random treasure list, but it gives less control to you than scripting the cases manually.
So, i guess, you are doing the best way.

Offline Duality

  • Planewalker
  • *****
  • Posts: 147
Re: Equip() and GiveGold()
« Reply #9 on: May 28, 2006, 04:40:05 PM »
Well, FillSlots does what I need to do. It's not perfect, but hey, it works.  ;D

Thanks everyone.

EDIT:
Some times I just have the urge to scream.
Weidu gives me this error:

[PlanarSphereMod/baf/psMel.baf] PARSE ERROR at line 31 column 36-36
Near Text: )
        [FillSlot] argument [SLOT_AMULET] not found in [SLOTS.IDS]'

SLOT.ids has as it's first entry
0 SLOT_AMULET

The spelling is identical.

SLOT_RING_LEFT works fine as does SLOT_WEAPON and SLOT_GAUNTLETS.

Ideas?

EDIT 2: Well, it appears to be a weidu issue, guess I should have searched the forum first...
« Last Edit: May 29, 2006, 05:20:11 PM by Duality »
"I'll try being nicer if you try being smarter."

"There is a certain freedom in being totally screwed. It means that nothing you do is going to make it any worse."

"Eagles may soar, but weasels don't get sucked into jet engines."

Offline Lu

  • Planewalker
  • *****
  • Posts: 750
  • Gender: Female
Re: Equip() and GiveGold()
« Reply #10 on: May 29, 2006, 06:56:05 PM »
  Duality, you may also want to know that there's 278 TakeItemReplace() action. I won't clarify it any further (too lazy to type), but let me know if you want me to explain to you how to use the action properly

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Equip() and GiveGold()
« Reply #11 on: May 29, 2006, 08:02:08 PM »
//exit lurk mode

I would love you to explain it to me, please, even if Duality doesn't... I tried using the TakeItemReplace command in both script and dialog. I needed to to swap one item for an improved (completed quest item) version; unfortunately, I couldn't figure out how to use it because it seemed to give item2 to a player even if item 1 was not present, which meant when ! checked each player in turn, I ended up with lots of little items -- kind of like baby bunnies, y'know  :P

//re-engage lurk mode

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Equip() and GiveGold()
« Reply #12 on: May 29, 2006, 09:28:18 PM »
It will replace the item with another item. If the Ring of Blah is equipped in the left ring slot, and you TakeItemReplace("RINGBLEH","RINGBLAH",Whoever), RINGBLEH is created in the left ring slot (overwriting RINGBLAH). If the target actor doesn't have the Ring of Blah, then RINGBLEH is just created in an inventory slot. Useful if you know exactly which slot an item will be in on an NPC, and that the item will never be in a different slot (obviously, you'd never want to use this on a PC).

My original example with the ring of contraception was too filthy so I changed it to generic junk. Beyond that, there isn't much else to say about this action.

Offline Avenger_teambg

  • Planewalker
  • *****
  • Posts: 399
Re: Equip() and GiveGold()
« Reply #13 on: May 30, 2006, 01:37:53 AM »
takeitemreplace is good as it is, if you don't want it to spawn items without taking another, use the HasItem trigger.

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Equip() and GiveGold()
« Reply #14 on: May 30, 2006, 04:54:33 PM »
HasItem...

*slaps forehead in disgust*

Instead of   DO ~ActionOverride(Player6,DestroyItem("X#DYJOR1")) //repeated for P5,4,3,2,1)
                        GiveItemCreate("X#DYJOR2",Player1,1,1,0)

IF ~HasItem("X#DYJOR2",Player1)~ DO TakeItemReplace("X#DYJOR2","X#DYJOR1",Player1)~ EXIT

For my purpose, where the item is in generic inventory and is unequippable, the first code works fine. If I wanted to swap out a specific equiped item, since it would merely create the new item in inventory, TIR would be great. For Duality's purposes, though,
what about needing to know the specific slot in use or the whole IESDP "this does not automatically equip the item" thing? I guess I am requesting clarification of your "and that the item will never be in a different slot (obviously, you'd never want to use this on a PC).", devSin.

Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Equip() and GiveGold()
« Reply #15 on: May 30, 2006, 07:49:36 PM »
takeitemreplace is good as it is, if you don't want it to spawn items without taking another, use the HasItem trigger.
Isn't there also a CreateItemSlot() or somesuch in ToB? It sounds familiar...

Quote
For my purpose, where the item is in generic inventory and is unequippable, the first code works fine. If I wanted to swap out a specific equiped item, since it would merely create the new item in inventory, TIR would be great. For Duality's purposes, though,
what about needing to know the specific slot in use or the whole IESDP "this does not automatically equip the item" thing? I guess I am requesting clarification of your "and that the item will never be in a different slot (obviously, you'd never want to use this on a PC).", devSin.
Yeah, I didn't really want to think about it. My response was centered on the premise that you want to replace by slot, not by item (in which case, you want to know exactly which item will be in which slot before you replace). If you just want to do "take the shld01 if he has it and replace with shld02," you can do IF ~HasItemEquipped("shld01",Whoever)~ THEN DO ~TakeItemReplace("shld02","shld01",Whoever)~ EXIT. That code says that if Whoever has shld01 in their shield slot, replace it with shld02. This won't work if you want to change only the Left Ring slot (not Right Ring), or vice versa, or wanted to replace a specific quick (weapon|item) or inventory slot without touching any of the other ones.

Note that the correct params are TakeItemReplace(S:ItemToGive,S:ItemToBeReplaced,O:ActorWithItem) (it looks like you may have swapped to two item refs in the 2nd part of your example).

There may be a HasItemSlot() or similar trigger (again, it sounds familiar), in which case you just check if the item you want to replace is in the right slot before replacing.
« Last Edit: May 30, 2006, 07:51:17 PM by devSin »

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Equip() and GiveGold()
« Reply #16 on: May 31, 2006, 10:29:11 PM »
Cool,  8) -- and yep, I had the TakeItemReplace right, but I screwed up the first part:
~HasItem("X#DYJOR2",Player1)~ should have read ~HasItem("X#DYJOR1",Player1)~
so that if P has #1, #2 replaces #1. Thanks for the help!

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: