HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Units in region.

07-19-2004, 02:22 AM#1
NightElfArcher
Does anyone know how to make it so when a certain # of units go into a region they'll morph into something else? (I.E. those old SC maps like FF7vsFF8)
07-19-2004, 05:22 AM#2
BuRnInSpartan
another easy one (if i understand) (i can do this but you might not get the morph part)

Events: Unit- A unit enters (w/e region)

Conditions: NONE

Actions: Replace Triggering unit with (w/e unit you wanted it to "morph into")

hope this works
07-19-2004, 05:37 AM#3
R3N3G4D3
he said "certain # of units", not each unit. I think he means if 5 footmen for example enter a region they turn into 1 dragon or something. You could either do it by removing each unit as it gets there and incrementing a certain counter, and after the coutner reaches a certain value create the new unit, or you could run a check each time a unit enters the area, checking the number of units of the same unit-type of the same player in that region. The 2nd way is more elegant as it allows several players to have units in the same region at once without interfering and also allows you to move your units out if you don't have enough and decide to change your mind. The trigger will look something like this:
Events:
Unit enters region X
Actions:
If (number of units of (Owner of (Triggering Unit)) of type [unit-type] is equal to #) then:
Pick every unit of (Owner of (Triggering Unit)) of type [unit-type] in region X and do: remove triggering unit
Create 1 [unit-type1] in center of region X for Player (Owner of (Triggering Unit))
endif
07-19-2004, 05:55 AM#4
BuRnInSpartan
no no no easier way

Events: A unit enters (w/e region)

Conditions: Number of units in (Units in (Playable map area))) Equal to (x)

Actions: Remove units in (w/e region)
Create (w/e unit) at (w/e region)

that should wrap it up
07-19-2004, 09:19 AM#5
R3N3G4D3
Quote:
Originally Posted by BuRnInSpartan
no no no easier way

Events: A unit enters (w/e region)

Conditions: Number of units in (Units in (Playable map area))) Equal to (x)

Actions: Remove units in (w/e region)
Create (w/e unit) at (w/e region)

that should wrap it up
First of all, yours wouldn't check units in region but entire map area, and it doesn't check the player nor the unit-type. Meaning that if any unit on the map enters the region, and the total number of all units combined on the map in any place at all is that number it removes that unit that entered the region and creates a new unit instead of it. Second of all, even if your solution would work, I don't see how it's an easier way, both take 2 lines of code.
07-19-2004, 02:21 PM#6
BuRnInSpartan
Quote:
Originally Posted by R3N3G4D3
First of all, yours wouldn't check units in region but entire map area, and it doesn't check the player nor the unit-type. Meaning that if any unit on the map enters the region, and the total number of all units combined on the map in any place at all is that number it removes that unit that entered the region and creates a new unit instead of it. Second of all, even if your solution would work, I don't see how it's an easier way, both take 2 lines of code.

_________________________________________________________________
Fine then do

Events: A unit enters (w/e region)

Conditions: Number of units in (Units in (Playable map area))) Equal to (x)
Owner of (Triggering Unit) Equal to (w/e player)
(Unit-type of (w/e unit)) is a unit Equal to True
Actions: Remove units in (w/e region)
Create (w/e unit) at (w/e region)
07-19-2004, 05:49 PM#7
R3N3G4D3
Quote:
Originally Posted by BuRnInSpartan
_________________________________________________________________
Fine then do

Events: A unit enters (w/e region)

Conditions: Number of units in (Units in (Playable map area))) Equal to (x)
Owner of (Triggering Unit) Equal to (w/e player)
(Unit-type of (w/e unit)) is a unit Equal to True
Actions: Remove units in (w/e region)
Create (w/e unit) at (w/e region)
This wouldn't work the right way either, it would check if total number of units in the area is equal to x, and then would check who the last entered unit belongs to and its unit-type and create a a unit removing them all. So here is a scenario: you want to morph 10 footmen into a frost wyrm, 9 peons (NOT FOOTMEN) or any other units for that matter owned by Player 5 enter the region, then 1 footman owned by player 2 enters the same region and all the units are removed and replaced with a frost wyrm for player 2. Btw, I already posted a working solution up there, and chances are if you make a 3rd revision to yours it will look identical to the one I have above.
07-19-2004, 06:33 PM#8
Anitarf
R3n3g4d3, your solution has a typo in it as well ;) :

Events:
Unit enters region X
Actions:
If (number of units of (Owner of (Triggering Unit)) of type [unit-type] is equal to #) then:
Pick every unit of (Owner of (Triggering Unit)) of type [unit-type] in region X and do: remove triggering unit
Create 1 [unit-type1] in center of region X for Player (Owner of (Triggering Unit))
endif

You forgot the region in the integer comparison:

If (number of units of (Owner of (Triggering Unit)) of type [unit-type] in region X is equal to #)

But anyway, yeah, this trigger does what Archer wanted, Spartan, your triggers just don't work.
07-21-2004, 06:04 PM#9
NightElfArcher
Thanks R3N3G4D3, That'll work for what I need.
07-22-2004, 01:51 AM#10
NightElfArcher
hmmm I can't seem to find this.
Code:
If (number of units of (Owner of (Triggering Unit)) of type [unit-type] is equal to #)

I know it's probably an integer but I can't find it
07-22-2004, 06:48 PM#11
R3N3G4D3
Apparently there is no single condition covering all of this (player, unit-type, and region). But you can use "Units in region matching condition" and then use "and" (because you have 2 conditions) and pick "matching unit is of type" and "owner of matching unit is player #".