Vykroft Posted April 27, 2016 Posted April 27, 2016 Hi, I'm back to modding and relative new with Papyrus syntax, and I'm having a little problem with a custom teleport spell, the fact is that I do not want the spell to affect childrens, but some reason is doesn't work and everyone could be teleported, even dead bodies.There is something I'm missing because the effect condition is showing in purple (attached image), so clearly I'm missing something there, I read the info in the Creation Kit Wiki but it only shows all the variable data with no clear example in some cases. Also I tried to block the spell with the script, with something like this: if Target.isChildren == 0 endif but "isChildren" is not a valid variable or Object reference, so I cannot use it inside a function. So, any ideas?
Guest Posted April 27, 2016 Posted April 27, 2016 In the condition change Target to Source. it depends on the type of the spell. Your is "Fire and Forget". In the script the correct syntax is: if target.isChild() ;whatever endIf
WraithSlayer Posted April 27, 2016 Posted April 27, 2016 Also I tried to block the spell with the script, with something like this: if Target.isChildren == 0 endif but "isChildren" is not a valid variable or Object reference, so I cannot use it inside a function. So, any ideas? isChildren is not a valid variable for Actors either, IsChild() is the function you want. Anyway, when you have an ObjectReference that you know is an Actor, you can cast it into Actor to access its Actor functions: targetActor = Target as Actor if (targetActor.IsChild() == false ;do whatever endif
Vykroft Posted April 27, 2016 Author Posted April 27, 2016 Thank is working now with this if (targetActor.IsChild() == false) ;my teleport endif I was missing the double () after the function..... so silly of me, sorry I started with Papyrus scripting yesterday... Time to add other restriction to the spell to avoid problem.
Guest Posted April 27, 2016 Posted April 27, 2016 Thank is working now with this if (targetActor.IsChild() == false) ;my teleport endif I was missing the double () after the function..... so silly of me, sorry I started with Papyrus scripting yesterday... Time to add other restriction to the spell to avoid problem. I am glad it is working now. In case you need it, there is a Papyrus Scripting Guide in my signature.
Vykroft Posted April 28, 2016 Author Posted April 28, 2016 Yup I should have read your guide first, thank you sir.
Guest Posted April 28, 2016 Posted April 28, 2016 You welcome. Congrats for the mod you posted yesterday.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.