HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I need help replacing a unit with another unit (more complex:read and find out)

08-31-2004, 07:22 AM#1
fulix
In my map I want to replace a unit that enters a region owned by P1 with another unit... This works all nicely the first time but if you replace a unit and then when the replaced unit enters a region, i need to replace the replaced unit :\ Using the triggerr that goes as such: "Replace last replaced unit with unit" will not work because this is a 4p map.

Help is greatly appreciated
08-31-2004, 08:15 AM#2
storm_silver
use a unit variable or a unit type variable, and have it so the unit you replace with is set as the variable, then have the event
event - a unit enters region
condition - triggering unit = Replacement(variable) (you could have aan arrray for multiple unit types)
action - Remove triggering unit
create (unit name goes here) facing default building angle
set variable (replacement) = last created unit.

hope that helps
08-31-2004, 07:37 PM#3
fulix
Thanks but I am not good with variables, so if you could further explain the part about variables that would be greatly appreciated
08-31-2004, 07:49 PM#4
duckduck
Variables:
Click the edit variable button (the thing that looks like an x)
Click New variable (i think it's the green x thing)
Name the variable
Click the scroll bar and go down to unit and click it
Click Ok

Trigger 1
Code:
  Event:
    Unit owned by P1 enters region 001

  Actions:
    Replace entering unit with (whatever)
    Set variable -variable u created above- to last replaced unit

Trigger 2
Code:
  Event:
    Unit owned by P1 enters region 002
  
  Conditions:
    Unit type comparison -Entering unit = -variable created above-

  Actions:
    Unit replace entering unit with (whatever)
    Set -variable created above- to last replaced unit

(if this confuses u, just make variables per unit
And you can make a variable for each player or u could use arrays. arrays r kinda like subvariables. If you used a variable with an array you would add a number at the end.
ex. Player 1 is 1, player 2 is 2, etc.
Set -variable created above-[1] to last replaced unit.
Set -variable created above-[2] to last replaced unit.
08-31-2004, 08:02 PM#5
fulix
I tried to do what you said but your idea is a little different than mine. There is a trigger that sais "replace unit" and i need to know how to make it replace a unit that isnt the last created, there are multiple units of its type, and it was not orriginaly in the game (it was added with a trigger)
08-31-2004, 08:05 PM#6
fulix
Sry, I typed my last reply as you posted yours, that completely answers my question, thank you so much :)