HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Variable in Time - Periodic Event?

01-06-2003, 06:39 AM#1
Guest
I could really use a variable for the duration in the Time - Periodic Event trigger.

For some reason it just says "No generated variables of this type exist."

I tried creating a variable of type interger, time and timer with no luck.
01-06-2003, 06:58 AM#2
Guest
i dont know what you mean by "time and timer" but if you want somthing like that you put like

Events:
Event - Periodic Event 2.00 seconds. (or whatever)

Actions:
If player 1((has 1 raider) then set 'GTimeVariable'


GTimeVariable - Does ?????????

you know what i mean? i dont think this helps you at all:bgrun:
01-06-2003, 07:02 AM#3
Dinadan87
I don't understand EITHER of you.... emote_confused
01-06-2003, 07:15 AM#4
Guest
What I'm trying to do is change the "2.00" seconds to a variable I can set during the game with a different trigger.

That way I could change the frequency of the events during the game. I'm sorta thinking of a way to do this in JASS, but I want to avoid that if I can.
01-06-2003, 08:06 AM#5
Sytadel
There is a way around it.

So you want something to happen every x seconds. Lets say you had this at the end of a trigger:

Set variable: Set 'xseconds' = 5 - so then you wanted your periodic trigger to happen every 5 seconds. You could create a trigger that reduces 'xseconds' by 1 every second. Therefore if 'xseconds' = 5, then it takes 5 seconds to become 0. If it's 20, it takes 20 seconds to become 0 etc.

Then you can couple it with this:

Event - Value of Real Variable: Value of xseconds = 0, where you then run your periodic trigger. At the same time, in the actions of this trigger, you'd have it put xseconds back up to 5 or 20 or whatever it is at the time. This would simulate the effect you're looking for quite nicely.

Hope you followed that, gl.
01-06-2003, 06:12 PM#6
AIAndy
The type of the timer duration is real.
01-06-2003, 06:31 PM#7
algumacoisaqq
I don't think you can use a variable for that because what the game does is to register this trigger somewhere in the engine so that everytime the event ocour, this trigger will be called. Since the registration is only done once, the value of the period can variate. But I think there are some ways you can fake the effect you want.

My idea would to create a trigger that would be triggered every minute. inside it, you place a loop, and call this loop for the amount of times the event would happend in a minute, based on your variable. Let's say the variable is 10 second, for example, then you make the loop run 6 times, and wait 10 second each time.
Here's a pseudo-code:

loop from 1 to (Integer(60/wantedLoop))
run trigger(Event)
Wait wantedLoop seconds.
endloop

Just make shure that 60 can be devided by wantedLoop. If that's not true, it would still work, but you would have some problems with the timing.
01-06-2003, 10:24 PM#8
Guest
Thanks. I managed to find a work around. I ended up doing a little less complex but something very similar. Basically I have one trigger I'm using a to count to X then resetting it. Condition for my desired trigger is then based on X being met.
01-07-2003, 03:59 PM#9
Guest
Another way that might work is to use:

Timer - Timer Expires

And start the timer at the end of the trigger, with however many seconds you want