Jump to content

How do you script an explosion?


joshua121

Recommended Posts

This topic has been solved.

 

 

 

 

 

I'm pouring through the GECK trying to find something similar with no luck. The wiki has no info about the PlayExposion function, and I'm a little stuck.

 

What I want to do is collapse an entrance to block it off. But I can't figure out how to just play an explosion.

 

Here is the script so far....

 

 

scn JL121DSBHSewerEntranceDoor01Script

 

float timer

Short ButtonVar

Short AwaitingInput

short timed

short done

short Counting

 

Begin OnActivate

 

ShowMessage JL121DSBHSewerEntranceDoor01Message

set awaitingInput to 1

 

End

 

 

begin gamemode

 

if awaitingInput == 1

set buttonVar to getbuttonpressed

 

if buttonVar > -1

set awaitingInput to 0

 

if buttonVar == 0

set counting to 1

set timer to timer + getsecondspassed

showmessage JL121DSBHSewerDoorBlastRadiusMessage

JL121DSBHAbandonedTunnelsExplosivesRef.enable

 

elseif buttonVar == 1

; do nothing

 

if Counting == 1 && ( Timer < 0 )

set timer to timer + getsecondspassed

 

 

if ( timer > 1 ) && timed == 0

showmessage JL121DSBHSewerDoorBlastRadiusMessage

set timed to 1

set timer to - 1

 

if ( timer > 3 ) && timed == 1

;PLAY EXPLOSION HERE

set timed to 2

 

 

 

endif

endif

endif

endif

endif

endif

endif

end

Edited by joshua121
Link to comment
Share on other sites

Use PlaceAtMe, and place the explosion you want at the activator, or a marker. http://geck.bethsoft.com/index.php/PlaceAtMe

 

Thanks Ricerhk, I really appreciate the quick reply.

 

 

I had just figured it out by looking the bhdisk stuff in the geck.

 

Just in case anyone else has problems with this.

 

I accomplished a tunnel collapse where the player can set a timed bomb to do this.

 

I used two scripts on two items. And a few other items to make this work.

 

First there is an activator, in my case I used a door. It has this script on it.

 

scn SewerEntranceDoor01Script

Short ButtonVar
Short AwaitingInput

Begin OnActivate

ShowMessage SewerEntranceDoor01Message
set awaitingInput to 1
End

begin gamemode
     
	if awaitingInput == 1
	set buttonVar to getbuttonpressed

if buttonVar > -1
		set awaitingInput to 0

		if buttonVar == 0
              	             ExplosivesRef.enable
                            showmessage BlastRadiusMessage
		

		elseif buttonVar == 1
			; do nothing


	endif
	endif
	endif
        endif
end

 

This script shows a message when the player tries to use the door, the message is basically "this is the door you should blow up".

The message has two button options.

The first option is 0, which is "blow up the door", and it will call the "If ButtonVar == 0" stuff. The other button option is "Do Nothing" and it will do nothing.

 

When ButtonVar == 0 it enables the explosives ref, and shows us a message that we should get the hell away from the bomb, because we only have 10 seconds.

 

The enabling of the explosives ref, is what triggers our next script, which is placed inside a trigger box, that covers the area the player is standing in.

 

It has this script

 


SCN AbandonedTunnelsExplosivesRefScript

float timer
float timer2

short timed
short doonce

begin ontrigger

if doonce == 0
set timer to 0
set timer2 to 0
set doonce to 1

endif
end


Begin Gamemode 

if AbandonedTunnelsExplosivesRef.getdisabled == 0
set timer to timer + getsecondspassed

if ( timer > 10 )
AbandonedTunnelsExplosivesRef.PlaceAtMe BMDishExplosion ; this is the explosion I was looking for
AbandonedTunnelsRubbleRef.enable ; This enables the Rubble that was set to initially disabled
set timer2 to timer2 + getsecondspassed

if ( timer2 > 2 )
AbandonedTunnelsExplosivesRef.disable ; this ends the explosion by disabling the reference it was placed at .
set timer to -1
set timer2 to -1
set QuestVariables.DoorsBlocked to 1 ; this advances a quest variable

endif
endif
endif

end

 

 

 

 

I hope someone finds this helpful, and thanks again Ricerhk

 

Joshua121

Edited by joshua121
Link to comment
Share on other sites

  • Recently Browsing   0 members

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