| 08-07-2006, 05:40 PM | #2 |
Try creating a loop with a 1 second polled wait and set it to end at 12 counts. Check every 1 second to see if the unit is still in the region. If not, then exit the loop. Sorry I don't have WE on this laptop so I cant make it in gui for you, but it would be something like this. I'll be home in 3 hours and then I can type it up for you if you can't figure it out. |
| 08-08-2006, 12:32 AM | #4 |
--edited to add trigger You can make it using Timers and a loop all in one trigger. I can't do well in GUI, so here is the JASS version. You should be able to copy this right over and only have to set your units ID's where I specifiied. JASS:function Necromancer_Actions takes nothing returns nothing local timer t = CreateTimer() local unit u = GetTriggerUnit() local real x = GetUnitX(gg_unit_YOURUNITID) // set this to your unit Nazgrel local real y = GetUnitY(gg_unit_YOURUNITID) // set this to your unit Nazgrel local boolean b = true call DestroyEffect(AddSpecialEffect("Objects\Spawnmodels\Undead\UCancelDeath\UCancelDeath.mdl",x,y) call TriggerSleepAction(1) call ShowUnit(gg_unit_YOURUNITID,true) // set this to your unit Nazgrel call DisplayTimedTextToForce(GetPlayersAll(), 0, 0, bj_TEXT_DELAY_HINT, " ")) call DisplayTextToForce(GetPlayersAll(), bj_TEXT_DELAY_HINT, "message") // set your message call StartSound(bj_questHintSound) call TimerStart(t,12,false,null) loop exitwhen TimerGetRemaining(t) <= 0 if RectContainsUnit(gg_rct_Region_010,u)==false then set b = false exitwhen true endif call TriggerSleepAction(1) endloop call PauseTimer(t) call DestroyTimer(t) if b==true then call ShowUnit(u,false) call CreateUnit(GetOwningPlayer(u),'YourUnitId',GetUnitX(u),GetUnitY(u),bj_UNIT_FACING) // be sure to set your unit's Id you want to create call RemoveUnit(u) endif set t=null set u=null endfunction //=========================================================================== function Necromancer_Conditions takes nothing returns boolean return GetTriggerUnit() == gg_unit_Hpal_0000 // change this to your unit endfunction function InitTrig_Necromancer takes nothing returns nothing set gg_trg_Necromancer = CreateTrigger( ) call TriggerRegisterEnterRectSimple( gg_trg_Necromancer, gg_rct_Region_010 ) call TriggerAddCondition( gg_trg_Necromancer, Condition( function Necromancer_Conditions ) ) call TriggerAddAction( gg_trg_Necromancer, function Necromancer_Actions ) endfunction |
| 08-08-2006, 06:53 AM | #5 | |
Quote:
And my suggestion is.... to use Alevice's triggers, 'cause I think there are some errors in Awakening's jass (also you forgot a ")" in line 7) Another reason is that I use GUI myself ^_^ |
| 08-08-2006, 04:31 PM | #6 |
Fixed line 7, thanks. Tell me what problem you see with my code. It works with 1 trigger and it stops the timer if he leaves the region; therefore making him have to start the timer over if he re-enters. Sounded to me like that is what he wants. Also, turning the trigger off won't stop the actions. He would still have the original bug he is trying to fix. |
| 08-08-2006, 07:05 PM | #7 |
Yah can you make the timer reset rather then pause? So he has to stand in the region for 12 seconds without leaving? |
| 08-08-2006, 07:22 PM | #8 |
That's already what it does. |
| 08-09-2006, 02:50 AM | #9 |
@Awakening: Sorry it was my fault, your jass was quite right, I thought that it wouldn't trigger the function again. But to the "Turn-off": in fact, when I look at the trigger again, I found the right thing: the timer was an ONE-SHOT one, so even if you do not turn it off, it will only execute once. |
