Jump to content

Cannot get this Transformation script to work right


Recommended Posts

Heyo

 

Been working for a long time trying to get a transformation script working, and after struggling with this script I manage to get something together that finally allows me to transform, but I cannot revert back nor will it do anything else I have written in the script like, camera shake and the FX explosion. If I can get this to work, and revert at will pressing Z anytime , or back then I can finally move on :wallbash:

 

Here is the script

Scriptname TransF_1 extends activemagiceffect  

{Toggle the Spell}

;--PROPS--
RACE PROPERTY PolymorphRace auto
Faction Property MonsterFaction auto
Spell Property PolymorphSpell auto
Explosion Property EndExplosion auto


;--EVENTS--

Event OnEffectStart(Actor Target, Actor Caster)
	If (Target == None)
;		Debug.Trace("Trying to transform something that's not an actor; bailing out.", 2)
		return
if (Target.GetActorBase().GetRace() != PolymorphRace)

GetCasterActor().UnequipAll()

Utility.Wait(1.5)

Game.ShakeCamera(afStrength = 0.5,afDuration = 1)

GetCasterActor().placeAtMe(EndExplosion)

GetCasterActor().SetRace(PolymorphRace)

GetCasterActor().EquipSpell(PolymorphSpell, 0)

GetCasterActor().AddSpell(PolymorphSpell)

GetCasterActor().EquipSpell(PolymorphSpell, 0)

endif
endif

EndEvent

I've been at this thing for a few months now and it's pretty much a huge roadblock for my project If I can complete this script it would be absolutely amazing. I know Global variables can be used so that the script remembers what race I was, but I have no idea how to add that since my scripting knowledge is pretty limited as of my time lately.

 

Thanks for taking the time to read this

Link to comment
Share on other sites

This isn't 100% correct as I'm just guessing atm ... but the flow is ...

 

 

Scriptname TransF_1 extends activemagiceffect

{Toggle the Spell}

;--PROPS--
RACE PROPERTY PolymorphRace auto
Faction Property MonsterFaction auto
Spell Property PolymorphSpell auto
Explosion Property EndExplosion auto


;--EVENTS--

 

Event OnEffectStart(Actor Target, Actor Caster)
If (Target != None)

If (Target.GetActorBase().GetRace() != PolymorphRace)

GetCasterActor().UnequipAll()
Utility.Wait(1.5)
Game.ShakeCamera(afStrength = 0.5,afDuration = 1)
GetCasterActor().placeAtMe(EndExplosion)
GetCasterActor().SetRace(PolymorphRace)
GetCasterActor().EquipSpell(PolymorphSpell, 0)
GetCasterActor().AddSpell(PolymorphSpell)
GetCasterActor().EquipSpell(PolymorphSpell, 0)

 

Else

 

GetCasterActor().UnequipAll()
Utility.Wait(1.5)
Game.ShakeCamera(afStrength = 0.5,afDuration = 1)
GetCasterActor().placeAtMe(EndExplosion)
GetCasterActor().SetRace(castersOriginalRace)
GetCasterActor().UnEquipSpell(PolymorphSpell, 1)
GetCasterActor().RemoveSpell(PolymorphSpell)
GetCasterActor().UnEquipSpell(PolymorphSpell, 0)

Endif

Endif

EndEvent

Link to comment
Share on other sites

Also here is a script for transform NPC ... Looks like you may have seen it before ... notice he is using Event OnEffectFinish(Actor Target, Actor Caster).

 

 

Scriptname NPCpolymorphscript extends activemagiceffect
{NPC transformation script}

Spell Property PolymorphSpell auto
FormList Property WerewolfDispelList auto
Race Property PolymorphRace auto
Race Property TargetsOriginalRace auto
Weapon Property MonsterWeapon auto
Explosion Property EndExplosion auto
ImageSpaceModifier Property ChangeFX auto
Idle Property IdleWerewolfTransformation auto

; EVENTS


Event OnEffectStart(Actor Target, Actor Caster)
TargetsOriginalRace = Target.GetActorBase().GetRace()
if (Target.GetActorBase().GetRace() != PolymorphRace)
Debug.Notification("Magic effect start.")
GetTargetActor().UnequipAll()
GetTargetActor().PlayIdle(IdleWerewolfTransformation)
PrepShift()
Utility.Wait(1.5)
Game.ShakeCamera(afStrength = 0.5,afDuration = 1)
GetTargetActor().placeAtMe(EndExplosion)
GetTargetActor().SetRace(PolymorphRace)
GetTargetActor().AddSpell(SPELLCLEAR1)
GetTargetActor().EquipSpell(SPELLCLEAR1, 0)
GetTargetActor().AddSpell(SPELLCLEAR2)
GetTargetActor().EquipSpell(SPELLCLEAR2, 1)
GetTargetActor().AddItem(WEAPONCLEAR1)
GetTargetActor().EquipItem(WEAPONCLEAR1, 0)
GetTargetActor().AddItem(WEAPONCLEAR2)
GetTargetActor().EquipItem(WEAPONCLEAR2, 1)
GetTargetActor().EquipSpell(PolymorphSpell, 0)
GetTargetActor().AddSpell(PolymorphSpell)
GetTargetActor().EquipSpell(PolymorphSpell, 0)
GetTargetActor().AddItem(MonsterWeapon)
GetTargetActor().EquipItem(MonsterWeapon, 0)
GetTargetActor().AddItem(MonsterArmor)
GetTargetActor().EquipItem(MonsterArmor)
AnimationEnd()
Endif
EndEvent

Event OnEffectFinish(Actor Target, Actor Caster)
Target.placeAtMe(EndExplosion)
ChangeFx.Apply()
GetTargetActor().SetRace(TargetsOriginalrace)
GetTargetActor().RemoveSpell(PolymorphSpell)
GetTargetActor().UnEquipSpell(PolymorphSpell, 1)
GetTargetActor().RemoveItem(MonsterWeapon)
GetTargetActor().UnEquipItem(MonsterWeapon, 0)
GetTargetActor().RemoveItem(MonsterArmor)
GetTargetActor().UnEquipItem(MonsterArmor)
GetTargetActor().AddSpell(SPELLCLEAR1)
GetTargetActor().EquipSpell(SPELLCLEAR1, 0)
GetTargetActor().AddSpell(SPELLCLEAR2)
GetTargetActor().EquipSpell(SPELLCLEAR2, 1)
GetTargetActor().AddItem(WEAPONCLEAR1)
GetTargetActor().EquipItem(WEAPONCLEAR1, 0)
GetTargetActor().AddItem(WEAPONCLEAR2)
GetTargetActor().EquipItem(WEAPONCLEAR2, 1)
Debug.Notification("Magic effect finish.")
EndEvent

Function AnimationEnd()
EndFunction

Function PrepShift()
;Debug.Trace("WEREWOLF: Prepping shift...")
Actor player = GetCasterActor()
int count = 0
while (count < WerewolfDispelList.GetSize())
Spell gone = WerewolfDispelList.GetAt(count) as Spell
if (gone != None)
GetTargetActor().DispelSpell(gone)
endif
count
+= 1
endwhile
EndFunction

Armor Property MonsterArmor Auto
SPELL Property SPELLCLEAR1 Auto
SPELL Property SPELLCLEAR2 Auto
WEAPON Property WEAPONCLEAR1 Auto
WEAPON Property WEAPONCLEAR2 Auto

Link to comment
Share on other sites

Ha yes, I have seen it before, been looking everywhere trying to figure out how this thing works.

 

BUT you CLEANED THE SCRIPT everything is working! Except one thing which was already mentioned before the problem with the script was that it doesn't know what to do apparently if I'm already a polyrace. Since

putting variable TargetsOriginalrace is undefined tsn't working, Or anything the wiki says leaving it blank should revert me back, but it doesn't, however it does let me know when the effect has wormed off. I would like to have it that I can revert back at will like Vampire Lord and werewolf and back again but looking at the Creation kit, that looks like it takes another script to do. Hopefully its not too hard to pull off.

 

I'm guessing the reason this isn't working is because of a missing global variable

 

 

Nevermind, I did something dumb I overlooked something important. I can FINALLY Transform, Just can't revert back, however maybe now is a good time to get a revert power script.

Edited by Juebev
Link to comment
Share on other sites

Ya that was part of the guess ... however a long time ago I made a few .bat files to do this and if i remember correctly all you had to do was remove the spell and you went back to normal.

So try this ... same script with a slight modification.

 

 

 

 

Scriptname TransF_1 extends activemagiceffect

{Toggle Spell}

Race Property PolymorphRace auto
Faction Property MonsterFaction auto
Spell Property PolymorphSpell auto
Explosion Property EndExplosion auto

Event OnEffectStart(Actor Target, Actor Caster)
If (Target != None)
If (Target.GetActorBase().GetRace() != PolymorphRace)
GetCasterActor().UnequipAll()
Utility.Wait(1.5)
Game.ShakeCamera(afStrength = 0.5,afDuration = 1)
GetCasterActor().placeAtMe(EndExplosion)
GetCasterActor().SetRace(PolymorphRace)
GetCasterActor().EquipSpell(PolymorphSpell, 0)
GetCasterActor().AddSpell(PolymorphSpell)
GetCasterActor().EquipSpell(PolymorphSpell, 0)
Else
GetCasterActor().UnequipAll()
Utility.Wait(1.5)
Game.ShakeCamera(afStrength = 0.5,afDuration = 1)
GetCasterActor().placeAtMe(EndExplosion)
GetCasterActor().UnEquipSpell(PolymorphSpell, 0)
GetCasterActor().RemoveSpell(PolymorphSpell)
GetCasterActor().UnEquipSpell(PolymorphSpell, 0)
Endif
Endif
EndEvent

 

 

 

 

Not sure if you need the line [ Faction Property MonsterFaction auto ]

If this works it should be a permanent morph with a toggle back.

You will still be hated by Werewolf's as you're not in their faction ... (fix n the link if wanted)

However there seems to be more to this then just the morph ... that a look at this LINK

Link to comment
Share on other sites

 

 

Hey thanks for that! I feel like this script should be working though. I removed the spell and It didn't change back, and yeah I've seen that page WAAY too many times, it seems to be the ONLY tutorial on how to make these kinds of spells and I know and I've other mods with smaller and cleaner scripts that work. But yeah I have Faction Property there, because this is mainly for a quest with new factions. Seriously thanks for your help though, I'm just happy I can at least transform now. Pretty much halfway there, I can feel it. Gonna be spending more time with this thing, maybe there's something I messed up again, though it complie'd fine.

Link to comment
Share on other sites

did you see this part of the page ...

 

You only need to do this once per character.
Before you use ANY of the polymorph spells in this mod, you need to unlock 'beast form'
by drinking the blood of a werewolf in the companion's guild quest. If you cast a polymorph
spell BEFORE completing this quest, you will not be able to transform back!
Link to comment
Share on other sites

the reason i say that is cuz Faction Property MonsterFaction auto

isn't being used in the script at all ...

 

 

Race Property PolymorphRace auto
Spell Property PolymorphSpell auto
Explosion Property EndExplosion auto

 

Can you tell me what you are putting in these blanks ... exactly

Edited by NexusComa
Link to comment
Share on other sites

It's not necessary anymore, those properties did their part fine the transformation was just the issue.

 

Ah, well that explains it then. it DOES work but I have to do the Companions Guild Quest, which is something I don't want to do. This is probably because of the global Variable, that's in the Companion quest. I'll just have to make a quest then it seems and stick a global variable property in the script. I thought it was possible to make such a spell without the need to go into questmaking, I swear I seen it done before.

 

Oh well back to the drawing board.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...