Send players to jail for pkin

Arbink

New Member
Reaction score
0
im making an rpg and i want if a player kills another player the player that kills the other gets sent to a region, if its possible can i give them a warning the 1st time they do it?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
You could have an Integer variable to track the number of player kills each player has. Whenever they kill another player, increase the value of this variable by 1. If the variable value is 1 or less, then give them a warning, else move the killer into the region instantly.
 

xPass

All aboard the xPass Express!
Reaction score
27
You know actually you can use a trigger to do it.
It's something like:

Trigger:
  • JailTrigger
    • Event-A unit dies
    • Condition-Dying unit is equal to (TeamKiller)
    • Action-Teleport killing unit to (Jail)



Sry i don't have WE with me right now, it's something like that, for warning, you can use what Kearf said; the integer thingy. Jail is the region, TeamKiller is the type of hero, and JailTrigger is the name of the trigger. You can use the integer thingy then the else is:
Trigger:
  • else run trigger (JailTrigger)


For a shorter trigger, use what Kearf said:
Trigger:
  • else teleport (killing unit) to (Jail)]


Pls correct me if i'm wrong, i'm a newb too =D
Hopefully I've helped, if not, very very sorry
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
612
If I needed to, this is how I would do it:
Trigger:
  • Jail Trigger
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) belongs to an ally of (Owner of (Killing unit))) Equal to True
    • Actions
      • Set JailVar[(Player number of (Owner of (Killing unit)))] = (JailVar[(Player number of (Owner of (Killing unit)))] + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • JailVar[(Player number of (Owner of (Killing unit)))] Less than or equal to 1
        • Then - Actions
          • Game - Display to (All players matching ((Matching player) Equal to (Triggering player))) the text: (Your Warning Here)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • JailVar[(Player number of (Owner of (Killing unit)))] Greater than or equal to 2
            • Then - Actions
              • Unit - Move (Killing unit) instantly to JailRegion
            • Else - Actions
 

Squeekems

TH.net Regular
Reaction score
11
Why not just make a Boolean variable? Lol. That's essentially what you're doing. Set a Boolean Variable with an array of the number of players. If they player kill, for the first time, set it to true and tell them that they will be jailed next time. I'm feeling too lazy to make up an example trigger, but you should get the idea from the other examples.
 

Arbink

New Member
Reaction score
0
huh i cant figure out how to get the +1 in Set JailVar[(Player number of (Owner of (Killing unit)))] = (JailVar[(Player number of (Owner of (Killing unit)))] + 1)
 

Ryushi

"I will stand, or I will fall. I will not sit."
Reaction score
59
You need to use the arithmetic option, which allows you to add two values.
 

sentrywiz

New Member
Reaction score
25
You prolly play conquer online right? RIGHT?

Pking and jail is soo... conquer online-like :p:p:p


But what others said is good. Make an integer array for each player that will count the number of kills on other players (dying unit is a hero and not computer controlled)

I am lazy to open WC3 editor now so ill just type-show you:

player integer array

p1[0] = 0
p2[1] = 0
p3[2] = 0
...

when hero dies

check

> if

killing unit is a hero and player controlled
and killing unit has 0 in his array

> then

set pX[player number] = pX[player number] + 1
give warning

> else

JAIL TIME! Send to region

*additional fun thing*

make dummy unit to cast entangling roots to entering unit. roots
dont have to deal damage but they will prevent spell cast and moving.
30 second penalty should be enough :p
>
 

Hatebreeder

So many apples
Reaction score
381
Just do:

Code:
Event: A unit dies
Condition: Owner of (Killed Unit) is an ally of (Killing Unit) Player
Actions: Move (Killing Unit) to (YOURJAIL)
            Pause (Killing Unit)
            Wait(30.)
            UnPause(Killing Unit)
            Move (Killing Unit) to (OUTOFYOURJAIL)

Put Killing Unit into a unit variable.

There isn't much to it actually.
This is, however, not a MUI Version.
You'd have to index your Units.
However, this can be made very easily in JASS/vJASS. I suggest you go learn it =P
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Why is everyone posting solutions after solutions.. The solution has already been posted.

Just do:

Code:
Event: A unit dies
Condition: Owner of (Killed Unit) is an ally of (Killing Unit) Player
Actions: Move (Killing Unit) to (YOURJAIL)
            Pause (Killing Unit)
            Wait(30.)
            UnPause(Killing Unit)
            Move (Killing Unit) to (OUTOFYOURJAIL)

Put Killing Unit into a unit variable.

There isn't much to it actually.
This is, however, not a MUI Version.
You'd have to index your Units.
However, this can be made very easily in JASS/vJASS. I suggest you go learn it =P

He wants a first time warning and sending to jail is only for the second time.

I believe using a boolean is more practical for this..
 

Arbink

New Member
Reaction score
0
im having problems with it (i am testing it on computer players if that matters) it only works on my units and doesent send me to jail but the warning comes up i used a real variable with an arry of 1 and initial value of 0 (i dont know about variables) heres the trigger in case i made mistakes

Code:
Jail
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) belongs to an ally of (Owner of (Killing unit))) Equal to True
    Actions
        Set Jail[(Player number of (Owner of (Killing unit)))] = Jail[((Player number of (Owner of (Killing unit))) + 1)]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Jail[(Player number of (Owner of (Killing unit)))] Less than or equal to 1.00
            Then - Actions
                Game - Display to (All players matching ((Matching player) Equal to (Triggering player))) the text: NO BETRAYING, DO IT...
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Jail[(Player number of (Owner of (Killing unit)))] Greater than or equal to 2.00
                    Then - Actions
                        Unit - Move (Killing unit) instantly to (Center of Jail Region <gen>)
                    Else - Actions
i want to make a command code to bring up a box with "set free" "keep jailed" options to open the jail for 30 secs
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
The array of the variable and the value of the variable is NOT the same.

You should do
If Jail[Player number of owner of killing unit] = 0,
Then set Jail[player number of owner of killing unit = 1
Display warning

If Jail[Player number of owner of killing unit] = 1,
Send to jail
 

sentrywiz

New Member
Reaction score
25
The array of the variable and the value of the variable is NOT the same.

You should do
If Jail[Player number of owner of killing unit] = 0,
Then set Jail[player number of owner of killing unit = 1
Display warning

If Jail[Player number of owner of killing unit] = 1,
Send to jail

You mean, if:


If Jail[Player number of owner of killing unit] = 2 or more,
Send to jail

What logic in display "WARNING. Next player kill will send you to jail..." and BAM your in jail.
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Nope... no error. The original value should be 0, at least in my example stated. So if it's 0, set it to 1 and display warning. However if it's 1, send the player to jail.
 

Arbink

New Member
Reaction score
0
This triggers still not working:banghead: did i put the numbers in the right place
Code:
Jail
    Events
        Unit - A unit Dies
    Conditions
        ((Dying unit) belongs to an ally of (Owner of (Killing unit))) Equal to True
    Actions
        Set Jail[(Player number of (Owner of (Killing unit)))] = Jail[((Player number of (Owner of (Killing unit))) + 0)]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                Jail[((Player number of (Owner of (Killing unit))) + 1)] Less than or equal to 1.00
            Then - Actions
                Game - Display to (All players matching ((Matching player) Equal to (Triggering player))) the text: NO BETRAYING, DO IT...
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Jail[((Player number of (Owner of (Killing unit))) + 1)] Greater than or equal to 2.00
                    Then - Actions
                        Unit - Move (Killing unit) instantly to (Center of Jail Region <gen>)
                    Else - Actions
do i have to change my variable
 

Ayanami

칼리
Reaction score
288
The trigger is quite complicated for a simple trigger o.o

Try it this way:

Trigger:
  • Jail
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) belongs to an ally of (Owner of (Killing unit))) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Jail[(Player number of (Owner of (Killing unit)))] Less than 1
        • Then - Actions
          • Set Jail[(Player number of (Owner of (Killing unit)))] = (Jail[(Player number of (Owner of (Killing unit)))] + 1)
          • Game - Display to (All players matching ((Matching player) Equal to (Triggering player))) the text: NO BETRAYING, DO IT...
        • Else - Actions
          • Set TempPoint = (Center of Jail Region &lt;gen&gt;)
          • Unit - Move (Killing unit) instantly to TempPoint
          • Custom script: call RemoveLocation(udg_TempPoint)


Note that the variable Jail is an integer and that its initial value should be 0. This will warn the killer if it's the first time. If it's the second time, he will go to jail.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top