• 🏆 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!

Owner of entering unit is within group?

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,123
Hello everyone. I am changing jungle system in my map but i need something like this.
When someone decides to play as "Jungler" game is adding this player in "JunglerTeam1" player group.
I have a many triggers for the neutral creeps but they are not counts when jungler summons a creature and this creature get the kill. And i am looking something like this

A unit enters map.

Owner of entering unit is in JunglerTeam1 (player group)

Can i detect something like this? Because if i do that, i can make this trigger work.

  • IF THE CREATURE SUMMONED BY JUNGLER GETS THE KILL
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) is in I WANT TO ADD SUMMONED CREATURE IN HERE. Equal to True
    • Actions
      • Set TempPoint = (Position of (Dying unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Dying unit)) Equal to Murloc Flesheater (level 1)
          • ((Region centered at TempPoint with size (500.00, 500.00)) contains OrmanciDevil) Equal to True
        • Then - Actions
          • Player - Set (Owner of (Killing unit)) Current gold to (((Owner of (Killing unit)) Current gold) + 20)
          • Hero - Add 15 experience to OrmanciDevil, Hide level-up graphics
          • Game - Display to (Player group((Owner of OrmanciDevil))) for 2.00 seconds the text: Ormanci oldugun ici...


OR alternatively you can suggest another solutions. I want to make it work for all creatures summoned by this player with abilities or items. Because i can give gold for this player like this but i have to add experience for it's Hero. (OrmanciDevil = Unit)

  • Player - Set (Owner of (Killing unit)) Current gold to (((Owner of (Killing unit)) Current gold) + 20)
  • Hero - Add 15 experience to OrmanciDevil, Hide level-up graphics
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
since you can just check who the owner of the killing unit is and check if they are in the "junglerTeam1" player group, why do you need to know if it was the hero himself or a summoned unit? do you want that to change the amount of bounty they get or something?

edit: I just reread your question and I'm not sure if this is your problem, or the effect you are trying to achieve:

"I have a many triggers for the neutral creeps but they are not counts when jungler summons a creature and this creature get the kill."

please clarify...
 
Level 17
Joined
Jun 2, 2009
Messages
1,123
since you can just check who the owner of the killing unit is and check if they are in the "junglerTeam1" player group, why do you need to know if it was the hero himself or a summoned unit? do you want that to change the amount of bounty they get or something?

edit: I just reread your question and I'm not sure if this is your problem, or the effect you are trying to achieve:

"I have a many triggers for the neutral creeps but they are not counts when jungler summons a creature and this creature get the kill."

please clarify...
If the summoned unit get the kill, i can give extra gold for the owner.
But if the summoned unit get the kill, i have to detect hero and give extra experience for the hero who summoned it.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
I'm sorry, I assume English isn't your native language, but I still don't exactly understand what you want.

which one of these is what you want?

1. when the summoned unit gets the kill - it counts as if the summoning hero got the kill in terms of gold and exp.

2. when the summoned unit gets the kill - the summoning hero gets more gold and exp than if the hero would have made the kill.


(also - I'm assuming this is some sort of hero arena/aos map where each player only controls one hero...)
 
Level 17
Joined
Jun 2, 2009
Messages
1,123
I'm sorry, I assume English isn't your native language, but I still don't exactly understand what you want.

which one of these is what you want?

1. when the summoned unit gets the kill - it counts as if the summoning hero got the kill in terms of gold and exp.

2. when the summoned unit gets the kill - the summoning hero gets more gold and exp than if the hero would have made the kill.


(also - I'm assuming this is some sort of hero arena/aos map where each player only controls one hero...)
Yes it is not. The number 2 i am asking for.
Even if my hero or my summoned creature get the kill, i want to give bonus gold & exp to hero.


When you summon the creature and summoned unit gets the kill, i want to detect owner of the summoner and give the hero bonus experience.
Currently, hero have to last hit for the extra experience.
It is not a problem when it comes to gold. Because there are already present action for that.
player.gif
Player - Set (Owner of (Killing unit)) Current gold to (((Owner of (Killing unit)) Current gold) + 20)

  • Player - Set (Owner of (Killing unit)) Current gold to (((Owner of (Killing unit)) Current gold) + 20)
  • Hero - Add 15 experience to OrmanciDevil, Hide level-up graphics
If the summoned unit gets the kill, hero don't get the experience. It is my summon. My summoned creature get the kill. But i want to get my extra experience.
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
If I understood correctly what you are trying to do, something like this should work fine (I'm assuming the summons are the only other fighting units you can control besides your hero, and that you only have one hero - like dota. If this is not the case I can change this accordingly...)

  • summons bonus
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Owner of (Killing unit)) is in JungleGroup1.) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Killing unit) is A Hero) Equal to False
        • Then - Actions
          • Set VariableSet OwnedHeroes = (Units owned by (Owner of (Killing unit)) matching (((Matching unit) is A Hero) Equal to True).)
          • Unit Group - Pick every unit in OwnedHeroes and do (Actions)
            • Loop - Actions
              • -------- here you give extra exp etc --------
        • Else - Actions
Edit: slightly added to the trigger...
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
Edit: Misunderstood slightly, you'd still want some way to mark the unit as a "Jungler".

If each player only controls 1 Hero then Unit Groups are unnecessary. You should store each Hero in a Unit array which uses the Player's number as the [Index]:
  • Set Variable PlayerHero[1] = Player 1's hero
  • Set Variable PlayerHero[2] = Player 2's hero
  • Set Variable PlayerHero[3] = Player 3's hero
  • etc...

Obviously you'd want to Set these variables when the Player first chooses their Hero, assuming your map works like that.

With that Array setup you'll now have no issue getting a Player's Hero at any given moment:
  • Events
  • Unit - A unit Dies
  • Conditions
  • ((Killing unit) is Summoned) Equal to True
  • Actions
  • Set Variable KillPN = (Player number of (Owner of (Killing unit)))
  • Hero - Add 15 experience to PlayerHero[KillPN], Hide level-up graphics
The above trigger will add 15 experience to the Killing player's Hero.

You want to design your triggers to be more generic, it'll make your life easier and greatly reduce the number of triggers/variables needed.
Using the Arrays + Player Numbers method you'll be able to simplify your triggers and store specific information to each player while being able to access it in a generic way.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,123
I am sorry but i have totally confused. Let me start from beginning. Count it as "new" question.

  • Events
    • Unit - A unit Dies
  • Conditions
    • (Level of GOD_Ability[1] for (Killing unit)) Greater than or equal to 1
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Dying unit)) Equal to Murloc Flesheater (level 1)
      • Then - Actions
        • Player - Set (Owner of (Killing unit)) Current gold to (((Owner of (Killing unit)) Current gold) + 20)
        • Hero - Add 15 experience to OrmanciDevil, Hide level-up graphics
      • Else - Actions
Why i am not getting bonus experience if my creature get the kills? Because it is my creature? I know why but i just wanted start from beginning.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
If your Actions aren't happening when a unit Dies it's because the Conditions aren't true:
  • (Level of GOD_Ability[1] for (Killing unit)) Greater than or equal to 1
  • (Unit-type of (Dying unit)) Equal to Murloc Flesheater (level 1)

Does your creature (killing unit) have the GOD_Ability[1]? Is the dying unit a Murloc Flesheater (level 1)?

If both are true, you'll get the gold/experience. Otherwise, nothing will happen.

Also, that's assuming that OrmanciDevil is set to the correct Hero.
 
Last edited:
Level 17
Joined
Jun 2, 2009
Messages
1,123
If your Actions aren't happening when a unit Dies it's because the Conditions aren't true:
  • (Level of GOD_Ability[1] for (Killing unit)) Greater than or equal to 1
  • (Unit-type of (Dying unit)) Equal to Murloc Flesheater (level 1)

Does your creature (killing unit) have the GOD_Ability[1]? Is the dying unit a Murloc Flesheater (level 1)?

If both are true, you'll get the gold/experience. Otherwise, nothing happens.

Also, that's assuming that OrmanciDevil is set to the correct Hero.
It is just a dummy ability within spellbook. How can i solve this? I will try to solve it with this trigger. I will report when my test ends.

  • Events
    • Unit - A unit enters (Entire map)
  • Conditions
    • (Owner of (Triggering unit)) Equal to (Owner of OrmanciDevil)
  • Actions
    • Unit - Add GOD_Ability[1] to (Triggering unit)
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
No no i mean how can i solve this? Think of me like i'm stupid. How can i get bonus gold when my summon get the kill? Ok i can make any passive ability. But what should i do with this ability?
I'm not too sure what you mean. I already told you the reasons why your trigger wouldn't work, if you fix those issues then it will work.

If your (Killing unit) has GOD_Ability[1] and it's still not working then you should try to use a different ability that isn't in a Spellbook.
But I doubt this is the issue.

Also, are you sure you've set GOD_Ability[1]?
  • Set Variable GOD_Ability[1] = Holy Light

Possible issues:
  • (Killing unit) doesn't have GOD_Ability[1]. You can give your units this ability through the Object Editor or through triggers.
  • (Dying unit) is not a Murloc Flesheater (level 1).
  • GOD_Ability[1] is never Set or Set to the wrong ability.
  • OrmanciDevil is never Set or Set to the wrong unit. You'd still get the Gold though.
The trigger I'm talking about:
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Level of GOD_Ability[1] for (Killing unit)) Greater than or equal to 1
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of (Dying unit)) Equal to Murloc Flesheater (level 1)
      • Then - Actions
        • Player - Set (Owner of (Killing unit)) Current gold to (((Owner of (Killing unit)) Current gold) + 20)
        • Hero - Add 15 experience to OrmanciDevil, Hide level-up graphics
      • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
I know i know. I just decided to give up. Because i cannot detect reincarnated unit and cannot give ability to it. I have an important item that revives netural creeps for 60 seconds. I cannot give ability to it.
You can detect Reincarnation using a system like this: GUI Unit Event v2.5.2.0

There's probably an alternate solution though but I don't fully understand what you're trying to do.
 
Level 17
Joined
Jun 2, 2009
Messages
1,123
You can detect Reincarnation using a system like this: GUI Unit Event v2.5.2.0

There's probably an alternate solution though but I don't fully understand what you're trying to do.
Sure. Let me tell you.

Uncle has selected role as "Jungler"
Dear Uncle and his friends. You can kill neutral hostile units for gold and experience. But if Uncle kills, he get bonus gold and experience. And Uncle has an item called Staff of Reincarnation. He can revive killed Neutral Hostile units and can control them for 60 seconds. He cannot go further without this staff.

And i will check this GUI event now. Thank you for assist.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,510
Cheshire suggested using a Unit Group to keep track of "Junglers". He showed you how to do it that way.

Here's how I would go about it:

Use a Boolean array to keep track of which players have the "Jungler" role:
  • Set Variable IsJungler[Player number of (Triggering player)] = True

Use a Unit array to keep track of each player's hero:
  • Events
  • Unit - A Hero Is Selected
  • Actions
  • Set Variable PlayerHero[Player number of (Triggering player)] = (Triggering unit)

You are now keeping track of which players are Junglers and can access any Player's hero at any time using the PlayerHero variable.

Now whenever a Neutral Hostile unit dies you can figure out who killed it using these variables:
  • Neutral Hostile Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Set Variable KillingPlayer = (Owner of (Killing unit))
      • Set Variable PN = (Player number of KillingPlayer)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • IsJungler[PN] Equal to True
        • Then - Actions
          • -------- A Jungling player killed the Neutral Hostile unit: --------
          • -------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PlayerHero[PN] Equal to (Killing unit)
            • Then - Actions
              • -------- The Hero killed it: --------
              • Player - Add 10 to KillingPlayer.Current gold
              • Hero - Add 10 experience to PlayerHero[PN], Hide level-up graphics
            • Else - Actions
              • -------- (BONUS) A Summon killed it: --------
              • Player - Add 20 to KillingPlayer.Current gold
              • Hero - Add 20 experience to PlayerHero[PN], Hide level-up graphics
        • Else - Actions
          • -------- It wasn't a Jungling player that killed the unit: --------
          • -------- --------
          • Player - Add 5 to KillingPlayer.Current gold
          • Hero - Add 5 experience to PlayerHero[PN], Hide level-up graphics

For the Staff of Reincarnation, you'd have to explain it in more detail for me to understand. Do you activate the item? Is it like the Paladin's Resurrection ability? Or is it Passive?

But understand that there is no way to revive a non-Hero unit. What you have to do is Create a new unit to replace it.
  • Events
  • Unit - A unit dies
  • Actions
  • Unit - Replace (Dying unit) with a (Unit-type of (Dying unit)) using The new unit's default life and mana
  • Unit - Change ownership of (Last replaced unit) to Player 1 (Red) and Change color
This is just an example since I don't know how your Staff works. Also, remember that once a Corpse finishes decaying it'll be removed from the game entirely.
 
Last edited:
Status
Not open for further replies.
Top