HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

odd replace unit action

06-28-2006, 03:20 PM#1
Hemlock
I have this akward thing that happens in my game and which usses this trigger

Trigger:
Get freed
Collapse Events
Unit - A unit enters Middle <gen>
Collapse Conditions
(Unit-type of (Entering unit)) Equal to Footman
Collapse Actions
Collapse Unit Group - Pick every unit in (Units of type dead Footman) and do (Actions)
Collapse Loop - Actions
Unit - Replace (Picked unit) with a Footman using The new unit's default life and mana

The thing that happens is, when I enter a footman from player 1 into the area with a dead footman from player 2, all seems normal, but when I do it the other way around I get like 20 footmans :|

Did I miss something?
06-28-2006, 04:05 PM#2
harshateja
I'm guessing it is because the dead footman is in the region middle. THen when it is "revived" it will trigger the function again and again and again.
06-28-2006, 04:13 PM#3
Xios
Quote:
Originally Posted by harshateja
I'm guessing it is because the dead footman is in the region middle. THen when it is "revived" it will trigger the function again and again and again.

yeah i agree , you should either put:

where you turn off the trigger so it doesnt respawn.
Trigger:
Actions
Trigger - Turn off (This trigger)

or where the new unit is created somewhere else so they do not respawn loads, only the one you need.
Trigger:
Actions
Unit - Create 1 Footman for Player 1 (Red) at (Center of Alternate reagon <gen>) facing Default building facing degrees
P.S Alternate reagon is the name of the reagon i have created.
06-28-2006, 06:31 PM#4
The)TideHunter(
Or set a custom value.

A unit enters map, set custom value to 1.
Unit enters middle, if custom value = 1 then create 1, if not do nothing.
06-29-2006, 07:24 AM#5
Hemlock
This did the trick
Trigger:
Get freed
Collapse Events
Unit - A unit enters Middle <gen>
Collapse Conditions
(Unit-type of (Entering unit)) Equal to Footman
Collapse Actions
Collapse Unit Group - Pick every unit in (Units in Middle <gen> matching ((Unit-type of (Matching unit)) Equal to dead Footman)) and do (Actions)
Collapse Loop - Actions
Unit - Replace (Picked unit) with a Footman using The new unit's default life and mana
06-29-2006, 12:21 PM#6
Rising_Dusk
Notably, Replace Unit is one of the lamest and crappiest functions in WC3.
Just open it up in JC or JSP and look at it, it makes my brain cry.
I highly suggest just taking the four lines to --

Trigger:
Actions
Unit - Hide (Picked Unit)
Unit - Create 1 Footman at position of (picked unit) facing default degrees.
Unit - Remove (Picked Unit)
Unit - Set life of (last created unit) to 100%