- Joined
- Jun 4, 2007
- Messages
- 206
EDIT: Problem solved!!
A little backstory first: my map is a basic RPG wich uses a worldmap-like travel system, where you enter Travel Mode, select the area you want to go and the hero is teleported there - no biggie.
The system itself is very easy, I wanted to spawn different creep types upon arrival, depending on the area the hero teleported to, for that I used the CNum variable to detect everything about that area, in a separated trigger:
And so on... for the upcoming areas, I'll basically use "Cnum" to control the event "hero enters the region".
When the hero fast travels, he is teleported in the selected area, and a number of enemies spawn in random points there, up to the maximum amount allowed for that region (CREEP_max).
Everything here is working ok, the hero enters the region and gets swarmed by the correct creeps, in the correct amount (notice that he won't create new creeps if someone else was already in the region - there is a separate respawn system to keep the creeps going as long as someone is in the region).
The problem is when the hero leaves, I cannot detect the "region left" in a single trigger, in order to track it and - if there are no heros left there - clean it up (remove all creeps present)
Here's my trigger, I want to define Cnum to the region left(ignore the =1 for now), but HOW?
Thanks in advance.
A little backstory first: my map is a basic RPG wich uses a worldmap-like travel system, where you enter Travel Mode, select the area you want to go and the hero is teleported there - no biggie.
The system itself is very easy, I wanted to spawn different creep types upon arrival, depending on the area the hero teleported to, for that I used the CNum variable to detect everything about that area, in a separated trigger:
-
Creep setups
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
-------- AREA 1 --------
-
Set Cnum = 1
-
Set CREEP_region[Cnum] = 011sewers <gen>
-
Set CREEP_max[Cnum] = 20
-
Set CREEP_typeA[Cnum] = Rat
-
Set CREEP_typeB[Cnum] = Giant Rat
-
Set CREEP_typeC[Cnum] = Bat
-
Set CREEP_typeD[Cnum] = Giant Bat
-
Set CREEP_typeE[Cnum] = Wurm
-
-------- AREA 2 --------
-
Set Cnum = (Cnum + 1)
-
Set CREEP_region[Cnum] = 012murlocs <gen>
-
Set CREEP_max[Cnum] = 30
-
Set CREEP_typeA[Cnum] = Murloc
-
Set CREEP_typeB[Cnum] = Mur'gul
-
Set CREEP_typeC[Cnum] = Water Elemental
-
Set CREEP_typeD[Cnum] = Murloc Warrior
-
Set CREEP_typeE[Cnum] = Mur'gul Sorcerer
-
-
When the hero fast travels, he is teleported in the selected area, and a number of enemies spawn in random points there, up to the maximum amount allowed for that region (CREEP_max).
-
Enter areas
-
Events
-
Unit - A unit enters 011sewers <gen>
-
Unit - A unit enters 012murlocs <gen>
-
Unit - A unit enters 013gnolls <gen>
-
Unit - A unit enters 014graveyard <gen>
-
Unit - A unit enters 015mine <gen>
-
Unit - A unit enters 016foresttroll <gen>
-
Unit - A unit enters 017lighthouse <gen>
-
Unit - A unit enters 018magitower <gen>
-
Unit - A unit enters 019sacredgrove <gen>
-
Unit - A unit enters 020elventemple <gen>
-
Unit - A unit enters 021kings <gen>
-
Unit - A unit enters 022greendragon <gen>
-
Unit - A unit enters 023pirates <gen>
-
-
Conditions
-
((Triggering unit) is A Hero) Equal to True
-
-
Actions
-
Wait 0.03 seconds
-
If ((011sewers <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 1) else do (Do nothing)
-
If ((012murlocs <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 2) else do (Do nothing)
-
If ((013gnolls <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 3) else do (Do nothing)
-
If ((014graveyard <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 4) else do (Do nothing)
-
If ((015mine <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 5) else do (Do nothing)
-
If ((016foresttroll <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 6) else do (Do nothing)
-
If ((017lighthouse <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 7) else do (Do nothing)
-
If ((018magitower <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 8) else do (Do nothing)
-
If ((019sacredgrove <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 9) else do (Do nothing)
-
If ((020elventemple <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 10) else do (Do nothing)
-
If ((021kings <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 11) else do (Do nothing)
-
If ((022greendragon <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 12) else do (Do nothing)
-
If ((023pirates <gen> contains (Triggering unit)) Equal to True) then do (Set Cnum = 13) else do (Do nothing)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in (Units in CREEP_region[Cnum] matching (((Matching unit) is A Hero) Equal to True))) Equal to 1
-
-
Then - Actions
-
For each (Integer A) from 1 to CREEP_max[Cnum], do (Actions)
-
Loop - Actions
-
Set ROLL = (Random integer number between 0 and 10)
-
Set Ctemp_point = (Random point in CREEP_region[Cnum])
-
If (ROLL Less than or equal to 3) then do (Unit - Create 1 CREEP_typeA[Cnum] for Neutral Hostile at Ctemp_point facing (Random real number between 1.00 and 359.00) degrees) else do (Do nothing)
-
If ((ROLL Greater than or equal to 4) and (ROLL Less than or equal to 6)) then do (Unit - Create 1 CREEP_typeB[Cnum] for Neutral Hostile at Ctemp_point facing (Random real number between 1.00 and 359.00) degrees) else do (Do nothing)
-
If ((ROLL Equal to 7) or (ROLL Equal to 8)) then do (Unit - Create 1 CREEP_typeC[Cnum] for Neutral Hostile at Ctemp_point facing (Random real number between 1.00 and 359.00) degrees) else do (Do nothing)
-
If (ROLL Equal to 9) then do (Unit - Create 1 CREEP_typeD[Cnum] for Neutral Hostile at Ctemp_point facing (Random real number between 1.00 and 359.00) degrees) else do (Do nothing)
-
If (ROLL Equal to 10) then do (Unit - Create 1 CREEP_typeE[Cnum] for Neutral Hostile at Ctemp_point facing (Random real number between 1.00 and 359.00) degrees) else do (Do nothing)
-
Custom script: call RemoveLocation(udg_Ctemp_point)
-
-
-
-
Else - Actions
-
-
-
The problem is when the hero leaves, I cannot detect the "region left" in a single trigger, in order to track it and - if there are no heros left there - clean it up (remove all creeps present)
Here's my trigger, I want to define Cnum to the region left(ignore the =1 for now), but HOW?
Thanks in advance.
-
Leave areas
-
Events
-
Unit - A unit leaves 011sewers <gen>
-
Unit - A unit leaves 012murlocs <gen>
-
Unit - A unit leaves 013gnolls <gen>
-
Unit - A unit leaves 014graveyard <gen>
-
Unit - A unit leaves 015mine <gen>
-
Unit - A unit leaves 016foresttroll <gen>
-
Unit - A unit leaves 017lighthouse <gen>
-
Unit - A unit leaves 018magitower <gen>
-
Unit - A unit leaves 019sacredgrove <gen>
-
Unit - A unit leaves 020elventemple <gen>
-
Unit - A unit leaves 021kings <gen>
-
Unit - A unit leaves 022greendragon <gen>
-
Unit - A unit leaves 023pirates <gen>
-
-
Conditions
-
((Triggering unit) is A Hero) Equal to True
-
-
Actions
-
Set Cnum = 1
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in (Units in CREEP_region[Cnum] matching (((Matching unit) is A Hero) Equal to True))) Equal to 0
-
-
Then - Actions
-
Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units in CREEP_region[Cnum] owned by Neutral Hostile) and do (Actions)
-
Loop - Actions
-
If (((Picked unit) is An Ancient) Equal to False) then do (Unit - Remove (Picked unit) from the game) else do (Do nothing)
-
-
-
-
Else - Actions
-
-
-
Last edited: