How To Create A Kill Streak System
Posted: Wed May 10, 2017 1:20 pm
so because i've been working on a gamemode base on EA's battlefront I needed to create a new kill streak system where if the player scores a certain amount of kills (3) the players trait levels up. What I want to know is if there is an easier way to go about it... It would seem the default reward system is hardcoded so I feel like LUA will be involved in faking a new system but is there an easier way to write this?
what I have so far works but it is long (walker assault gamemode is already 3500 lines of code due to starcards/powerups/gamemode/traits so im trying to shorten it in anyway I can)
so far I have this as working code:
first I created a set of variables to hold the number of the players kills (each variable was made individually to store each players kill count, a single number would globally raise the kill count and I wanted it individually) so for team 1s players I made the following:
next I made 2 functions with a series of if statements to get the correct kill count from the correct variable however since an upvalue of if statements can only have a maximum of 32 variables I broke it into 2 functions with a set of 20 linked variables each.
next I created a function to set the players kill count and assign it to the units variable again having to break that into two functions to accomidate the size of the teams.
finally I used the OnCharacterDeath() function to change the variables and add the streak number and if the players kill count raises above 3 it changes the train (in this case player unit 0 = rebel survivalist so we want to add a faster health regen, ignore the show message thats for my personal debugging).
it is fully functional and I mean it works just fine but If there is a way to shorten it all it would make things... well... a lot less of a scrolling adventure.
what I have so far works but it is long (walker assault gamemode is already 3500 lines of code due to starcards/powerups/gamemode/traits so im trying to shorten it in anyway I can)
so far I have this as working code:
first I created a set of variables to hold the number of the players kills (each variable was made individually to store each players kill count, a single number would globally raise the kill count and I wanted it individually) so for team 1s players I made the following:
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler:
Hidden/Spoiler: