Jump to content

[LE] Help Writing Script For Spell Please


mmft93

Recommended Posts

So I've been trying to write this script all day today. Finally i got it to compile without any errors only problem is in the game it does nothing. What supposed to happen is, the player uses the spell to surround themselves with trees for protection (like a tree wall). I wrote a script to spawn the trees (activators) and then to move them to surround the player, however like i mentioned nothing happens in game when the spell is cast. Can anyone help me or at least point me in the right direction?

 

Scriptname MMFTDruidSpellTreeDome extends MagicEffect
actor Property akCaster auto
actor Property akTarget auto
activator Property akActivator auto
ObjectReference Tree1
ObjectReference Tree2
ObjectReference Tree3
ObjectReference Tree4
Event OnEffectStart(Actor akTarget, Actor akCaster)
Tree1 = akCaster.PlaceAtMe(akActivator)
Tree2 = akCaster.PlaceAtMe(akActivator)
Tree3 = akCaster.PlaceAtMe(akActivator)
Tree4 = akCaster.PlaceatMe(akActivator)
Tree1.MoveTo(akCaster, 0, 0, 5)
Tree2.MoveTo(akCaster, 5, 0, 0)
Tree3.MoveTo(akCaster, 5, 0, 0)
Tree4.MoveTo(akCaster, 0, 0, 5)
EndEvent
Link to comment
Share on other sites

Try this and tell me what happens.

Scriptname MMFTDruidSpellTreeDome extends MagicEffect
 
activator Property akActivator  auto
 
Event OnEffectStart(Actor akTarget, Actor akCaster)
ObjectReference Tree1 = akCaster.PlaceAtMe(akActivator)
ObjectReference Tree2 = akCaster.PlaceAtMe(akActivator)
ObjectReference Tree3 = akCaster.PlaceAtMe(akActivator)
ObjectReference Tree4 = akCaster.PlaceatMe(akActivator)
Tree1.MoveTo(akCaster, 50, 50, 0)
Tree2.MoveTo(akCaster, 50, -50, 0)
Tree3.MoveTo(akCaster, -50, 50, 0)
Tree4.MoveTo(akCaster, -50, -50, 0)
EndEvent
Link to comment
Share on other sites

Ok, tried your edit Elias and still nothing. The trees are still not spawning. I even turned of collision after using the spell to try and run around and find them but they were no where to be found.

 

Steve, not sure how to check script log for errors. When i compile it in CK it says success no failures. I did notice after i gave my self the spell in the game and then opened console it said script not saved, but after doing it on a new save game and that messaged left. Still no results though.

Link to comment
Share on other sites

Ok, tried your edit Elias and still nothing. The trees are still not spawning. I even turned of collision after using the spell to try and run around and find them but they were no where to be found.

 

Steve, not sure how to check script log for errors. When i compile it in CK it says success no failures. I did notice after i gave my self the spell in the game and then opened console it said script not saved, but after doing it on a new save game and that messaged left. Still no results though.

 

https://www.creationkit.com/index.php?title=FAQ:_My_Script_Doesn%27t_Work!

Link to comment
Share on other sites

Fixed it :) thanks guys. The script wasn't firing. in the title i had,

Scriptname MMFTDruidSpellTreeDome extends MagicEffect

 

I changed the ending (not sure what that part is called sorry) to,

Scriptname MMFTDruidSpellTreeDome extends ActiveMagicEffect

 

The log said the bases did not match between my script and my magic effect. I don't fully understand why this fixed it but it did haha. Thanks again :)

Link to comment
Share on other sites

Exactly what is the position your trying to move to 360 degrees, then offset, referencing whom you are moving too??

 

Then let's not forget Math.cos & Math.sin, I hate to tell you this, but your script still needs a lot of work. But if your happy with it, go with it.

 

But it will move along world X & Y, while ignoring the Z Angle of the akCaster.

 

Just Sayin.

Link to comment
Share on other sites

Thanks Peter, but it does what I need it to do. I'm aware of the whole math side but sadly I don't get math, all that is beyond me lol. I just wanted to spawn my activators to surround the player, which they did.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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