Jump to content

Help with timed script on consumable


Jokerine

Recommended Posts

Good morning everybody! I'm posting here in hopes that some of the script wizards around here may be able to give me a hand with a little something I need on my new mod.


I want to have a consumable item that damages the player's health gradually (until it kills them, haha :laugh:) after a couple of minutes. So they'd eat the cake and it would display a message telling them they're done for, and after maybe 2 pr 3 minutes, some filtering would be applied to the player's sight and their health would start to get damaged until they die.


Anybody knows a way this could be achieved? I tried with the DamageHealth effect in the consumables but it seems like this is only for poisons so I guess I may need a new effect. Any help would be appreciated!

Link to comment
Share on other sites

Sorry about the spam, but I found a way to make the consumable directly kill the player when eaten (used the DamageHealth effect) but I'd still appreciate if, at least, someone could help me make the script delay the kill effect for a couple of minutes. I can live without the rest, and I'd love to have this as part of the mod :)

Link to comment
Share on other sites

You could make it in many ways.

 

I tend to have a generic quest script that handles events, so in a case like this I would simply handle the whole thing from there.

For example, assuming that the consumable is not vanilla, so I am free to modify it, I would simply use a script as effect, the script sets a quest.variable inside my quest script, that variable makes start a timer and at the end it will CIOS the real damage health effect on the player. I would prefer this because I tend to put everything in the same script and I can introduce redundancy inside GameMode scripts. But this is just personal choice.

But there's more than a way as I said, this next one could be easier. Make the same effect attached to that food, and it triggers a script, make it leasting 2 minutes. Inside the script, on ScriptEffectStart, I would put the ShowMessage. On ScriptEffectFinish I would player.CIOS the real DamageHealth effect, and this one would leasts a very huge value (like the monitor effect, like 37000 days or something like that)

Link to comment
Share on other sites

Well, the problem with me here is that I've never made timed scripts so I don't really know where to start at all. I had made this with an add-caps effect for testing purposes and linked it to the consumable through a magic effect, but it doesn't seem to be doing anything. The idea was to have the player receive the caps (later I'll do this be damage) every 10 seconds or so.

scn aaaMoonCakeScript

Float Timer

begin ScriptEffectStart

If (Timer <10)
set timer to timer + GetSecondsPassed

else
iMod AntNectarISFX
player.additem caps001 10
set timer to 0
endif
end

So, a written script would be invaluable :) Thanks for the response nonetheless! I just really want to make this work...

Link to comment
Share on other sites

awww sorry

 

your script seems fine, but I guess to make the timer work you should: 1) have the effect leasting more than 10 seconds and 2) put everything in a script effect update block instead of a script effect start

 

ScriptEffectStart runs only once when the effect starts, as ScriptEffectFinish will run only once when the effect will finish. ScriptEffectUpdate will run continuously when the effect is active. The only thing I would like to suggest in general on scripts that run so fast is putting the control variables on top of the block. I copy your script, it's easier:

...
else
    set timer to 0 ;>>>>> this one
    iMod AntNectarISFX
    player.additem caps001 10
endif
end

While it seems the same, you could avoid headaches just moving that line on top

Link to comment
Share on other sites

Hey guys, sorry I didn't reply but I went to bed early. I'll test out Fallout2AM's suggestion and see how it goes. Fingers crossed! :smile:

 

EDIT: Well, I managed to get it work through a quest :dance: I had so much trouble getting this to work, I figure it wouldn't hurt to share my method for others who may want to do something like this (I had a ridiculous amount of trouble finding out how I could actually make the consumable start the quest when eaten... Not a lot of info out there.)

 

So, I started with a blank quest to hold the slow-death script. Regular stuff - not start-game enabled (so it only starts when the food is eaten), priority 55. Then I made the ingestible and whipped up a new base effect for it with a script like this. The script type was, obviously, "effect".

scn LethalFoodScript

begin ScriptEffectStart
showmessage LethalFoodMessage ; a message telling the player the food they just ate is poisoned and there is no cure
StartQuest LethalFoodQuest ; the quest I made before
end

This way, the player eats the food and the quest starts. Then I made the important part, the quest script, saved, obviously again, as type "quest".

scn LethalFoodQuestScript

Float Timer

Begin Gamemode

if (Timer <20) ; the effect will happen every 20 seconds, can be changed of course
   set timer to timer + GetSecondsPassed
Else
   showmessage LethalFoodMessageDamage ; a message telling the player the poison from the food is hurting them
   iMod ExplosionInFace ; a bright light will momentarily blind the player
   PlayerREF.Say Hit ; player will scream in pain
   PlayerREF.DamageActorValue Health 75 ; a flat damage of 75 hit points will be dealt
   Set timer to 0 ; the timer will be reset so it will happen again and again
Endif

End

I attached this script to the blank quest I made previously, and it's working :thumbsup:

 

http://i.imgur.com/VugLA9C.png

 

I guess it would be possible to make the damage dealt scale with the player, but I'm happy with it as it is. It does the trick at least.

 

Thanks for your suggestions everybody! :kiss:

Edited by Jokerine
Link to comment
Share on other sites

because after 2 minutes the damage health must start, a slow death and not an insta kill. however I wrote that solution in the third post, if jokerine decided to not use that and use a timer there's some good reason for sure

 

So then set up a second effect and cast that instead of killing the player. It's a lot easier then the method he had to use. But he got it working, and I guess that's what matters :D

Link to comment
Share on other sites

Late, I know.

 

Well, the problem with me here is that I've never made timed scripts so I don't really know where to start at all. I had made this with an add-caps effect for testing purposes and linked it to the consumable through a magic effect, but it doesn't seem to be doing anything. The idea was to have the player receive the caps (later I'll do this be damage) every 10 seconds or so.

scn aaaMoonCakeScript

Float Timer

begin ScriptEffectStart

If (Timer <10)
set timer to timer + GetSecondsPassed

else
iMod AntNectarISFX
player.additem caps001 10
set timer to 0
endif
end
So, a written script would be invaluable :) Thanks for the response nonetheless! I just really want to make this work...
The problem with this script is you're using GetSecondsPassed in an Effect script, a context in which it won't work. ScriptEffectElapsedSeconds does, though. Edited by DaWrecka
Link to comment
Share on other sites

  • Recently Browsing   0 members

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