UglyDucklingStudios Posted January 20, 2013 Share Posted January 20, 2013 I'm having trouble with a script that is attached to a brahmin and has it blow up after 6 seconds of it dying. Here is the code I have: scn 00BrahminKamikazieExplosionBegin OnDeath short DoOncefloat timer if DoOnce == 0 playSound 00BrahminKamikazieTickerSound set DoOnce to 1endif if timer < 6 set timer to timer + GetSecondsPassedelse PlaceAtMe BusLargeExplosion 1 PlaceAtMe CigaretteCarton 4endifend It plays the sound but it doesn't blow up. If you know the problem please tell me. Link to comment Share on other sites More sharing options...
Xaranth Posted January 20, 2013 Share Posted January 20, 2013 (edited) General modding tip: Get in the habit of not using numerals to begin your EditorIDs. Numerals can confuse the script compiler; it tends to think they are FormIDs instead. Now. OnDeath scripts execute only once, that is when the actor to which they are attached to dies. In this case, you need it to run for six seconds, so you need to attach the timer to the gameMode block. Actually, you could drop the whole thing into a gameMode block using a control condition of GetDead. Edit: Also, your readers' lives will be easier if you learn to use code tags and/or the insert code snippet button, the one which looks like a LeftAngleBrace/RightAngleBrace ( <> ) Edited January 20, 2013 by Xaranth Link to comment Share on other sites More sharing options...
UglyDucklingStudios Posted January 20, 2013 Author Share Posted January 20, 2013 Well I can't use a gameMode block because I will be needing to use this script on multiple brahmin. Unless there is an easy way to do this. Link to comment Share on other sites More sharing options...
Xaranth Posted January 20, 2013 Share Posted January 20, 2013 (edited) Do you mean you want to turn, say, random brahmin throughout the game into Kamikaze Brahmin, or? I don't quite understand the problem. Just change it to something like this: scn BrahminBoom float fTicker short sStage begin gameMode if (getDead) if (sStage == 0) playSound 00BrahminKamikazieTickerSound set sStage to 1 elseIf (sStage == 1) if (fTicker <= 6) set fTicker to (fTicker + getSecondsPassed) else set sStage to 2 PlaceAtMe CigaretteCarton 4 PlaceAtMe BusLargeExplosion 1 endIf endIf endIf end Since those are all local vars, they won't interfere with each other, no matter how many brahmin are wandering about firing it. Edited January 20, 2013 by Xaranth Link to comment Share on other sites More sharing options...
UglyDucklingStudios Posted January 20, 2013 Author Share Posted January 20, 2013 Well I was wanting specific brahmins (Brahmin Kamikazes) to only do this. Link to comment Share on other sites More sharing options...
Xaranth Posted January 20, 2013 Share Posted January 20, 2013 SAs long as you're not replacing the script on the base brahmin, it'll only work on the ones you attach it to. Link to comment Share on other sites More sharing options...
UglyDucklingStudios Posted January 20, 2013 Author Share Posted January 20, 2013 Yup just check to see if that was the case and it works. Thanks for the help with this! Link to comment Share on other sites More sharing options...
UglyDucklingStudios Posted January 20, 2013 Author Share Posted January 20, 2013 Yup just check to see if that was the case and it works. Thanks for the help with this! Link to comment Share on other sites More sharing options...
luthienanarion Posted January 20, 2013 Share Posted January 20, 2013 PlaceAtMe CigaretteCarton 4 PlaceAtMe BusLargeExplosion 1 I don't know why, but I laughed hard at this. Link to comment Share on other sites More sharing options...
Recommended Posts