Jump to content

Continuous Damage


Andyno

Recommended Posts

I'm trying to achieve something like this...

scn SteelMillHotSteelScript

begin onTriggerEnter player
player.DamageActorValue Health 20
ApplyImageSpaceModifier TrapToiletShockISFX
player.Say Hit
end 

... but with one difference - I need to damage the player every second, and blocktype OnTriggerEnter can't do that...

Thanks for any advices...

 

Link to comment
Share on other sites

Well, you could have it add some kind of poison like damage health effect, or have the ontrigger block set a declared variable (short triggered, for example) to 1, then have an if statement check for it and apply the damage in a game mode block. Unfortunately, I'm not sure if it will run it every second, and I'm pretty sure it'll only run if the trigger that the script is on is loaded. You may need to separate the declared variable and game mode block into a quest script so it'll run wherever. As a bonus, this method will also let you adjust the frequency that the script processes by adjusting the script processing delay on the quest that the quest script is attached to. Edited by uhmattbravo
Link to comment
Share on other sites

That's not surprising. OnTrigger runs every frame, just like a GameMode block.

 

You need to check how much time has passed between each iteration using GetSecondsPassed.

scn SteelMillHotSteelScript
float fTimer

begin onTrigger player
	if (fTimer > 0)
		set fTimer to fTimer - GetSecondsPassed
	else
		set fTimer to 1
		player.DamageActorValue Health 20
		ApplyImageSpaceModifier TrapToiletShockISFX
		player.Say Hit
	endif
end
Link to comment
Share on other sites

uhmattbravo:

Thanks, but I'm very overwhelmed by your words - I'm a script noob. :confused:

 

Ladez:

I changed OnTriggerEnter for OnTrigger, but it doesn't work - it killed me instantly.

 

That's because it took 20hp away every frame the script ran. Which is as many times a second that your frame rate is.

So you could attempt to take a decimal point HP away per frame ... or put a timer in the script to tell it how long to wait for each 20hp loss.

 

Add edit : Thanks for the ninja Ladez ... plus you explained it better ;)

Edited by Mktavish
Link to comment
Share on other sites

  • Recently Browsing   0 members

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