HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help Help Help Help Help Help Help!

10-30-2004, 05:02 PM#1
blah900
Hey how do u make it so if some amount of units or 2of footman and 2 of grunts go in a specific spot(like regions) and then make them get replaced by one abomination or something like that.
10-30-2004, 05:43 PM#2
Dead-Inside
Well... It depends on how many of these "exchanges" you're planning on doing?

Have an event "Unit enter region X", where region x is your region.
Then you check how many units of each type is in the region, and if there are enough for any given unit that you want to exchange (Using the action If/Then/Else) then remove the entering unit and the other units needed, and create an abdomination or whatever unit you need.
10-30-2004, 08:00 PM#3
blah900
umm i still don't get it, can you like give me an example or something? thx ^_^
10-30-2004, 08:05 PM#4
-={tWiStÄr}=-
... no, we shouldnt give you the exact triggers if thats what you want. for an example, when a unit enters a region you check if there are 2 footman and 2 grunts in the region if there are you remove then and create an abomination. otherwise you do nothing. if you can't understand that you shouldnt make this trigger until you do.
10-30-2004, 08:17 PM#5
blah900
So am i supposed to put like If(footman = 2 or something like that) ?
But, i cant find a condition in integer like that, or do i have to use some kind of variable....
10-30-2004, 09:00 PM#6
xxxSpikexxx
why not post the actual trigger?

here you go
Code:
event
  - a unit enters regionX
conditions
   .- unit type of triggering unit = footman
  | - or
   .- unit type of triggering unit = Grunt
actions
   - wait 0.1 seconds
   - if number of units in units in regionX matching conditions unit type of (matching unit) = footman; owner of (matching unit) = owner of (triggering unit); (matching unit) is alive = true) => 2
        AND
   - if number of units in units in regionX matching conditions unit type of (matching unit) = Grunt; owner of (matching unit) = owner of (triggering unit); (matching unit) is alive = true) => 2
        THAN
   - replace Random unit of (units in units in regionX matching conditions unit type of (matching unit) = footman; owner of (matching unit) = owner of (triggering unit); (matching unit) is alive = true) with  abomination
   - remove random unit of (units in units in regionX matching conditions unit type of (matching unit) = footman; owner of (matching unit) = owner of (triggering unit); (matching unit) is alive = true)
   - for each integer A 1 to 2 do actions:
      - remove random unit (of units in units in regionX matching conditions unit type of matching unit = Grunt; owner of (matching unit) = owner of (triggering unit); (matching unit) is alive = true)
If this trigger is to complicated for you than i really recommend you to start with somethign easier ...

it won't use you anything to copy this trigger into your map without understanding what it does... i will try to explain all that stuff:

Code:
event
  - a unit enters regionX
conditions
   .- unit type of triggering unit = footman
  | - or
   .- unit type of triggering unit = Grunt

this is my way ... so you don't have to make a periodic event but only need to check if there are enough units when the number acutually changes...

Code:
   - if number of units in units in regionX matching conditions unit type of (matching unit) = footman; owner of (matching unit) = owner of (triggering unit); (matching unit) is alive = true) => 2
this may look like quite a lot but it's easy to translate from the computer language:
he counts the units checking some conditions. that all have to be true:
to be counted the unit must be: in the region, a footman, owned by the same player as the unit that just entered the region and to be still alive.
after counting he checks if the number of the units he counted is 2 or more than 2.

if so ... he checks the next condition that also has to be true ... the same thing just that he counts the grunts...

now if both condtions are true he goes on
Code:
   - replace Random unit of (units in units in regionX matching conditions unit type of (matching unit) = footman; owner of (matching unit) = owner of (triggering unit); (matching unit) is alive = true) with  abomination
he picks out one footman and replaces him with an abomination.
Code:
   - remove random unit of (units in units in regionX matching conditions unit type of (matching unit) = footman or unit type of matching unit = Grunt; owner of (matching unit) = owner of (triggering unit); (matching unit) is alive = true)
he picks out the other footman and removes him.
Code:
   - for each integer A 1 to 2 do actions:
      - remove random unit (of units in units in regionX matching conditions unit type of matching unit = Grunt; owner of (matching unit) = owner of (triggering unit); (matching unit) is alive = true)
he picks a grunt and removes him.
the "for each integer A 1 to 2 do actions" makes the computer simply repeat the action twice.
so he picks the other grunt and removes him as well.

thats it. once again i tell you: don't use it if you don't understand it ... that's no way of learning something.

also there are easier ways that use variables but i don't know if you can handle those.
10-30-2004, 09:13 PM#7
blah900
Thx a lot that help a lot! ^_^ ^_^ ^_^ ^_^ ^_^
10-30-2004, 09:15 PM#8
-={tWiStÄr}=-
Quote:
Originally Posted by xxxSpikexxx
If this trigger is to complicated for you than i really recommend you to start with somethign easier ...
If the explanation is too complicated then you should start with something easier.
Quote:
Originally Posted by xxxSpikexxx
thats it. once again i tell you: don't use it if you don't understand it ... that's no way of learning something.
Exactly.
but i think in this case it's ok because you went really in depth in the explanation so that he could understand it. it would have been different if you just gave him the trigger like a lot of people do.
10-30-2004, 09:43 PM#9
a thing
Make sure you don't make a seperate trigger for every region to save space and reduce lag.
10-30-2004, 09:55 PM#10
xxxSpikexxx
Quote:
Originally Posted by -={tWiStÄr}=-
If the explanation is too complicated then you should start with something easier.
well difiicult triggers are usually difficult to explain ... this stuff is just programming knowledge and i doubt all WE users have that ;)