• Hey! Register here to create your account, engage with the community, and talk about what is new!

%default variable affecting everyone.

BouncyBonBon

New member
Joined
Sep 26, 2022
Messages
11
Reaction score
0
I'm working on a game that has a killstreak system in it, I have it so on playerRespawn event, setVar '%default killstreak' to '0' but this affects all players but I only want it to affect the player who died, please help!
 

Swirrl

New member
Joined
Jun 23, 2021
Messages
8
Reaction score
5
The playerRespawn code block checks for is any player respawns, but I don't think it ever checks who respawns, and that's what is messing it up.
You can try using the PlayerKillPlayer event instead and see if that works.
 

BouncyBonBon

New member
Joined
Sep 26, 2022
Messages
11
Reaction score
0
I tried that, but because using the damage code block doesn't tie it to whoever activated the code sequence it classifies it as universal damage (like fall dmg)
The playerRespawn code block checks for is any player respawns, but I don't think it ever checks who respawns, and that's what is messing it up.
You can try using the PlayerKillPlayer event instead and see if that works.
 

JustSticky

Well-known member
Overlord
Joined
Mar 4, 2021
Messages
77
Reaction score
43
Try using "%victim killstreak", as the player in the PlayerKillPlayer event is the victim.
 

JustSticky

Well-known member
Overlord
Joined
Mar 4, 2021
Messages
77
Reaction score
43
Yes, using %victim and %killer does work. Try this:
Code:
Player Kill Player:
    Set Variable (%victim killstreak = 0)
    Set Variable (%killer killstreak += 1)
This will reset the victim's killstreak and increase the killer's.
 

BouncyBonBon

New member
Joined
Sep 26, 2022
Messages
11
Reaction score
0
I can't use playerKillPlayer anyway, because using the damage code block doesn't know who activated the codeline, I have it so 'on projectileDmgPlayer ifPlayer{ standingOn coarse dirt } Else {playerEvent damagePlayer 2}'. So the snowball actually doesn't do any damage, the code does. So in this case there is no 'victim' only a 'shooter'. I can store the shooter using a variable for messages, but I can't store the victim with a variable to affect another variable. (if that made any sense)
 
Last edited:
Top Bottom