Jump to content

Having trouble making a brahmin blow up after 6 seconds of death


UglyDucklingStudios

Recommended Posts

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 00BrahminKamikazieExplosion

Begin OnDeath

 

short DoOnce

float timer

 

if DoOnce == 0

playSound 00BrahminKamikazieTickerSound

set DoOnce to 1

endif

 

if timer < 6

set timer to timer + GetSecondsPassed

else

PlaceAtMe BusLargeExplosion 1

PlaceAtMe CigaretteCarton 4

endif

end

 

 

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

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 by Xaranth
Link to comment
Share on other sites

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 by Xaranth
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...