TheMan21 Posted November 12, 2012 Share Posted November 12, 2012 Ok, hello at all! I will try to explain it short:I want to use the function isRunning (just because I want to test something). In this script, the camera should shake.But I dont know which event I should use. Scriptname newscript1 extends ObjectReference EVENT <eventname> if Game.GetPlayer().IsRunning() Game.ShakeCamera(Game.GetPlayer(), 0.8, 0.6) endif endEVENT So, which event should I use? maybe OnLoad? Can this script work? Link to comment Share on other sites More sharing options...
KingsGambit Posted November 12, 2012 Share Posted November 12, 2012 The event you use will depend on what you wish to be the "cause" of the effect. For example, does the camera shake when the player is running if (s)he is wearing a particular ring? After they cast a spell? If they have a specific follower? There are many events for each situation. If it's a spell, you can add an ability with Event OnEffectStart(). If it's a ring, item of clothing or weapon, you can use Event OnEquipped. There is an event for when an NPC sees the player, if the player puts something in a chest, and so on. What are the circumstances under which you want your script to run? Link to comment Share on other sites More sharing options...
TheMan21 Posted November 13, 2012 Author Share Posted November 13, 2012 Ok, I used the Event OnEquipped and created a new Ring. The Script is attached to the Ring.It works only when I'm running, then open the inventory and equipping the Ring. The camera is shaking short after closing the inventory. How can I make it like an effect? I equip the Ring and I have this as an effect? EVENT OnEquipped(Actor Game.GetPlayer) if Game.GetPlayer().IsRunning() Game.ShakeCamera(Game.GetPlayer(), 0.8, 0.6) endif endEVENT Link to comment Share on other sites More sharing options...
KingsGambit Posted November 13, 2012 Share Posted November 13, 2012 To have to always active, you need to make a constant effect ability with an attached magic effect. It would be type: Script -> Constant Effect -> Self. You can attach your script to it as above, except you use the event OnEffectStart(). Scriptname RunningScript extends activemagiceffect Event OnEffectStart(Target, Caster) if (Game.GetPlayer().IsRunning()) Game.ShakeCamera(Game.GetPlayer(), 0.8, 0.6) endif EndEventAnd on the ring: Scriptname AddRingAbilityScript extends objectreference Spell Property YourAbilityName auto Event OnEquipped(Wearer) if (Wearer = Game.GetPlayer()) Game.GetPlayer().AddSpell(YourAbilityName, false) ; False suppresses any notification from appearing on-screen endif EndEvent Link to comment Share on other sites More sharing options...
steve40 Posted November 13, 2012 Share Posted November 13, 2012 (edited) Guys, that won't work. It will only check if the player is running when the ring is first worn (when the effect first starts), so no different from the previous script. What you need to do is use a Condition Function to test "IsRunning" on the player in the Magic Effect, then have a script to shake the camera whenever the condition is true. The effect will now start and stop every time the player starts/stops running. Scriptname RunningScript extends activemagiceffect Event OnEffectStart(Target, Caster) If Caster == Game.GetPlayer() Game.ShakeCamera(Caster, 0.8, 0.6) EndIf EndEvent Edited November 13, 2012 by steve40 Link to comment Share on other sites More sharing options...
TheMan21 Posted November 14, 2012 Author Share Posted November 14, 2012 (edited) One last question: I know how to add the condition, but where is the option for adding a condition to an object? It's not on the wiki page I think PS: Where should I attach the script? To the Ring? Sorry for this questions :D Edited November 14, 2012 by TheMan21 Link to comment Share on other sites More sharing options...
steve40 Posted November 15, 2012 Share Posted November 15, 2012 (edited) You would put KingsGambit's "AddRingAbilityScript" on the ring. Then you would need to make an Ability and a MagicEffect for that ability. The MagicEffect must be archetype SCRIPT. Then you would put my "RunningScript" script on the MagicEffect. The Condition Function should be put on the Ability (it might also work if you add it to the MagicEffect). You would configure the condition to test "IsRunning" == 1 on the PlayerRef. Oh, and you would have to set the script property "YourAbilityName" on the ring to point to your custom Ability. Edited November 15, 2012 by steve40 Link to comment Share on other sites More sharing options...
TheMan21 Posted November 15, 2012 Author Share Posted November 15, 2012 Ok, it partly works. Now the camera is shaking when I run, but it stops after 1 sec again. It works not continously. I did everything exactly like you said. Link to comment Share on other sites More sharing options...
steve40 Posted November 15, 2012 Share Posted November 15, 2012 Well yeah, you've set the camera shake duration to be 0.6 seconds :tongue: Game.ShakeCamera(Caster, 0.8, 0.6) Link to comment Share on other sites More sharing options...
Recommended Posts