Wednesday, April 18, 2012

no "Initially On" check for JASSd triggers?

hello, long time since i posted. So i'm trying to make this trigger where, if a unit enters the middle of the map, every 0.3 seconds or so a floating text appears with the text "+1" and i was having major issues both with jass and GUI.

JASS problem: the trigger runs on map initialization which it shouldnt, plus it runs in "burts"... like it would run for 2 seconds, then pause 2 seconds, then run again.

GUI problem: the problem runs on initialization.

I fixed the GUI problem though, by un-checking "Initially on" in the trigger window (a little rusty at mapmaking :P), but I couldnt do the same with the jass version because the "Initially on" is replaced by "run on map initialization" and unchecking that one did no difference.

i designed the trigger so that one trigger uses the "A unit enters region" event and triggers one of the following:

JASS:


Code:
function Trig_redincome_Actions takes nothing returns nothing
local integer i = 1
local integer j = 2
loop
exitwhen i > j
call TriggerSleepAction( 0.01 )
call CreateTextTagLocBJ( "+1", GetRectCenter(GetPlayableMapRect()), 0, 10, 100, 100, 100, 0 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 300.00, GetRandomReal(110.00, 160.00) )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 3.00 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 2.50 )
endloop
endfunction

//===========================================================================
function InitTrig_redincome takes nothing returns nothing
set gg_trg_redincome = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_redincome, 0.10 )
call TriggerAddAction( gg_trg_redincome, function Trig_redincome_Actions )
endfunction

GUI


Code:
redincomee
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Floating Text - Create floating text that reads wtf at (Position of Circle of Power (large) 0004 <gen>) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Set the velocity of (Last created floating text) to 144.00 towards 243.00 degrees
Floating Text - Change the age of (Last created floating text) to 2.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds

feel free to share other ideas on how to make this trigger work. As mentioned I am rusty and could use a kick in the right direction|||ok, so it works perfectly using GUI atm but it still only works in bursts in jass, and i really want this trigger in jass so i can use locals to change velocity and size of the text etc. thanks in advance|||Not quite sure why you'd want to use Jass here, but ohw well, there is a
Code:
call TriggerRegisterTimerEventPeriodic( gg_trg_redincome, 0.10 )

at the bottom of your code, it now says it repeats the actions in redincome every 0.10 seconds, you'd want to change this value to 2 seconds if you want the trigger to be ran every 2 seconds.

Edit: Why you want to use local variables again, cause from what I can see, you just converted this trigger.

as for innitially on, you can still edit that in your trigger, like you used to.|||Maybe there's something obvious that I'm missing, but that looks suspiciously like an infinite loop. You put 'exitwhen (i > j)', but nothing to modify either. If that was your intention, local variables aren't needed, 'exitwhen false' works better. If that IS intended, use TriggerRegisterTimerEventPeriodic OR an infinite loop, not both. As for 'initially on', all that actually does is add 'call DisableTrigger(TriggerNameHere)' before the event, so you can easily add that to your JASS trigger. Also, you've got the JASS version on a timer of 0.10, down from 1.00. Was that intended?|||Quote:






View Post

Maybe there's something obvious that I'm missing, but that looks suspiciously like an infinite loop. You put 'exitwhen (i > j)', but nothing to modify either. If that was your intention, local variables aren't needed, 'exitwhen false' works better. If that IS intended, use TriggerRegisterTimerEventPeriodic OR an infinite loop, not both. As for 'initially on', all that actually does is add 'call DisableTrigger(TriggerNameHere)' before the event, so you can easily add that to your JASS trigger. Also, you've got the JASS version on a timer of 0.10, down from 1.00. Was that intended?




yes, the loop is intended to be infinite, until a hero leaves a certain region. Thanks for the advices. And I have noticed that im using both a loop and a "every 0.1 second" so that should be the problem. However, I scrapped the whole idea and it's no longer in the map. Your inputs are still appriciated though!

No comments:

Post a Comment