I'm making an RPG where kills get you exp. It seemed to work when I played it alone, but when I did it with a friend, a weird glitch occured. It seemed he got exp for killing units until I killed one of those units. Then every unit of that kind that he killed would give ME exp instead of giving him exp. However, he'd still get exp for unit types I hadn't killed yet.
None.
An artist's depiction of an Extended Unit Death
I'm assuming it's a shared property (like switches or something similar) that in your "kills to xp" trigger for player 2 are activated for player 1 when player 1 kills something.
I'd suggest looking over your triggers and seeing if you made any mistakes with switches, death counters, kill scores, etc.
If you want further help, however, you'll need to post the triggers so we can actually see what the problem is.
I seperated the triggers for each player because checking them together caused a different glitch. Anyway, this is the trigger:
Players:
P(#)
Conditions:
Current player kills at least 1 (unit)
P8 has suffered at least 1 death of (unit)
Actions:
Modify score for current player, add (#) custom
Set deaths for P8 for (unit) to 0
Preserve Trigger
None.
Take note: when the death for p8 is subtracted, p1 still has 1 kill of unit. So, if p2 kills a unit, both conditions for the p1 experience are fulfilled.
None.
We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
Take note: when the death for p8 is subtracted, p1 still has 1 kill of unit. So, if p2 kills a unit, both conditions for the p1 experience are fulfilled.
Correct. To make it worse: You can't subtract a kill. You can only subtract kills score.
But every kill of a different type of unit has a different kills score. You can make a simple system checking for the exact kills score for every type of unit you can kill. Like this:
Current Player has exactly 350 kills score (=hydra)
-> Set Kills score to 0 for Current Player
-> Add 2 to Custom Score for Current Player
Current Player has exactly 50 kills score (=ling)
-> Set Kills score to 0 for Current Player
-> Add 1 to Custom Score for Current Player
As you can see you won't need the death condition of P8 but need a lot of triggers.
Problems arise, when you kill more than 1 unit per trigger loop (Hypers will help a lot!) or if you kill 2 units the same time by splash or multiple units.
In this case you would have to use a less accurate (but very easy) kills score method (e.g. player has at least 300 kills score -> subtract 300 kills score, add 1 to custom score) or use the 'perfect kills to cash' method which is quite complicated to set up and forces you to have spare comp player which doesn't kill units.
Which one will it be?
Is there a way to do this without using kill scores?
None.
You could take a leaf out of... someone else's book (I forget who) and have an arena for battles. You run up to an enemy and get teleported to a closed area, that way you can easily detect what you're fighting against. If you're going for the real-time feel, it's hard to get any more accurate. Otherwise kill score is best, or the perfect kills-to-cash, but... that's about it. Or you could devise your own method somehow and show us all up here at SEN, I'd like that.
None.
Hm... what about a (complex to the extreme) set of trigs that first calculated how many of each unit the enemy lost in one cycle, then, going with most expensive units first, found out which player killed the unit and how to give them xp. For example, player 1 kills 2 hydralisks and one zergling with a major splash attack, player two happens to kill one hydra at the same time. The system knows player 8 lost 3 hydras and one zergling, the system also knows that player one has 750 killscore and player 2 has 350 killscore. The three hydras are subtracted from player 1, player1, player two, then the remaining zergling is subtracted from player one. Result: 2Hydra1Ling for player one and 1Hydra for player 2. This is just a theory, don't try it unless you seriously know what you're doing, due to the fact that it has to be streamlined to run in a single trigger cycle.
None.
I seperated the triggers for each player because checking them together caused a different glitch.
It shouldn't. Three triggers owned by P1, P2, and P3 will function identically to one trigger owned by all three of the players.
Conditions:
Current player kills at least 1 (unit) <-- Hi, I am a condition that is always going to be met after the player kills one of the unit.
P8 has suffered at least 1 death of (unit) <-- Therefore, whenever P8 has a death, the first player to run the trigger will have this condition met.
Actions:
Modify score for current player, add (#) custom
Set deaths for P8 for (unit) to 0 <-- Hi, after the first player runs the trigger, I ensure that none of the other players will run it.
We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
Hm... what about a (complex to the extreme) set of trigs that first calculated how many of each unit the enemy lost in one cycle, then, going with most expensive units first, found out which player killed the unit and how to give them xp. For example, player 1 kills 2 hydralisks and one zergling with a major splash attack, player two happens to kill one hydra at the same time. The system knows player 8 lost 3 hydras and one zergling, the system also knows that player one has 750 killscore and player 2 has 350 killscore. The three hydras are subtracted from player 1, player1, player two, then the remaining zergling is subtracted from player one. Result: 2Hydra1Ling for player one and 1Hydra for player 2. This is just a theory, don't try it unless you seriously know what you're doing, due to the fact that it has to be streamlined to run in a single trigger cycle.
Well and what if Player 1 kills 7 lings (350 score) and 1 hydra (350 score) dies by Player 2? The system wouldn't know which player should get 7 custom score and which only 1.
No seriously you got 2 options:
- The simple score subtract (like every 400 score = 1 xp)
- The complex
kills to cash perfect
How is player one gonna kill seven lings in one trigger cycle? Not gonna happen.
None.
We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
How is player one gonna kill seven lings in one trigger cycle? Not gonna happen.
I knew someone would ask this.
so now what about 2 lings and 1 marine (both 100 kills score) still impossible?
I just showed you that your system has its problems, but I didn't want to post EVERY SINGLE INSTANCE where it fails.
Btw. how would you subtract everything in 1 cycle?
Well, you can just give them a certain amount for every amount of points
None.
How is player one gonna kill seven lings in one trigger cycle? Not gonna happen.
I knew someone would ask this.
so now what about 2 lings and 1 marine (both 100 kills score) still impossible?
I just showed you that your system has its problems, but I didn't want to post EVERY SINGLE INSTANCE where it fails.
Btw. how would you subtract everything in 1 cycle?
In the case of the game you'd have to design it so that either occurences like this didnt happen, the xp for marines and 2 lings is close, and honestly the chances of player 1 splashing, killing 2 lings in the exact same 12th of a second that player 2 kills a marine is pretty slim.
To subtract everything in one cycle, first, in player one, you check the total killscore for player one compared to the deaths of player eight. IE:
P8 has one death of hydra, p1 has 350 killscore, subtract death and killscore, then add XP (Copy this a few times, maybe even do a binary copy) then do that for every unit. If the units with the highest killscore are on the top of the list, then it'll do it in one cycle. This should suffice as long as your RPG doesnt have mass slaughterings of cheap enemies while you fight a boss at the same time.
None.