How many times should this script execute when a creature spawns?
I am noticing that when a familiar is summoned the OnSpawn script executes twice. Is there a reason for that? Or would it be better to catch and abort the second iteration of the script?
OnSpawn Script
Débuté par
henesua
, févr. 08 2012 05:54
#1
Posté 08 février 2012 - 05:54
#2
Posté 08 février 2012 - 11:11
Ok, I am at a loss on this one, I am not even sure what script is firing for th eonspawn of a fimmiliar. How are you determining that the script is firing twice?
#3
Posté 08 février 2012 - 11:48
Its the familiar's OnSpawn that I am examining in this case. I think the name of the script is nw_ac_acani9. or something like that. I'll post the exact name when I get home.
I put a check in the script that notifies the first pc everytime the script executes. Its been executing twice when I summon the familiar. This isn't really a problem... BUT given that spawn events are considered a potential source of lag, I'm thinking that if every spawn script executes twice... thats part of the problem.
Anyway... lets just focus on familiars. Would there be any reason why the script needs to execute twice? If not, I'll short circuit the second execution.
I put a check in the script that notifies the first pc everytime the script executes. Its been executing twice when I summon the familiar. This isn't really a problem... BUT given that spawn events are considered a potential source of lag, I'm thinking that if every spawn script executes twice... thats part of the problem.
Anyway... lets just focus on familiars. Would there be any reason why the script needs to execute twice? If not, I'll short circuit the second execution.
#4
Posté 09 février 2012 - 12:35
ok, Yep that one ran twice when I called a fimiliar also.
So here is a guess, I am guessing that the creature is created once, then copyed/created a second time to init the creature as a fimiliar. So if you did stop one of them from running you would want to stop the first one and not the second.
However the script itself does not take that long to run. It only takes 0.00005 seconds on my rig. It is the spawning of the creature that takes the time, not the OnSpawn script. So I do not think it is worth the possiable bugs you could interduce in trying to stop it from running an extra time.
So here is a guess, I am guessing that the creature is created once, then copyed/created a second time to init the creature as a fimiliar. So if you did stop one of them from running you would want to stop the first one and not the second.
However the script itself does not take that long to run. It only takes 0.00005 seconds on my rig. It is the spawning of the creature that takes the time, not the OnSpawn script. So I do not think it is worth the possiable bugs you could interduce in trying to stop it from running an extra time.
#5
Posté 09 février 2012 - 08:11
OK thanks for the info. I looked deeper into the OnSpawn options this morning and played more with this script. My changes only happen on the familiar's second pass through. Everything is working well...
...casting a spell so that effects granted by familiar summoning can be easily removed when the familiar is unsummoned.
...casting a spell so that effects granted by familiar summoning can be easily removed when the familiar is unsummoned.





Retour en haut






