Race Change Script Help

Post » Wed Jun 20, 2012 4:20 am

I've been trying for some time to create a spell that will allow the player to turn into a Super Saiyan (Just for lols), but have had no luck
I created a new Super Saiyan Race that seems to be working, but i'm having trouble with the spell to turn into, and back from one. Basically,
I have no experience with scripting, and this is what i cobbled together from a werewolf script i found
Spoiler
Scriptname SSJSwitch extends activemagiceffect


Race Property SuperSaiyanRace auto

Function SuperSaiyan

Race currRace = Target.GetRace()

if (currRace != SaiyanRace)
if (Target != Game.GetPlayer())
Target.SetRace(SuperSaiyanRace)
endif

endif

else (currRace != SuperSaiyanRace)
if (Target != Game.GetPlayer())
Target.SetRace(SaiyanRace)
endif

endif

EndFunction

The idea is that if you aren't a super saiyan, it turns you into one, and if you are, it turns you back to a regular Saiyan.
Unfortunately, it isn't working, and i can't seem to figure out why.
If anyone has any idea that would be great
User avatar
lolly13
 
Posts: 3349
Joined: Tue Jul 25, 2006 11:36 am

Post » Wed Jun 20, 2012 6:39 pm

You need to promote the currRace to a property otherwise you can't undo the transformation.

And functions don't do anything unless, the are called.
The new scripting system is based on events, and the event to interest you is http://www.creationkit.com/OnEffectStart_-_ActiveMagicEffect. In there you can compare the casters current race, and switch them, than you have a toggle.

Edit: I almost forgot. ActiveMagicEffects are discarded as soon as they end (spell duration and type) so keep that in mind.
User avatar
April
 
Posts: 3479
Joined: Tue Jun 20, 2006 1:33 am


Return to V - Skyrim