Help with an OnEquip/Unequip script

Post » Thu Aug 18, 2011 10:57 am

just created a new spell and now im trying to write a script for OnEquip/UnEquip but i dont know how to write it. so far i have this

begin OnEquip SandstormMask

(tab)addspell SandstormMaskSpell(restores values that the SandstormDamage spell damages)

end

begin OnUnequip SandstormMask

(tab)removespell SandstormMaskSpell

end

the script wont save what am i missing?
User avatar
Kieren Thomson
 
Posts: 3454
Joined: Sat Jul 21, 2007 3:28 am

Post » Thu Aug 18, 2011 9:59 am

Er, I think if you check the definitions for OnEquip and OnUnequip that should be abundantly clear. Plus, bear in mind this script will be running on the mask so AddSpell and RemoveSpell will try and add/remove the spell from the mask. You may need GetContainer to find out who's wearing it.
User avatar
Laura Hicks
 
Posts: 3395
Joined: Wed Jun 06, 2007 9:21 am

Post » Thu Aug 18, 2011 10:37 am

ok cause im trying to make it so that you need to wear the mask and only the mask, to travel through sandstorms in a mod im working. but i have no idea how to apply it, the sandstorms are surrounded by a trigger cube that when you enter you begin to become irradiated and sufficate(damage health 10 health a second)

can you help me with how to make it so that when you put on the mask your pc isnt affected by the trigger spell?
User avatar
Lady Shocka
 
Posts: 3452
Joined: Mon Aug 21, 2006 10:59 pm

Post » Thu Aug 18, 2011 8:38 am

Change the code to something like this:

SCN ScriptNameGoesHereRef rContainerRefbegin OnEquip	Set rContainerRef to GetContainer	rContainerRef.addspell SandstormMaskSpellendbegin OnUnequip	Set rContainerRef to GetContainer	rContainerRef.removespell SandstormMaskSpellend


This will add the SandstormMaskSpell to the actor that equips the mask.

Alternatively, you could make it so the trigger checks to see if you're wearing the mask prior to inflicting you with the damage/radiation, or maybe even making the SandstormMaskSpell effect as an object effect and sticking that on the Sandstorm Mask, though that might not work, depending on how that effect works, I suppose.
User avatar
Zoe Ratcliffe
 
Posts: 3370
Joined: Mon Feb 19, 2007 12:45 am


Return to Fallout: New Vegas