Left 4 Dead 2

Left 4 Dead 2

Trash-talking AI Specials V2
(subjectively) improved "wasted medkit line" code
feel free to use. i haven't tested it out yet, so chances are there will be a bug that makes the entire script unable to work

thanks, and have :gaben:
function OnGameEvent_heal_success( params ) { if("userid" in params && RandomInt(1,Chances.On_Survivor_Heal) == 1) { if(params.userid) { // get the player who was doing the healing local guy = GetPlayerFromUserID(params.userid) // get the player who was being healed local receivingend = GetPlayerFromUserID(params.subject) // are they on black&white? local goingtodie = receivingend.IsOnThirdStrike() // how much health did they gain? local hpgain = params.health_restored // get the current difficulty, and do some calculations ig. local getdiff = GetDifficulty() local idunno = getdiff - 1 local diffsep = 10 * idunno local fullhp = 50 - diffsep // 60 for easy, 50 for normal, 40 for advanced/hard, 30 for expert/impossible // if they gained more than the difficulties hp value, dont call them out if(hpgain >= fullhp) { return } // if they are on black&white, dont call them out. only here for compatibility for other mods like that one hp regen script on the workshop which may regen permament hp if(goingtodie == true) { return } // if all checks pass, make the special trash talk the healer MakeRandomSpecialSay(SubstituteForPlayerNameInString(GetRandomFromArray(Lines.MedkitLines),guy.GetPlayerName()), null) } } }
< >
Showing 1-5 of 5 comments
ChimiChamo  [developer] Aug 31, 2024 @ 9:22am 
the specials calling out the medkit use happening regardless of how much health was gained was partly intentional, so players might second guess their use, but this is also good. ive modified it a bit but itll get included
grungle bungle Aug 31, 2024 @ 10:32am 
epic
grungle bungle Aug 31, 2024 @ 2:28pm 
also plz credit me... i may or may not have spent 36 minutes on this single piece of code
ChimiChamo  [developer] Aug 31, 2024 @ 2:30pm 
you were in the change note and in the code itself but sure ill add it to the description too
grungle bungle Aug 31, 2024 @ 4:04pm 
epic #2
< >
Showing 1-5 of 5 comments
Per page: 1530 50