HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to kill player's buildings if the player gets killed

08-21-2004, 10:59 PM#1
Bacalhau
I got another question... I'm not really good at complicated triggering so I need some advice as to what to do. Here's the situation:

You are a unit and you can build one tower. When this player's unit dies I want his tower to be destroyed as well (if he built one). Can somebody set me up with the triggering? I would really appreciate the help.
08-21-2004, 11:18 PM#2
johnfn
Shouldnt be too hard...

Events
Every 2.0 seconds

Actions:

If/then/else multiple conditions

If - Conditions
integer comparison: (Life of (your unit) Equal to (0))
Then - Actions
Kill - (your tower)


You might want to have a variable store the tower as a unit variable and just kill the variable. If unclear on this please reply.
08-21-2004, 11:23 PM#3
Bacalhau
Ok.
But I can't set the variable to be the tower unit. I have all these options but I can't make it the tower.
Also, the player can choose from other units also but if the player picks this class then only when this class dies I want the tower (if built) to be killed... just to clear things up...
Thanks though, I'll mess around with that for now...
08-22-2004, 06:14 AM#4
Bacalhau
I know i've been getting a lot of help here today, but this is my last question, I promise. Help me here with this trigger and I'll never bug you guys again.
08-22-2004, 06:20 AM#5
Azhag
Herex what you do. First you make a variable, make it a unit variable, and make it array. Next make a trigger. These triggers won't be exact but I'm doing this off the top of my head.

Trigger #1
Actions- Unit creating unit
Conditions- Unit being created = to Tower
Actions- Unit Group- Add Last created unit to unit group (The unit array variable)

Trigger #2
Actions- A unit dies
Conditions- triggering unit = to (unit that needs to die)
Actions- Unit Group- Kill all units in (The Unit array variable)

That should sum it up. Sorry about the crappy triggers, again I wasn't on WE and had to do it by memory.
08-22-2004, 06:25 AM#6
Tiki
events
a unit dies

conditions
unit type of dieing unit equal to true

actions
unit kill x

-or-

unit remove x
08-22-2004, 06:33 AM#7
SpadeZ
This might sound like an easy trigger but its harder than meets the eye. I wish it was that easy, but the problem is that there is not such event as "Unit Creating Unit". Its simple as to kill a unit or remove it. But to set that unit into a variable is the difficult part.

There are only 3 construction events.
Code:
Events
    Unit - A unit Begins construction
    Unit - A unit Cancels construction
    Unit - A unit Finishes construction

The problem with these 3 events is that there is no way of detecting the unit that is constructing the tower. I tried making the triggers for this but it was harder than i thought. I tried using triggering unit as the unit that was constructing these but it doesn't work. I tried using "A unit is issued an order" but i dont know the command string for build. And if all players had a more than one unit that could build more than one tower, then that would compound onto the problems because the "set variable = value" would overide each other, meaning that you would need a few more set variable = value for each player and tower that corresponds to the unit that built them.

Hope some1 figures out how to make this properly, GL .
08-22-2004, 06:36 AM#8
Bacalhau
Quote:
Originally Posted by Azhag
Herex what you do. First you make a variable, make it a unit variable, and make it array. Next make a trigger. These triggers won't be exact but I'm doing this off the top of my head.

Trigger #1
Actions- Unit creating unit
Conditions- Unit being created = to Tower
Actions- Unit Group- Add Last created unit to unit group (The unit array variable)

Trigger #2
Actions- A unit dies
Conditions- triggering unit = to (unit that needs to die)
Actions- Unit Group- Kill all units in (The Unit array variable)

That should sum it up. Sorry about the crappy triggers, again I wasn't on WE and had to do it by memory.

Thanks a lot, this is exactly what I wanted.
08-22-2004, 06:39 AM#9
SpadeZ
I'm suprise that you say that worked. I couldn't find a unit creating unit event. closest was
Code:
Events
    Unit - A unit Begins construction
    Unit - A unit Cancels construction
    Unit - A unit Finishes construction

Those you cant find the unit that was constructing them.

Well lets hope that Azaq is right.
08-22-2004, 06:51 AM#10
Bacalhau
Well I never said it worked :O
So hopefully I can find something to work around that problem or I'm screwed...

Nevermind
When unit finishes construction worked
Thanks a lot guys, this problem was killing me...
08-22-2004, 07:12 AM#11
Azhag
Quote:
Well lets hope that Azaq is right.


Azaq?? Oh man, I wish there was a cry smilly lol.
08-22-2004, 07:23 AM#12
SpadeZ
Sorry bout dat. missed the h. you could use the .
08-22-2004, 09:12 AM#13
Anitarf
Quote:
Originally Posted by Tiki
events
a unit dies

conditions
unit type of dieing unit equal to true

actions
unit kill x

-or-

unit remove x

Tiki had the easiset trigger, without any variables needed (it's just not entirely correctly typed):
Code:
Events:
  A unit dies
Conditions:
  Unit type of (dying unit) equal to (the type that kills the tower when it dies)
Actions:
  pick all units owned by (owner of (dying unit)) matching ((matching unit) is a structure equal to true (this is boolean - unit classification check)) and do actions:
    loop - actions:
      kill (picked unit)
08-22-2004, 04:40 PM#14
Bacalhau
No, but I want it to be the last constructed building like Azhaq said....
08-22-2004, 08:17 PM#15
Tiki
Events:
A unit dies
Conditions:
Unit type of (dying unit) equal to (the type that kills the tower when it dies)
and
--- something was last created unit equal to true
Actions:
pick all units owned by (owner of (dying unit)) matching ((matching unit) is a structure equal to true (this is boolean - unit classification check)) and do actions:
loop - actions:
kill (picked unit)