godssin Posted August 3, 2014 Share Posted August 3, 2014 I am making a mod that requires each kill I make to change a global variable, does anyone know how a script to change variables on kill? I have looked and cant find a command for this anywhere. Link to comment Share on other sites More sharing options...
kastano Posted August 4, 2014 Share Posted August 4, 2014 There must be another way than this but anywaymake a quest and atouch this script scn AAAMySetEventHandlerKillQuestScriptshort Myquestkillcountref attackerref targetbegin gamemodeif getgameloadedseteventhandler "OnDeath", MyKillCountFunction , "ref"::target, "object"::attackerendifmessage "Count-%0.f", Myquestkillcount;end this is an event handler on death - i think it monitors all deaths in game from what i see in the consolethis is the functionscript scn MyKillCountFunctionref attackerref targetbegin Function { target , attacker };do stuffprint $target + " was killed by " + $attackerif attacker == player && target.iscreature == 0set AAAKillCounterFQuest.Myquestkillcount to AAAKillCounterFQuest.Myquestkillcount + 1endifend it sures conflict with unnessesery violence critical hits (in my game)-doesnt count a critical hit death i think because the kill is not comitted by the playermaybe some other modssometimes it doesnt counttest it perhaps it suits youpress ~ to open the console to see the messages Link to comment Share on other sites More sharing options...
godssin Posted August 5, 2014 Author Share Posted August 5, 2014 Thank you Link to comment Share on other sites More sharing options...
Recommended Posts