Jump to content

Placing Explosions with a timer


twofive

Recommended Posts

Hello!

 

I am making a mod with a script that requires you at a specific stage to quickly evacuate a room.

To make sure the player actually leaves the room, I want to place multiple explosions on the floor which hurt the player requiring him to get the hell outta there :biggrin:

 

But if I just use PlaceAtMe without any timer it works, but it places a few hundred explosions which causes the game to lag and soon crash, not mentioning the player getting killed after a few milliseconds. So there must be something wrong with my timer.

 

I tried it using the following script I threw together using a grenade script:

 

scn 00Vault101UndergroundExplosionScript

float ExplosionTimer

begin OnTrigger Player
Set ExplosionTimer to 2.5

; count down timer
if ExplosionTimer > 0
	 set ExplosionTimer to ExplosionTimer - getSecondsPassed
else
	Player.PlaceAtMe GrenadePulseExplosion 1
	Set ExplosionTimer to 2.5
endif
end

 

Then I made an primitive activator, placed it around the room and hoped it works, but it won't.

 

Any tips? :biggrin:

 

-- twofive

Link to comment
Share on other sites

Hello!

 

I am making a mod with a script that requires you at a specific stage to quickly evacuate a room.

To make sure the player actually leaves the room, I want to place multiple explosions on the floor which hurt the player requiring him to get the hell outta there :biggrin:

 

But if I just use PlaceAtMe without any timer it works, but it places a few hundred explosions which causes the game to lag and soon crash, not mentioning the player getting killed after a few milliseconds. So there must be something wrong with my timer.

 

I tried it using the following script I threw together using a grenade script:

 

scn 00Vault101UndergroundExplosionScript

float ExplosionTimer

begin OnTrigger Player
Set ExplosionTimer to 2.5

; count down timer
if ExplosionTimer > 0
	 set ExplosionTimer to ExplosionTimer - getSecondsPassed
else
	Player.PlaceAtMe GrenadePulseExplosion 1
	Set ExplosionTimer to 2.5
endif
end

 

Then I made an primitive activator, placed it around the room and hoped it works, but it won't.

 

Any tips? :biggrin:

 

-- twofive

 

scn 00Vault101UndergroundExplosionScript

float ExplosionTimer
short Next


Begin OnTrigger Player
if ( Next == 0 )
	set Next to 1
endif
End

Begin GameMode
if ( Next == 1 )
	set Next to -1
	set ExplosionTimer to ExplosionTimer + GetSecondsPassed
; count down timer

		if ( ExplosionTimer >= 5 )
			Player.PlaceAtMe GrenadePulseExplosion 1
			Set ExplosionTimer to 0
		endif

endif
End

 

Stop making new threads for every scripting problem you need. Keep them in one place.

Link to comment
Share on other sites

Stop making new threads for every scripting problem you need. Keep them in one place.

 

 

Okay, sorry, won't happen again! :smile:

 

Unfortunately your code doesn't work either :mellow:

I got the same problem as mentioned before: It just doesn't spawn any explosions.

 

Here is how I set the activator:

 

http://www.abload.de/img/activatorfe4d.pnghttp://www.abload.de/img/activator2bhet.png

Link to comment
Share on other sites

I doubt you can spawn the player inside the box and still trigger it, so if you are coming through that door, don't expect to trigger it.

 

Your primitives don't need to be that big, but not too thin. Just enough that there is no way to go around them.

 

Also, being in a different cell from the activator won't stop the script from placing an explosion at the player.

 

Time to troubleshoot.

 

scn 00Vault101UndergroundExplosionScript

float ExplosionTimer
short Next


Begin OnTrigger Player
if ( Next == 0 )
	set Next to 1
endif
End

Begin GameMode
if ( Next == 1 )
	PlaySound "OBJBuzzerBell"
	set Next to -1
	set ExplosionTimer to ExplosionTimer + GetSecondsPassed
; count down timer

	if ( ExplosionTimer >= 5 )
		PlaySound "OBJIntercomHail"
		Player.PlaceAtMe "GrenadePulseExplosion" 1
		Set ExplosionTimer to 0
	endif

endif
End

 

When you trigger the box, you should hear a buzzer. Five seconds later you should hear a beep. This way we can determine what isn't working.

Link to comment
Share on other sites

When you trigger the box, you should hear a buzzer. Five seconds later you should hear a beep. This way we can determine what isn't working.

 

When entering the cell, I hear the buzzer once, but no beep.

I also tried a smaller activator (see here), but the behaviour doesn't change.

 

I think spawning and triggering works, I have a small trigger at the door which completes a quest stage when entering the cave :happy:

Link to comment
Share on other sites

Try that.

 

scn 00Vault101UndergroundExplosionScript

float ExplosionTimer
short Next


Begin OnTrigger Player
if ( Next == 0 )
	set Next to 1
endif
End

Begin GameMode
if ( Next == 1 )
	PlaySound "OBJBuzzerBell"
	set ExplosionTimer to ExplosionTimer + GetSecondsPassed
; count down timer

	if ( ExplosionTimer >= 5 )
		PlaySound "OBJIntercomHail"
		Player.PlaceAtMe "GrenadePulseExplosion" 1
		Set ExplosionTimer to 0
		set Next to -1
	endif

endif
End

Link to comment
Share on other sites

Try that.

 

Ok, little success:

The buzzer runs very often, then the explosion is placed and then a short BEEP runs, but all only once.. I'd like this to happen repeatedly :biggrin:

 

Thanks for your help!

 

//EDIT:

 

 

I took a look at the code and now it runs flawlessly.

 

 

 

scn 00Vault101UndergroundExplosionScript

float ExplosionTimer
short Next


Begin OnTrigger Player
if ( Next == 0 )
	set Next to 1
endif
End

Begin GameMode
if ( Next == 1 )
	if getStage A00VAU == 50
;PlaySound "OBJBuzzerBell"
	set ExplosionTimer to ExplosionTimer + GetSecondsPassed
; count down timer

	if ( ExplosionTimer >= 2 )
	;PlaySound "OBJIntercomHail"
		Player.PlaceAtMe "GrenadePulseExplosion" 1
		Set ExplosionTimer to 0
		set Next to 0
	endif
endif
endif
End

 

Thank you very much for your great help! :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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