HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Please give me help on buggy trigger T_T

09-02-2006, 10:30 AM#1
Tempopopo
Well lets say, I want to create a trigger that makes " when the base is killed, everything owned by the owner of the base will be exploded and respawn randomly on the map. " ( this include Hero, but he will be revived at his base after 2 seconds. )

First I declare variables used for randoming the place for the bases.

Trigger:
Set Variables
Collapse Events
Map initialization
Conditions
Collapse Actions
Set RegionMAX = 16
Set Region[0] = Region 010 <gen>
Set Region[1] = Region 011 <gen>
Set Region[2] = Region 012 <gen>
Set Region[3] = Region 013 <gen>
Set Region[4] = Region 014 <gen>
Set Region[5] = Region 015 <gen>
Set Region[6] = Region 016 <gen>
Set Region[7] = Region 017 <gen>
Set Region[8] = Region 000 <gen>
Set Region[9] = Region 001 <gen>
Set Region[10] = Region 002 <gen>
Set Region[11] = Region 003 <gen>
Set Region[12] = Region 004 <gen>
Set Region[13] = Region 005 <gen>
Set Region[14] = Region 006 <gen>
Set Region[15] = Region 007 <gen>

then I start making a trigger that will randomly create the base in these regions when a player select a Hero.

Trigger:
Beast Nation
Collapse Events
Unit - A unit Sells a unit
Collapse Conditions
(Triggering unit) Equal to Beast Nation Tavern (Riderless) 0008 <gen>
Collapse Actions
Player Group - Pick every player in (All players) and do (If (((Triggering unit) is A structure) Equal to True) then do (Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)) else do (Do nothing))
Player Group - Pick every player in (All players) and do (If (((Triggering unit) is A structure) Equal to True) then do (Player - Limit training of Heroes to 1 for (Owner of (Sold unit))) else do (Do nothing))
Unit - Remove (Sold unit) from the game
Set RandomRegion = (Random integer number between 0 and (RegionMAX - 1))
Unit - Create 1 Kodo Base Pack (Riderless) for (Owner of (Buying unit)) at (Center of Region[RandomRegion]) facing Default building facing degrees
Unit - Create 1 (Unit-type of (Sold unit)) for (Owner of (Buying unit)) at (Position of (Last created unit)) facing Default building facing degrees
Camera - Pan camera for (Owner of (Last created unit)) to (Position of (Last created unit)) over 0.00 seconds

( This is just the trigger for the race " Beast Nation " in my map, just leeting you guys know why it has to be named " Beast Nation " )

OK. Now I have create the base, then I made a trigger that makes the base respawn randomly on the map when it gets destroyed.

Trigger:
Beast Nation D
Collapse Events
Unit - A unit Dies
Collapse Conditions
(Unit-type of (Dying unit)) Equal to Kodo Base Pack (Riderless)
Collapse Actions
Set hrc = yes
Player Group - Pick every player in (All players) and do (Unit Group - Pick every unit in (Units owned by (Owner of (Dying unit))) and do (Unit - Explode (Picked unit)))
Set RandomRegion = (Random integer number between 0 and (RegionMAX - 1))
Unit - Create 1 Kodo Base Pack (Riderless) for (Owner of (Dying unit)) at (Random point in Region[RandomRegion]) facing Default building facing degrees
Set RebornPlace = (Last created unit)
Camera - Pan camera for (Owner of (Last created unit)) to (Position of (Last created unit)) over 0.00 seconds

RebornPlace is a variable i use to store the respawning base. It is a unit type variable.

hrc is a string type variable that used to store " yes " and " non "
when it comes to " yes " that means the base is destroyed.

Then finally, I made a trigger that revive the hero of the owner of the base at his base after 2 seconds.

Trigger:
Hero Revival
Collapse Events
Unit - A unit Becomes revivable
Collapse Conditions
hrc Equal to yes
Collapse Actions
Wait 2.00 seconds
Hero - Instantly revive (Revivable Hero) at (Position of RebornPlace), Show revival graphics
Camera - Pan camera for (Owner of (Reviving Hero)) to (Position of RebornPlace) over 0.00 seconds
Set hrc = non
Set RebornPlace = No unit

The reason i made hrc = yes in the last trigger is to make this trigger take effect. If the base is destroyed (hrc = yes) the hero will be revived, but if the hero just die by himself and the base is still alive, hero wouldn't be revived. After reviving the hero when the base is respawned, I set hrc to non from preventing the hero to get revived if he die by himself.



THE BUG is that sometimes the Hero will be revived at the other player's base. I don't know what I did wrong in these trigger.... I f anyone would help me correct it, That will be greatful.

Thank you very much for paying attention. Looking forward for correction...
09-02-2006, 10:33 AM#2
DioD
Sleep ation and non array globals.

It can be fixed by arrays.
09-02-2006, 10:50 AM#3
Tempopopo
So I should remove the wait action?

And what is needed to be fixed on non array ? I don't get this point. Can u give me more explanation details ?

Thank you >_<
09-02-2006, 10:56 AM#4
DioD
Remove w8 and if player have only one hero do next.

(Position of RebornPlace[ID OF HERO OWNER]),
09-02-2006, 11:24 AM#5
Tempopopo
OK I gotcha!

Thank you very much :D