• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Slow "FOR"

Status
Not open for further replies.
Hi everybody! sorry for this newbish question..

When I use "For each integer..." with no Waits in it, everything happens instantanely, right? But since three days ago, when I put a 0.01 Wait in its end or beggining, the actions repeat slowly, like if there was a 0.5 Wait.

I think it's not normal because it didn't use to happen...

Thanks everybody
Hossomi
 
Level 5
Joined
May 9, 2006
Messages
162
The most exact way lies in using timers. Every times the timer expires, perform an action. Timers are most exact of three ways.
 
Almost all of my triggered spells use timers, now (I like them), so I'll need at least two triggers for each one. Some of them I can squeeze in one, but only some..

Anyway it's working perfectly, and that's enough for me ^^

I still don't know why JASS could be so much better (sorry, newbie in the area), the only thing I can see to do with it is to make functions in instead of triggers, and local variables...
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
handle vars

here is how we would do it ( assuming you have the Handle Vars in the maps custom script secion, they can be DLed Here )

anyways, here is how the trigger would work

***uses a global unit U***

Trigger 1 - the Init
Events
(your event)
Conditions
(your conditions)
Actions
Custom Script: local timer t = CreateTimer()
Custom Script: call SetHandleHandle( t, "bob", joe )
//note - for that last thing ( the SetHandleHandle ), replace "bob" with "yourstring", yourstring being the name of where you are storing it being. replace joe with your unit ( if it is A Unit Starts the Effect Of An Ability, for example, it would be GetSpellTargetUnit() for the targeted unit and GetTriggerUnit() for the casting unit. )
//here, do any other handler sets, so for example, i could do
Custom Script: call SetHandleReal( t, "bob", joe )
//with joe being the real and "bob" being the storage name

//next, do all your stuff here

next,

Custom Script: call TimerStart( t, a, true, function Trigger_Trigger2_Actions )

//a should be the time between timer calls ( most spells use 0.01 ). note - for the part that function Trigger_Trigger2_Actions, replace Trigger2 with the name of your 2nd trigger for this. also, Trigger2 must be ABOVE Trigger1 in the list of triggers.

Trigger 2
Events
(none)
Conditions
(none)
Actions
Custom Script: local timer t = GetExpiredTimer()
//next, assuming you want to get the unit and store it in variable U
Custom Script: set udg_U = GetHandleUnit( t, "yourcategory" )
//making sure "yourcategory" is the same place in which you stored it.
//here, do everything else.
 
Now you can replace 'bit' in my last post with 'really' :D

No, no. I understood almost everything. Just some things that got flying yet:

I didn't understand what 'a' is in "Custom Script: call TimerStart( t, a, true, function Trigger_Trigger2_Actions )"... It's a customized function, isn't it?


Thanks (THANKS) for your time!!! (It should have taken a lot of time to write all this stuff)
 
Status
Not open for further replies.
Top