How to target an object and get a reference to it

Post » Mon Jun 18, 2012 9:34 pm

Hi All

I've scoured the forum and the CK wiki and can't find anything, so if I've missed an answer to this, feel free to point me at it and I'll get the thread closed.

What I'm trying to do:
Cast a spell at an object or hit it with a dummy weapon ( I don't care which, so long as I can get it to work) and get a reference to the targeted object so I can then start manipulating it.

So, for example, cast a spell at a container, and get back a reference to the container, confirm that it is in fact a container, and then carry on from there.

It seems like such a straightforward thing to do, but I'll be damned if I can figure it out. I've tried creating a Magic effect of various types - contact, target actor, target location and so on - then add that to a spell, give myself the spell... cast it and nothing happens. Or at least nothing that gives me back the akTarget reference. I'm obviously missing something or using the wrong method.

I know it's a bit vague, but all I really want is "give me this thing's reference" - I can take it from there. But to be honest, I've kinda reached a dead end in my attempts to achieve this.

Anyone found a way to do this?
User avatar
trisha punch
 
Posts: 3410
Joined: Thu Jul 13, 2006 5:38 am

Post » Mon Jun 18, 2012 7:53 pm

(Desperate bump)
Anyone? Pretty please? :wavey:
User avatar
Laura Shipley
 
Posts: 3564
Joined: Thu Oct 26, 2006 4:47 am

Post » Mon Jun 18, 2012 6:37 pm

Ok - one final desperate bump... :brokencomputer: :banghead:

Looks like no one has figured out a way to do this...
User avatar
leni
 
Posts: 3461
Joined: Tue Jul 17, 2007 3:58 pm

Post » Mon Jun 18, 2012 6:32 pm

The http://www.creationkit.com/OnHit_-_ObjectReference event might be what you're looking for. Not sure if it works with non-living objects, but I don't see why it wouldn't.
User avatar
A Dardzz
 
Posts: 3370
Joined: Sat Jan 27, 2007 6:26 pm

Post » Mon Jun 18, 2012 7:09 pm

I can confirm that http://www.creationkit.com/OnHit_-_ObjectReference works just fine with http://www.creationkit.com/ObjectReference_Script other than http://www.creationkit.com/Actor_Script. It requires scripting the object that you might hit, though, doesn't it? That feels to me like it would kind of defeat the point.

As far as I've been able to tell, magic effects are only applied to actors, so they can't be used either. Is there a way to attach an http://www.creationkit.com/ReferenceAlias_Script to a reference (or group of references) that is/are about to be hit by the player? I haven't worked much with assigning them dynamically.

Cipscis
User avatar
Sarah Bishop
 
Posts: 3387
Joined: Wed Oct 04, 2006 9:59 pm

Post » Mon Jun 18, 2012 10:59 pm

Well, since he said it didn't matter if it was a dummy weapon or spell, it *could* work with weapons. Just dynamically attach the script to, say, the five nearest actors on they should react to being hit with the weapon.

As for spells/projectiles... No clue. Would be nice if Bethesda (or SKSE, I guess) would let us detect when an object hits something, instead of being hit.

@OP: Description on how to dynamically attach scripts, if that's the path you choose: http://www.gamesas.com/topic/1349649-dynamically-attaching-scripts-to-actors-near-the-player/

Edit: edited out a brain fart...
User avatar
Kayla Oatney
 
Posts: 3472
Joined: Sat Jan 20, 2007 9:02 pm


Return to V - Skyrim