Buildings changing ownership

For fulfilled maps that most likely don't work on the latest patch (1.24 or later).

Moderator: Cheaters

CrazyPerson
Newcomer
Posts: 1
Joined: June 19th, 2007, 11:42 pm
Location: Canada

Buildings changing ownership

Post by CrazyPerson »

How would i make an event so that a building would change ownership when it hits, for example, 1000 health.
User avatar
Xantan
Honorary wc3edit.net Traitor
Posts: 2507
Joined: February 1st, 2007, 4:11 pm
Location: NEVADA

Post by Xantan »

In gui theres quite a few ways, in fact, its not even necessary for a event you could just use a wait, but you asked for a event, so we'll do that.

Events -
Unit - A unit Starts the effect of an ability
Unit - A unit Finishes casting an ability
Unit - A unit Is issued an order targeting an object
Unit - A unit Is attacked
(four just to make sure we get to it in time)

Conditions -
(Life of (Triggering unit)) Less than or equal to 1000.00
(Triggering unit) Equal to (No Unit) <--- fill with your unit

Actions -
Unit - Change ownership of (Triggering unit) to (Picked player) and Change color
^^^^^^^^^^-- change picked player to the player you'd like it to change to.

Enjoy.
User avatar
Unscrewed_Magic
Senior Member
Posts: 133
Joined: June 18th, 2007, 3:05 pm
Location: Azeroth

Post by Unscrewed_Magic »

you should just need

Event
Unit - A unit Is attacked

as long as the unit is taking damage, it counts as being attacked
"Unit - A unit Is attacked" is really "Unit - A unit takes damage"

at least, that is how I use it...
ImageImage
Current Project
Humans vs Orcs
Whose side are you on ?

Take the HvO Survey
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Post by Aero »

In JASS you could just do

Code: Select all

call TriggerRegisterUnitStateEvent(whichTrigger,whichUnit,UNIT_STATE_LIFE,ConvertLimitOp(1),1000)


This is basically

"A unit's hp becomes less than or equal to 1000"