HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problems with replacing units.

08-27-2005, 08:28 AM#1
HexenLordX
For some reason, my replace unit actions seem to be getting all screwed up.

They either:
1. Remove the unit being replaced and do not replace it, or;
2. Create the new unit instead of replacing an old one.

Anyone have any idea why this happens? I've heard about it before. I'll post my trigger if no one has any ideas.
08-27-2005, 09:31 AM#2
Tim.
Post the trigger please, my replacing actions have always worked fine.
08-29-2005, 11:05 PM#3
HexenLordX
A code tag would really help here...

Heres the trigger:

SSJ Goku
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Super Saiyan Goku
Actions
Set SSJKu[(Player number of (Triggering player))] = (Triggering unit)
Unit - Add 'Aloc' (Locust - Unselectable) to (Triggering unit)
Set SSJEXP[(Player number of (Triggering player))] = (Hero experience of (Triggering unit))
Set SSJStage[(Player number of (Triggering player))] = 0
Wait 1.50 seconds
Special Effect - Destroy AuraEffect[(Player number of (Triggering player))]
Unit - Replace SSJKu[(Player number of (Triggering player))] with a Super Saiyan Goku using The old unit's relative life and mana
Set SSJKu[(Player number of (Triggering player))] = (Last replaced unit)
Set PlayerPick[(Player number of (Triggering player))] = (Last replaced unit)
Selection - Select PlayerPick[(Player number of (Triggering player))] for (Triggering player)
Unit - Pause SSJKu[(Player number of (Triggering player))]
Hero - Set SSJKu[(Player number of (Triggering player))] experience to SSJEXP[(Player number of (Triggering player))], Hide level-up graphics
Set SSJSPOT[(Player number of (Triggering player))] = (Position of SSJKu[(Player number of (Triggering player))])
Unit - Create 10 SSJeffect for (Triggering player) at SSJSPOT[(Player number of (Triggering player))] facing Default building facing (270.0) degrees
Unit Group - Destroy unit group (Last created unit group)
Point - Remove SSJSPOT[(Player number of (Triggering player))]
Wait 2.00 seconds
Unit - Unpause SSJKu[(Player number of (Triggering player))]
Wait (Real((Hero level of SSJKu[(Player number of (Triggering player))]))) seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
SSJStage[(Player number of (Triggering player))] Greater than 0
Then - Actions
Do nothing
Else - Actions
Special Effect - Destroy AuraEffect[(Player number of (Triggering player))]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(SSJKu[(Player number of (Triggering player))] is Dead) Equal to True
Then - Actions
Hero - Instantly revive SSJKu[(Player number of (Triggering player))] at (Center of Revive <gen>), Show revival graphics
Set SSJEXP[(Player number of (Triggering player))] = (Hero experience of SSJKu[(Player number of (Triggering player))])
Unit - Replace PlayerPick[(Player number of (Triggering player))] with a Saiyan Real using The old unit's relative life and mana
Set PlayerPick[(Player number of (Triggering player))] = (Last replaced unit)
Hero - Set (Last replaced unit) experience to SSJEXP[(Player number of (Triggering player))], Hide level-up graphics
Unit - Set mana of (Last replaced unit) to 0.00
Else - Actions
Set SSJEXP[(Player number of (Triggering player))] = (Hero experience of SSJKu[(Player number of (Triggering player))])
Unit - Replace PlayerPick[(Player number of (Triggering player))] with a Saiyan Real using The old unit's relative life and mana
Set PlayerPick[(Player number of (Triggering player))] = (Last replaced unit)
Hero - Set (Last replaced unit) experience to SSJEXP[(Player number of (Triggering player))], Hide level-up graphics
Unit - Set mana of (Last replaced unit) to 0.00
Selection - Select PlayerPick[(Player number of (Triggering player))] for (Triggering player)


And the revert trigger to change him back(which very commonly duplicated the unit)

GokuRevert
Events
Advanced - Any Unit is Issued Any Order
Conditions
(Issued order) Equal to (Order(patrol))
Or - Any (Conditions) are true
Conditions
(Unit-type of (Triggering unit)) Equal to Super Saiyan 3 Goku
(Unit-type of (Triggering unit)) Equal to Super Saiyan Goku
(Unit-type of (Triggering unit)) Equal to Super Saiyan 2 Goku
Actions
Special Effect - Destroy AuraEffect[(Player number of (Triggering player))]
Set SSJEXP[(Player number of (Triggering player))] = (Hero experience of (Triggering unit))
Set SSJStage[(Player number of (Triggering player))] = 3
Set HasRevert[(Player number of (Triggering player))] = True
Unit - Replace PlayerPick[(Player number of (Triggering player))] with a Saiyan Real using The old unit's relative life and mana
Set PlayerPick[(Player number of (Triggering player))] = (Last replaced unit)
Hero - Set (Last replaced unit) experience to SSJEXP[(Player number of (Triggering player))], Hide level-up graphics
Unit - Set mana of (Last replaced unit) to 0.00
Selection - Select PlayerPick[(Player number of (Triggering player))] for (Triggering player)

08-29-2005, 11:13 PM#4
sc_freek
Try 'Owner of Triggering Unit' instead of 'Triggering Player'...
08-31-2005, 05:26 PM#5
HexenLordX
I doubt that is whats causing it to create new units instead of replace them...
08-31-2005, 08:41 PM#6
Burning_Dragoon
indeed i think sc_freek has right: cause the trigger is running because of a unit, not a player. the trigger doesn't seem to find the "triggering player" because there's noone!

i agree with sc_freek. try!
09-01-2005, 09:11 PM#7
Vexorian
Quote:
Originally Posted by HexenLordX
I doubt that is whats causing it to create new units instead of replace them...
Replace units always create units instead of replacing them
09-02-2005, 04:45 PM#8
HexenLordX
Quote:
Originally Posted by Lord Vexorian
Quote:
Originally Posted by HexenLordX
I doubt that is whats causing it to create new units instead of replace them...
Replace units always create units instead of replacing them

Then do you have any idea why its not replacing the unit I want replaced? It creates the new one just fine, but the old one is usually still there.
09-02-2005, 07:22 PM#9
Vexorian
PRobably the unit argument you are giving to the Replace unit function is null (no unit)