Illumbris Posted March 16, 2018 Share Posted March 16, 2018 This script is placed on a actor scripts. Scriptname IllumbrisDeathAddGlobal extends Actor GlobalVariable Property IllumbrisGlobalStoryKilles Auto auto STATE waiting EVENT onDeath(actor killer) IllumbrisGlobalStoryKilles.Mod(1) endif endEVENT endSTATE I want to make it so on enemy death it will adds 1 point to the global variable This script will be added on a actor kind of like the on death set stage script but I want on death add +1 on 'IllumbrisGlobalStoryKilles' global variable oh and this script does not work? So what iv done on the quest stages I have this script Int IllumbrisFarmerHelpStage1GV = 4 and once the enemy's die 4 times it will go past this and do the next script which is setstage 10 on Quest stages. and i'm not sure if IllumbrisFarmerHelpStage1GV = 4 will work in till I can get the actor script to work. Please help! Link to comment Share on other sites More sharing options...
FrankFamily Posted March 16, 2018 Share Posted March 16, 2018 (edited) I'm not sure why you seem to expect (or maybe I've misunderstood you) "Int IlumbrisFarmerHelpStage1GV = 4" to do "Wait until this global has a value of four, when it has continue running". What that code does is define a new variable of type integer called IlumbrisFarmerHelpStage1GV and give it a value of 4, then this variable is never used, it is not cheching the global variable at all, you'd need a property to the global for that. The actual code that would do what you want would be: * Go to scripts and add a property to the fragment script of type GlobalVariable and pointing to IlumbrisFarmerHelpStage1GV, for simplicity call it IlumbrisFarmerHelpStage1GV and autofill it. Then the he fragment would be: While IlumbrisFarmerHelpStage1GV.GetValue() < 4 ;self explanatory, while that condition checks run the code inside over and over. Wait (1.0) ; wait some amount, once waited it checks the condition again, if still true, repeats. EndWhile Setstage (20) But this would be a horrible way to handle this, do not do this, just wanted to point out what would do what you said. Something like this would be better: Scriptname IllumbrisDeathAddGlobal extends Actor GlobalVariable Property MyGlobal Auto ;point to the global Quest Property MyQuest Auto ; point to the quest in question EVENT onDeath(actor killer) MyGlobal Mod(1) If MyGlobal.GetValue() > 4 MyQuest.SetStage(20) Endif endEVENT If there is the possibility of multiple of these dying at roughly the same time you might want to do some more complicated like what is explained here: https://www.creationkit.com/index.php?title=Safely_increment_variable_from_multiple_scripts Edited March 16, 2018 by FrankFamily Link to comment Share on other sites More sharing options...
Illumbris Posted March 16, 2018 Author Share Posted March 16, 2018 (edited) Ill try this but what i was saying is like the points will increase on the same IlumbrisFarmerHelpStage1GV and when it gets to 4 deaths next stage 10, then when it gets to 8 deaths next stage 20. sorry if it seems like i don't know what i'm talking about with global as I don't know much about it. ama give this script a go. Edit- I was also hoping this to work with multiple quest if possible? Edited March 16, 2018 by Illumbris Link to comment Share on other sites More sharing options...
Recommended Posts