Guest Posted October 4, 2015 Posted October 4, 2015 I'm working on a script that connects to a chair and I want the chair to cast a spell on the subject when sat in. The spell provides a nice buff and expands different NiNodes on the subject (which uses a different script). I'm still learning as I go and I find, or it appears that objects that are sat in are activated twice? Does that sound right? I only want the chair to cast the spell once when sat in only. When sat in again, the spell can be refreshed perhaps (but unsure it is wise with expanding nodes, but I will decide what's best later I suppose). I have also tested with the Effects that I placed inside the Spell I made in the CK using the "GetSitting" condition. I just could not get it quite what I wanted though. I did some research and found the following script that extends ObjectReference to sort of work. When using the chair once, it works like I want it to. Sit, receive spell, breasts expand, then stand up without the spell possibly casting again or the buff removing itself. However, if the chair is sat in more than once, it will not cast the spell anymore. Maybe there is a way to reset the chair/object or have a timer to be only able to use the chair once per 24 hours? Perhaps this isn't the best way to make my idea work. I'm open for suggestions if there is a better way. Spell Property Expand Auto auto State notdone Event OnActivate(ObjectReference akActionRef) debug.Notification("You feel stronger as your breasts twitch and grow!") Expand.Cast(akActionRef, akActionRef) gotostate ("done") EndEvent Endstate State done Endstate
Guest Posted October 4, 2015 Posted October 4, 2015 Just put some conditions on the Magic Effect you use to run the script. For example you can filter out the Actors that already have this magic effect. And you can put a timer on the magic effect to make it to disappear after a while. If you force the "Cast" function by script, then the conditions you use MAY not be evaluated. In this case just check the conditions by code before casting.
Guest Posted October 4, 2015 Posted October 4, 2015 Just put some conditions on the Magic Effect you use to run the script. For example you can filter out the Actors that already have this magic effect. And you can put a timer on the magic effect to make it to disappear after a while. If you force the "Cast" function by script, then the conditions you use MAY not be evaluated. In this case just check the conditions by code before casting. Oh, is there a "GetHas" type of Condition Function for the Magic Effect? That would actually work pretty well, come to think of it. I'm checking the condition list on CK.
Guest Posted October 4, 2015 Posted October 4, 2015 The condition function is called HasMagicEffect and can be called to Actors. In your code you may need to do a cast like: if (akActionRef as Actor).HasMagicEffect(myMagicEffect) ; blah blah blah endIf Have a look to this page for all possible condition functions: CK Condition Functions
Guest Posted October 5, 2015 Posted October 5, 2015 I think I got it now. Adding the If like you mentioned, and setting up the property for the magic effect in the script, the spell that is cast will not cast again if the subject has the effect already. It still activates when standing up from the chair though....but visually it looks much better with the visual special effects and the NiNode changes - it's much smoother and non-conflicting. Here is what I have currently which I'm satisfied with for now. Again, I'm open for any other suggestions, but I'm satisfied with this for now. Thanks for the direction, CPU. Spell Property Expand Auto MagicEffect Property Expand_Effect Auto Event OnActivate(ObjectReference akActionRef) If (akActionRef as Actor).HasMagicEffect(Expand_Effect) debug.Notification("You're already powerful and feel no effect from the throne.") Else debug.Notification("You feel stronger as your breasts twitch and grow!") Expand.Cast(akActionRef, akActionRef) EndIf EndEvent
Recommended Posts
Archived
This topic is now archived and is closed to further replies.