Prevent Team Killing

Manix

Well-Known Member
Reaction score
29
So, I'm trying to prevent team killing but it does not happen ...

Code:
Prevent Team Kill
    Events
        Unit - A unit Is attacked
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Attacking unit)) is an ally of Player 1 (Red)) Equal to True
                (Percentage life of (Attacked unit)) Greater than 5.00
            Then - Actions
                Unit - Create 1 Mur'gul Slave for Neutral Hostile at (Center of Region 014 <gen>) facing Default building facing degrees
                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                Unit - Add Hex to (Last created unit)
                Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Attacking unit)
            Else - Actions
                Unit - Create 1 Mur'gul Slave for Neutral Hostile at (Center of Region 014 <gen>) facing Default building facing degrees
                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                Unit - Add Hex to (Last created unit)
                Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Attacking unit)

That's the trigger, but when i test it, I'm attacking an ally and the Mur Slaves only appear and do nothing.. Please help me ;(
 
Why not:

Code:
Prevent Team Kill
    Events
        Unit - A unit Is attacked
    Conditions
        ((Owner of (Attacking unit)) is an ally of (Owner of (Triggering Unit)) Equal to True
    Actions
         Unit - Order (Attacking unit) to stop
?
 
YES !!! SUCCSESS ! Thank you so much man !!! luv ya xD

Exide, i thought of that but its boring, my hex is 60 sec.. i doubt that somebody will attack somebody when i release the map xP + if i do this denying heroes will be impossible
 
I also had that trigger first off, but how would you check if you want to kill one of your OWN things?
 
On my map you have only hero, nothing else :p It's pretty much like dota... Only different recepies, terrain, creeps...
 
It's boring, but it works. :thup:

Also, your current trigger leaks.
And the players might not know why the suddenly turned into sheeps.. :p (You should probably add a message.)
 
YES !!! SUCCSESS ! Thank you so much man !!! luv ya xD

Exide, i thought of that but its boring, my hex is 60 sec.. i doubt that somebody will attack somebody when i release the map xP + if i do this denying heroes will be impossible

Bwuhahaha great evil minds think alike.
 
Here's the fully working trigger with no leaks..

Code:
Prevent Team Kill
    Events
        Unit - A unit Is attacked
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Attacking unit)) is an ally of Player 1 (Red)) Equal to True
                (Percentage life of (Attacked unit)) Greater than 10.00
            Then - Actions
                Unit - Create 1 Mur'gul Slave for Neutral Hostile at (Center of Region 014 <gen>) facing Default building facing degrees
                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                Unit - Add Hex to (Last created unit)
                Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Attacking unit)
                Game - Display to (All players) the text: ((Name of (Owner of (Attacking unit))) +  was |cffff0000HEXED|r for attempting to attack an ally! [30 sec])
            Else - Actions
                Unit - Create 1 Mur'gul Slave for Neutral Hostile at (Center of Region 014 <gen>) facing Default building facing degrees
                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                Unit - Add Hex to (Last created unit)
                Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Attacking unit)
                Game - Display to (All players) the text: ((Name of (Owner of (Attacking unit))) +  was |cffff0000HEXED|r for attempting to attack an ally! [30 sec])

Thought 60 secs are little bit much :p
 
it has leaks... Point Leaks to be exact...


firstly set the Center of a Region to a variable (so that we can remove it :D)


create a variable in the variable tab(X marks the spot)
create a variable named Temp_Point and the type of variable is point

then

at the triggers
ex.
set Temp_Point = Center of Region 014
Now


Code:
Prevent Team Kill
    Events
        Unit - A unit Is attacked
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Attacking unit)) is an ally of Player 1 (Red)) Equal to True
                (Percentage life of (Attacked unit)) Greater than 10.00
            Then - Actions
                [B]Set Temp_Point= Center of Region 014[/B]
                Unit - Create 1 Mur'gul Slave for Neutral Hostile at [B]Temp_Point [/B]facing Default building facing degrees
                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                Unit - Add Hex to (Last created unit)
                Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Attacking unit)
                Game - Display to (All players) the text: ((Name of (Owner of (Attacking unit))) +  was |cffff0000HEXED|r for attempting to attack an ally! [30 sec])
       [B]Custom Script: call RemoveLocation(udg_Temp_Point)[/B]
            Else - Actions

Like that
Custom Script: call RemoveLocation(udg_Temp_Point)
Custom Script is in actions

Remove Location is the idea. (udg<<variable "_" because we cant use space

"Temp_Point" variable name

caution: only remove it after it is used.. Its for points only.
 
I think i got it but why do i have to remove the region ? It's in the corner of the map surrounded with trees so nobody can get there ...
 
A variable is like a memory, in which you can store info.
Variables have different types.

For example, a unit variable.
If you want to use a certain unit for a quest, you can set a variable (*quest_unit*) to the unit that triggers the quest.
-That way you can then use that variable to get the very same unit.

So, a unit enters a quest region.
You set that unit as Quest_Unit -variable.
The unit goes away and kills a bad guy, and then returns.

In the second trigger
if the unit that returns = Quest_Unit then do .. Give Quest_Unit +500 exp.
else _do nothing_

Get it? :p
 
you are not removing a region, you are removing a point in a region


the center of a region is, the "Point" of the center of the region
the computer remembers that point since its not removed.. its just there..waiting... to be used..

this causes lags and stuff..

btw, exide.. check last reply in Elite Footman in members project.
 
Here's the fully working trigger with no leaks..

Code:
Prevent Team Kill
    Events
        Unit - A unit Is attacked
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Attacking unit)) is an ally of Player 1 (Red)) Equal to True
                (Percentage life of (Attacked unit)) Greater than 10.00
            Then - Actions
                Unit - Create 1 Mur'gul Slave for Neutral Hostile at (Center of Region 014 <gen>) facing Default building facing degrees
                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                Unit - Add Hex to (Last created unit)
                Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Attacking unit)
                Game - Display to (All players) the text: ((Name of (Owner of (Attacking unit))) +  was |cffff0000HEXED|r for attempting to attack an ally! [30 sec])
            Else - Actions
                Unit - Create 1 Mur'gul Slave for Neutral Hostile at (Center of Region 014 <gen>) facing Default building facing degrees
                Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
                Unit - Add Hex to (Last created unit)
                Unit - Order (Last created unit) to Orc Shadow Hunter - Hex (Attacking unit)
                Game - Display to (All players) the text: ((Name of (Owner of (Attacking unit))) +  was |cffff0000HEXED|r for attempting to attack an ally! [30 sec])

Thought 60 secs are little bit much :p



now you have one last problem. suppose one of your allied heroes falls under the effects of sleep and you want to wake him up, an ally cant attack it to wake it up! i hope you have noe sleep spells on your map ;)
 
yeah i get it now but it seems so complicated...

hope you have noe sleep spells on your map
i think i don't :p

I got a question to ask again.. The names of the players in text messages are white all the time.. Can you tell me how to make the colors of the names of the players in the text messages to coincide with the player's color ?
 
thats a bit of a trick. you have to do these things.

1) create a string variable array with all of the players color code tags in them (lets call it player color[])
2)create another string variable with the string |r (lets call it EndTag)

now we need a trigger


Hero deaths

Code:
Event
 A unit dies

Condition
 (Dying unit) is a Hero equal to true
 (Killing unit) is a Hero equal to true
 (Owner of (Killing unit)) is an enemy of (owner of (dying unit))

actions
 game - display text message to all players (PlayerColor[(player number of (owner of (dying unit)))] + player name of (owner of (dying unit)) + EndTag +  has just been killed by  + (PlayerColor[(player number of (owner of (killing unit)))] + player name of (owner of (killingunit)) + EndTag

and viola! you're done
 
I don't understand much of variables but i will try.. And where can i find the color codes?
 
now you have one last problem. suppose one of your allied heroes falls under the effects of sleep and you want to wake him up, an ally cant attack it to wake it up! i hope you have noe sleep spells on your map ;)

[del]True, but just simply place (Unit has Sleep buff Not Equal to True)..

Simple solution for simple problems :D..

30 seconds is too much, I'd rather die from a trigger than doing nothing and be a [del]sitting[/del] crippled duck trying to escape..[/del]

EDIT:

Oh wait there's page 2 o_O

Sorry for the spam, -rep me if you want
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top