Created
December 13, 2022 00:21
-
-
Save NanoAi/58a5bf47eb9c978bafbf6efff119e9c2 to your computer and use it in GitHub Desktop.
Put it in `tf/scripts/vscripts/force_mvm_ups.nut` and run it with `script_execute force_mvm_ups.nut`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ent = null; | |
local cashGain = 50; | |
local cashLose = 25; | |
local cashScaler = 0.10 | |
ShowMessage("Loading ForceEnableUpgrades VScript..."); | |
ForceEnableUpgrades(2); | |
while( ent = Entities.FindByClassname(ent, "func_upgradestation") ) | |
{ | |
ent.Destroy(); | |
} | |
while( ent = Entities.FindByClassname(ent, "func_regenerate") ) | |
{ | |
printl("Located: " + ent + " @ " + ent.GetCenter()); | |
local upgradeStation = SpawnEntityFromTable("func_upgradestation", { | |
origin = ent.GetCenter(), | |
angles = ent.GetAbsAngles(), | |
model = "*21" | |
}) | |
printl("Created: " + upgradeStation + " @ " + upgradeStation.GetCenter()); | |
} | |
function OnGameEvent_player_death(params) | |
{ | |
local assister = null | |
local cashAfterLoss = 0 | |
local assistedKill = false | |
local cashOnKill = 0 | |
local cashOnDeath = 0 | |
local player = GetPlayerFromUserID(params.attacker) | |
local victim = GetPlayerFromUserID(params.userid) | |
if ( player != victim && victim ) { | |
if ( params.assister >= 0 ) { | |
assister = GetPlayerFromUserID(params.assister) | |
if ( assister ) { | |
assistedKill = true | |
} | |
} | |
cashOnKill = cashGain + ( victim.GetCurrency() * cashScaler ) | |
if ( assistedKill ) { | |
player.AddCurrency( floor(cashOnKill * 0.80) ) | |
assister.AddCurrency( floor(cashOnKill * 0.20) ) | |
} else { | |
player.AddCurrency(cashOnKill) | |
} | |
cashOnDeath = cashLose + ( victim.GetCurrency() * cashScaler ) | |
cashAfterLoss = ( victim.GetCurrency() - cashOnDeath ) | |
if ( cashAfterLoss > 0 ) { | |
victim.RemoveCurrency( cashOnDeath ) | |
} else { | |
victim.SetCurrency( 0 ) | |
} | |
} | |
} | |
__CollectGameEventCallbacks(this) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment