Quote:
Originally Posted by Paris.Crenshaw
Back again. So, I've managed to get the basics of the amulet working. When equipped, the amulet applies the ghost touch property to everything the creature is carrying. My problem is that I only want it to reduce the equipment's weight to zero when the wearer is incorporeal. I'm having problems with the requirement in the if/then statement. What I have so far is as follows:
|
Yea I started looking at this item also to script. Pretty much you have the same concept I would go with. The big issue when dealing with weight is its a very specific set of timing to get it change the value and still affect the total weight on the hero.
Quote:
Originally Posted by Paris.Crenshaw
Code:
if (field[gIsEquip].value <> 0) then
foreach pick in hero from MyGear
perform eachpick.assign[Ability.iGhostTch]
nexteach
if (#hasability[raIncorpor] <> 0) then
foreach pick in hero from MyGear
eachpick.field[gWeight].value = 0
nexteach
endif
endif
|
So applying Ghost Touch Weapon Item Power to all gear items is not really going to do anything. It is meant to only work if at all on magic weapons.
So timing I would need to look up from my Spellbooks equipment addon. The other thing is be careful with adding foreach loops they are CPU intensive.
Code:
~ If not equipped get out now!
doneif (field[gIsEquip].value = 0)
~ Only process if we are incorporeal
doneif (#hasability[raIncorpor] = 1)
~ Find all gear items and set weight to zero
foreach pick in hero from MyGear
~ Apply Ghost Touch tag to all weapons
if (eachpick.tagis[component.BaseWep] = 1) then
perform eachpick.assign[Ability.iGhostTch]
endif
~ Set the item weight to zero
eachpick.field[gWeight].value = 0
eachpick.field[gearWeight].value = 0
nexteach
My spellbook stuff runs at
PreLevel/10500.
The only last thing I would change is to look for the Incorporeal Subtype on the hero instead of a Racial Special. But I am not near HL and don't remember the unique id for that subtype.