| 05-16-2009, 07:09 PM | #1 |
ok, so in this spell i made its supose to create 8 flames arround an area and then destroy them in 15 seconds. i made a custom function to do that it is JASS:function sfxcnd takes string sfx, real x, real y, real dur returns nothing local effect e = AddSpecialEffect(sfx,x,y) call TriggerSleepAction(dur) call DestroyEffect(e) endfunction and in my spell trigger i do this JASS:call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) set x = x + 50 call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) call reset(x,y,p) set x = x - 50 call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) call reset(x,y,p) set y = y - 50.00 call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) call reset(x,y,p) set y = y + 50 call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) call reset(x,y,p) set y = y - 25 set x = x - 25 call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) call reset(x,y,p) set x = x - 25 set y = y + 25 call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) call reset (x,y,p) set x = x + 25 set y = y + 25 call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) call reset (x,y,p) set x = x + 25 set y = y - 25 call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) im sure theres probly a better way to do this but still, the problem is it only creates 1 sfx, waits, deletes it, creates another? instead of creating them all at once is there a problem with my function i can fix? |
| 05-16-2009, 07:16 PM | #2 |
As it only creates the first two effects I'd say there's something wrong with your reset function. |
| 05-16-2009, 07:24 PM | #3 |
it creates them all it just waits 15 seconds before creating the other one. JASS:function reset takes real x, real y, location p returns nothing set x = GetLocationX(p) set y = GetLocationY(p) endfunction |
| 05-16-2009, 07:54 PM | #4 |
You're using a TriggerSleepAction in the sfxcnd function. That doesn't only affect the function it's in but the whole trigger that runs this function. I guess you'll have to run a timer per effect, attach the effect to the timer and destroy it when the timer expires. I think there might even be a library here on wc3c that helps to manage timed effects like that. Edit: here: http://www.wc3c.net/showthread.php?t...t=TimedEffects |
| 05-16-2009, 08:00 PM | #5 |
> call sfxcnd("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) A direct call to this will wait for the function to finish all its procedures and so, which means it will wait 15 seconds before continuing to the next line. Put an .execute after sfxcnd: JASS:call sfxcnd.execute("Environment\\LargeBuildingFire\\LargeBuildingFire1.mdl",x,y,15.00) Of course, this will only work if you have vJass... It's going to call the function in a different thread so all effects will appear at once. |
