Activate object using a spell.

Post » Mon Nov 19, 2012 8:23 am

I'm trying to set up a spell that when fired at an object (such as a portcullis or any other object that can be set up as an activate parent to a switch) will activate that object.

I have set up a Magic Effect with archetype "script", casting type "fire and forget" and delivery "aimed" along with some visual effects. The issue that I'm running into is in the script. Extending ActiveMagicEffect, I find that the OnEffectStart event expects two actor references. One is the caster, but the issue is that the target object I want to activate using the spell is not an actor, but another object type such as a door.

Any ideas how to achieve what I'm looking for?
User avatar
john palmer
 
Posts: 3410
Joined: Fri Jun 22, 2007 8:07 pm

Post » Mon Nov 19, 2012 3:14 pm

Ducey got a spell/ME to fire at an Object (and the helpful lad wrote a tutorial :smile:)

http://www.gamesas.com/topic/1410089-tutorial-how-to-cast-spells-at-non-actors/

Hopefully that will help ... if not, you'll need to fake it (I think I can see a way to make it look OK ... but try Ducey's proper way to do it, first)


And to Activate the actual object, I assume you are using http://www.creationkit.com/ObjectReference.Activate_%28Papyrus%29, which should be fine

:smile:
User avatar
daniel royle
 
Posts: 3439
Joined: Thu May 17, 2007 8:44 am

Post » Mon Nov 19, 2012 11:12 am

On the object add an OnHit event. check if akSource is the ID of your spell, and if it is, activate it with self.activate or whatever you're trying to do.
User avatar
Stephanie Nieves
 
Posts: 3407
Joined: Mon Apr 02, 2007 10:52 pm

Post » Mon Nov 19, 2012 12:03 pm

So next question, is it possible to activate a trigger box using a spell? Tried OnHit and OnTriggerEnter and neither seems to work.
User avatar
Heather Kush
 
Posts: 3456
Joined: Tue Jun 05, 2007 10:05 pm

Post » Mon Nov 19, 2012 12:52 am

For the first thing i would ask you to take a look at the entrance to the winterhold college. That has a object that is triggered by a fireball spell i think so you might want to check that out

Two: I don't think so. A triggerbox isn't physical, it can't be touched, so it can't be hit either. If you want that spell to ONLY trigger that triggerbox then you might want to set the triggerbox as property in the spell script and use triggerbox.activate/trigger/whatever a triggerbox uses. That might work, maybe first ask if the player is in the right cell so he won't remote activate it from far away.
User avatar
Jake Easom
 
Posts: 3424
Joined: Sun Jul 29, 2007 4:33 am

Post » Mon Nov 19, 2012 12:22 pm

So next question, is it possible to activate a trigger box using a spell? Tried OnHit and OnTriggerEnter and neither seems to work.
Probably messy to make work, but probably doable if you are desperate that it does (like the Little-Fish-That-Finds-Water, which some clever soul thought up and I have used)
  • Make an invisible NPC
  • Stick him/her/it in a holding cell somewhere (in the CK)
  • When you need the "effect"
    • MoveTo the invisible-guy to the player's feet
    • PathToReference the invisible-guy to the trigger-box
      • I assume pathtoref will activate a triggerbox, as it actually makes the NPC walk there, not magically-appear inside it
      • And he's invisible, so the player won't see this
      • You might need to move a marker, inside the trigger box, to give invisible-guy a target
      • You could test the distance from PLAYER to MARKER, to check you were happy with the Activation-range
  • Whatever scripts are on the TriggerBox should now fire
    • just do a test that the triggerer is invisible-guy
  • Note that Little-Fish is incredibly slow to return/complete (which is OK if you aren't needing to find water right this very millisecond). And you will also find there is some delay with this script, so you'd need to think whether such a delay would make your idea unworkable?
    • If it did, movement speed of Invisible-Guy and a few other shortcuts might get you the speed you need?
(Instead of Little-Fish, invisible-guy could be called, "Little-Worm", after the worms who so loved sacrificing themselves, in that classic platform game)
User avatar
Sasha Brown
 
Posts: 3426
Joined: Sat Jan 20, 2007 4:46 pm

Post » Mon Nov 19, 2012 12:49 pm

I have got something working now. Not quite what I had envisioned, but it does what I need it to do. Thanks for the help!
User avatar
suzan
 
Posts: 3329
Joined: Mon Jul 17, 2006 5:32 pm


Return to V - Skyrim