• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need help with heros changing owner...

Status
Not open for further replies.
Level 3
Joined
Sep 6, 2005
Messages
20
I have a map where you give a computer a hero unit to a computer to attack with by moving it into a region. When it dies under the computer's control, I want the hero to go back under the original owners control so he can revive at the altar, use skill points, and buy more items for the hero. The current trigger I have goes something like this...

Trigger 1:
Events: Unit - A unit enters (region)

Conditions:

Actions: Unit - move unit instantly to center of (other region) facing (another region)

Unit - change ownership of (triggering unit) to player 9 (computer) and retain color.

Trigger 2:
Events:
A unit owned by player 9 (computer) dies

Conditions:
((Triggering Unit)is a hero) equal to true

Actions:

Unit - Change ownership of (dying unit) to (previous owner) and retain color.



This trigger doesn't work one bit that I can notice. I know that when I give a hero to gray, and it dies, it doesn't come back to me. Does anybody have any tips?
 
Level 4
Joined
Apr 8, 2005
Messages
70
Code:
Trigger1
    Events
        Unit - A unit enters (region)
    Conditions
    Actions
        Unit - Change ownership of (Entering unit) to Player 9 (Gray) and Change color
        Unit - Move (Entering unit) instantly to (Center of Other region), facing (Center of Another region)
Code:
Trigger2
    Events
        Unit - A unit owned by Player 9 (Gray) Dies
    Conditions
        ((Triggering unit) is A Hero) Equal to True
    Actions
        Unit - Change ownership of (Dying unit) to Player 1 (Red) and Change color

I tested this, and it worked fine ^^
Hope this helps..
 
Level 7
Joined
Jul 30, 2004
Messages
451
XxMaNtiSaixX said:
I have a map where you give a computer a hero unit to a computer to attack with by moving it into a region. When it dies under the computer's control, I want the hero to go back under the original owners control so he can revive at the altar, use skill points, and buy more items for the hero. The current trigger I have goes something like this...

Trigger 1:
Events: Unit - A unit enters (region)

Conditions:

Actions: Unit - move unit instantly to center of (other region) facing (another region)

Unit - change ownership of (triggering unit) to player 9 (computer) and retain color.

Trigger 2:
Events:
A unit owned by player 9 (computer) dies

Conditions:
((Triggering Unit)is a hero) equal to true

Actions:

Unit - Change ownership of (dying unit) to (previous owner) and retain color.



This trigger doesn't work one bit that I can notice. I know that when I give a hero to gray, and it dies, it doesn't come back to me. Does anybody have any tips?


previous owner is not a property of a unit, it is a reference in a trigger

its for using in say a trigger like

--change ownership of unit X to player Z
--give previous owner of unit X 100 gold

if you want to keep reference to who owned the unit last you'll have to use variables or custom value
 
Level 3
Joined
Sep 6, 2005
Messages
20
Variables... bleh... Can somebody help me set up variables for the map. There are 8 different Human controlled players who can pick their own race. How can I set it up so each one has a variable that keeps track of their heros? Then I'll need help writing the trigger because I don't have much experience with variables yet.

Note: Tavern Heros are useable too.
 

omg

omg

Level 3
Joined
Dec 25, 2005
Messages
52
its not hard to set a variable >.< i remember when i didnt know the first thing about variables, i hated em lol, anyways all you need to do is use an action titles "set variable" its near the top of the dropdown menu.

then push a button that says "edit variables", a blank screen should pop up, unless you have some variables, if u do, ur variables will be lsited here.

click a green X button, title your variable, then use the drop down menu to select the type of variable it is. In this case the type of variable would be "unit" because were keeping track of heroes here.

now click ok, and your now back at the window where u clicked the "edit variables" button. select your newley created variable from the dropdown menu, and click ok, now for the next part of the action, click that part that comes after "set "your variable" to" and select (Last created variable) now click ok, then set up this action.

finally, place this action right under the action that created the unit u want this variable to represent, and your all done, youve got a variable =)

hope this little "mini - tutorial" of variables helped lol
 
Level 4
Joined
Apr 8, 2005
Messages
70
So what your saying is that there are two teams with 4 human players each. When lets say team 1 sends a hero into the region, a hero for player 9 is created. When that hero dies, its control goes back to the player that created it. And with team 2, their hero (After entering the region) would go to player 10...

If that's right... I could help you with your trigger...
 
Level 4
Joined
Apr 8, 2005
Messages
70
Code:
Team1Tele
    Events
        Unit - A unit enters Team1Region <gen>
    Conditions
        ((Entering unit) is A Hero) Equal to True
    Actions
        Unit Group - Add (Entering unit) to Heroes[(Player number of (Owner of (Entering unit)))]
        Unit - Change ownership of (Entering unit) to Player 9 (Gray) and Change color
        Unit - Move (Entering unit) instantly to (Center of Team1Goto <gen>)
Code:
Team2Tele
    Events
        Unit - A unit enters Team2Region <gen>
    Conditions
        ((Entering unit) is A Hero) Equal to True
    Actions
        Unit Group - Add (Entering unit) to Heroes[(Player number of (Owner of (Entering unit)))]
        Unit - Change ownership of (Entering unit) to Player 10 (Light Blue) and Change color
        Unit - Move (Entering unit) instantly to (Center of Team2Goto <gen>)
Code:
HeroDie
    Events
        Unit - A unit owned by Player 9 (Gray) Dies
        Unit - A unit owned by Player 10 (Light Blue) Dies
    Conditions
        ((Dying unit) is A Hero) Equal to True
    Actions
        For each (Integer A) from 1 to 8, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Dying unit) is in Heroes[(Integer A)]) Equal to True
                    Then - Actions
                        Unit - Change ownership of (Dying unit) to (Player((Integer A))) and Change color
                        Unit Group - Remove (Dying unit) from Heroes[(Integer A)]
                    Else - Actions
Regions:
Team1Region = The region where team 1 sends there heroes
Team2Region = Same as above but for team 2
Team1Goto = Where the hero teleports to
Team2Goto = Guess ^^

Variables:
Heroes = Unit Group Array (8)
 
Level 7
Joined
Jul 30, 2004
Messages
451
XxMaNtiSaixX said:
I looked over the trigger to make sure I had it written exactly the way you presented it, which I do, and there's a problem. It's only working for player 1... =/ help?

um, if you did it just like that it should work, i did a visual inspection of those triggers posted and they should work
 
Level 4
Joined
Apr 8, 2005
Messages
70
I just done a test of it, and it worked with all players. Make sure that you put the variable 'Heroes' as a 'Unit Group Array' with a size of '8'. Also to double check your triggers are the same as mine, right click on the title of the trigger (Abover where it says Event) then click Copy as Text. Paste this into notepad, then compare it to mine. If it's not the same you will have done a mistake.

Good luck, and I hope you getting it going ^^
 
Status
Not open for further replies.
Top