HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Triggering Troubles

03-26-2008, 09:06 AM#1
Fledermaus
Ok so I want to have a special unit roam around a few regions.
Once the unit appears he if ordered to start the roaming loop.

Trigger:
Appear
Collapse Events
Game - The in-game time of day becomes Equal to 5.00
Collapse Conditions
SomeInt Equal to 1
(Unit[5] is alive) Equal to True
Collapse Actions
Sound - Play HawkWhat2 <gen>
Sound - Play GargoyleWhat1 <gen>
Set TempPoint = (Position of Unit[5])
Special Effect - Create a special effect at TempPoint using Abilities\Spells\Undead\DeathPact\DeathPactTarget.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_TempPoint)
Unit - Unhide Unit[5]
Wait 3.00 seconds
Trigger - Run Wander <gen> (ignoring conditions)
Trigger - Turn on Disappear <gen>

Trigger:
Wander
Collapse Events
Unit - A unit enters UnitMove <gen>
Collapse Conditions
(Triggering unit) Equal to Unit[5]
Collapse Actions
Wait (Random real number between 1.00 and 3.00) seconds
Set TempInteger = (Random integer number between 1 and 2)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
TempInteger Equal to 1
Collapse Then - Actions
Set TempPoint = (Random point in Patrol1 <gen>)
Collapse Else - Actions
Set TempPoint = (Random point in Patrol2 <gen>)
Unit - Order Unit[5] to Attack-Move To TempPoint
Region - Center Region[5] on TempPoint
Custom script: call RemoveLocation(udg_TempPoint)

Unit[5] and Region[5] have both been initialized before Appear will run.


So once Unit[5] is unhidden he will attack-move to the random point. The problem is that when he reaches this point (and should have entered the region) the Wander trigger wont fire. So he will just camp at the first random point until he is hidden again.
03-26-2008, 12:04 PM#2
Gorman
Also, Region[5] = UnitMove right? coz if not then that is why it fails.

Id say just hide him, move the region, then unhide him, and try moving the region before the unit.
03-26-2008, 12:10 PM#3
Fledermaus
Yes of course it is.

I don't understand what you're saying with the other bit, could you make it a bit clearer please?
03-26-2008, 12:44 PM#4
Gorman
Just checking ^^

Ok, with the other bit i was thinking it wasnt triggering because it wasnt sensing him exit the region, so try hiding the unit, then move the region, then unhide the unit, so the trigger will work properly:
Trigger:
Unit - Hide Unit[5]
Region - Center Region[5] on TempPoint
Unit - Unhide Unit[5]

Just like that, insted of just using the, center region on point.
03-26-2008, 11:14 PM#5
Fledermaus
Sorry but I still don't follow you =/ could you put it into my code?
03-27-2008, 07:37 AM#6
Gorman
Like this:

Trigger:
Wander
Collapse Events
Unit - A unit enters UnitMove <gen>
Collapse Conditions
(Triggering unit) Equal to Unit[5]
Collapse Actions
Wait (Random real number between 1.00 and 3.00) seconds
Set TempInteger = (Random integer number between 1 and 2)
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
TempInteger Equal to 1
Collapse Then - Actions
Set TempPoint = (Random point in Patrol1 <gen>)
Collapse Else - Actions
Set TempPoint = (Random point in Patrol2 <gen>)
Unit - Order Unit[5] to Attack-Move To TempPoint
Unit - Hide Unit[5]
Region - Center Region[5] on TempPoint
Unit - Unhide Unit[5]
Custom script: call RemoveLocation(udg_TempPoint)
03-27-2008, 09:23 AM#7
Fledermaus
I'll try it but I really don't see how that would make any difference.
03-28-2008, 01:06 PM#8
Gorman
well i hav a feeling that the program is having a sad because it isnt registering that the unit is leaving the region, ie the unit is in the region, then the region moves, so the unit hasnt realy left it.

I think blizzards programing is a bit... interesting... in this kind of situation
03-29-2008, 03:58 PM#9
Burning Rose
One foreseeable problem, though probably not the issue here, is if the new random point is inside the region. If you get unlucky, the unit will move to the point, but never have left the region.
03-30-2008, 01:00 AM#10
Gorman
but hiding, then moving, then unhiding will solve that problem right?
03-31-2008, 12:02 PM#11
Fledermaus
I had tried it multiple times to make sure that the regions new position didn't still include the old position. Plus the region is smallish.
04-04-2008, 11:48 AM#12
[VDM]Amn
alou there, i was missing wc3camp so bad, so i'm back


bro, just use two regions.

if still u want to solve that code, debug it.

make a trigger that tells you if the unit is inside that region
when that unit moves to the region and stops, run the trigger.

Trigger:
tst anim
Collapse Events
Player - Player 1 (Red) types a chat message containing CheckIt! as An exact match
Conditions
Collapse Actions
If (((Region[5]) contains (gay_unit)) Equal to True) then do (Game - Display to (All players) the text: "unit is inside") else do (Game - Display to (All players) the text: "unit is not inside")

Edit: btw, are u sure that
(Triggering unit) Equal to Unit[5]
shouldn't be (entering unit) ?

to make sure that this condition is working and da' trigger is running, put a game-message there, to make sure the trigger is being ran.
04-04-2008, 12:41 PM#13
Fledermaus
Yeah I'm a noob, I was moving Region[5], not UnitMove <gen> =/