Andyno Posted February 19, 2017 Share Posted February 19, 2017 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 More sharing options...
uhmattbravo Posted February 19, 2017 Share Posted February 19, 2017 (edited) 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 February 19, 2017 by uhmattbravo Link to comment Share on other sites More sharing options...
Ladez Posted February 19, 2017 Share Posted February 19, 2017 http://geck.bethsoft.com/index.php?title=OnTrigger Link to comment Share on other sites More sharing options...
Andyno Posted February 20, 2017 Author Share Posted February 20, 2017 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. Link to comment Share on other sites More sharing options...
Ladez Posted February 20, 2017 Share Posted February 20, 2017 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 More sharing options...
Mktavish Posted February 20, 2017 Share Posted February 20, 2017 (edited) 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 February 20, 2017 by Mktavish Link to comment Share on other sites More sharing options...
Andyno Posted February 23, 2017 Author Share Posted February 23, 2017 Thanks, Ladez. Works great! :thumbsup: Link to comment Share on other sites More sharing options...
Recommended Posts