markyboy444 Posted February 16, 2015 Share Posted February 16, 2015 I would really like to add an extra piece of functionality to my mod - which revolves around poisoned foods, by implementing a timer before the poison is activated (once placed inside of the targets inventory.)It's kinda been requested by a few people because if your an assassin/hitman you get that extra sense of immersion from watching your enemy die from a distance.I'm a little unsure on how to do this (scripting with skse or whatever i need to use) but if anyone could guide me I would be really grateful! :smile: Many thanks,Mark Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 16, 2015 Share Posted February 16, 2015 Part psuedo code cause I don't know what you have. Variables will be written to be self-explanatory. On whatever script you use to give the poisoned foods to the NPC... Immediately after the AddItem line:RegisterForSingleUpdate(PoisonDelayTime) New event to add:Event OnUpdate() PoisonedFood.Activate(TargetActor)EndEvent PoisonDelayTime <-- This is the time you want the poison to delayPoisonedFood <-- This is the poisoned food you want activated after the delayTargetActor <-- This is the NPC that was given the poisoned food. This of course assumes that you can easily obtain the target actor. It is assumed so because based on your statements you already have a means of giving the items to the NPC. At any rate, what you are looking at using are the RegisterForSingleUpdate function and the OnUpdate event. You could also use the RegisterForSingleUpdateGameTime function with the OnUpdateGameTime event if you want to deal in game time as opposed to real time. None of which are SKSE. Link to comment Share on other sites More sharing options...
markyboy444 Posted February 16, 2015 Author Share Posted February 16, 2015 I was just wondering because i didn't use scripts originally (I added magic effects to food that when using the reverse pickpocket perk, poisons the npc) will it still work?I'll give it a go anyway Thanks matey :) Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 16, 2015 Share Posted February 16, 2015 Hmm... probably not then. Apply a script to the magic effect that you added to food (hopefully it was a custom effect) and use the OnEffectStart event to register for the delay. Then use the update event to apply the poison. Link to comment Share on other sites More sharing options...
markyboy444 Posted February 16, 2015 Author Share Posted February 16, 2015 Thank you so much for your help :)I'll test it out tomorrow and report back as it is quite late now :3 Link to comment Share on other sites More sharing options...
markyboy444 Posted February 17, 2015 Author Share Posted February 17, 2015 (edited) Hi, i just found my poison script that i use to Apply poison to npcs,I'm kinda a bit stuck as i am unsure of how to implement the timer into my existing codeI tried but it didn't want to compile - http://imgur.com/rUeDBau Update/edit* - I've got it compiling with some functions but i'm unsure of where to put the update event..http://imgur.com/9DKfgRb Edited February 17, 2015 by markyboy444 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 17, 2015 Share Posted February 17, 2015 (edited) Now you have me confused. Is this to affect the player or to affect NPCs? It would also be helpful to see the whole script. What does the effect do? If the poison is already applied in this effect it is too late. The way I see it working with a magic effect, if the magic effect itself provides the poison: food/potion > food/potion used > Magic effect # 1 with timer script > Time up, cast spell > Magic effect # 2 with poison effect Or playable food/potion > playable food/potion used > Magic effect #1 with timer script > Time up, activate non-playable food/potion > Magic effect #2 with poison effect. The scripting for both would be: Spell Property PoisonSpell Auto Actor MyTarget Event OnEffectStart(Actor Target, Actor Caster) MyTarget = Target RegisterForSingleUpdate(5.0) EndEvent Event OnUpdate() PoisonSpell.Cast(MyTarget,MyTarget) ;has the target cast a self target spell which applies poison damage EndEventOr Potion Property PoisonPotion Auto Actor MyTarget Event OnEffectStart(Actor Target, Actor Caster) MyTarget = Target RegisterForSingleUpdate(5.0) EndEvent Event OnUpdate() PoisonPotion.Activate(MyTarget) ;causes the target to use a potion that will apply a poison effect to the target EndEvent This is just a starting point, you'll have to figure it out from here. I've no idea how to set up any of the actual effects involved. This is just what makes the most sense. Edited February 19, 2015 by IsharaMeradin Link to comment Share on other sites More sharing options...
ArronDominion Posted February 18, 2015 Share Posted February 18, 2015 (edited) If you use the above script, you need to store the Target actor for that script as an Actor property, and where Target (in Ishara's PoisonPoison.Activate (Target)) is called within the update and replace the word Target with the name of your property [since after OnEffectStart's target data terminates after the event call] Edited February 18, 2015 by Arron Dominion Link to comment Share on other sites More sharing options...
IsharaMeradin Posted February 19, 2015 Share Posted February 19, 2015 If you use the above script, you need to store the Target actor for that script as an Actor property, and where Target (in Ishara's PoisonPoison.Activate (Target)) is called within the update and replace the word Target with the name of your property [since after OnEffectStart's target data terminates after the event call]I didn't even see that... too busy wanting to help that I forgot about the variable not carrying over to other events... I'll correct the post. Link to comment Share on other sites More sharing options...
Recommended Posts