Help - Search - Members - Calendar
Full Version: How do I get a targets reference in script?
The Nexus Forums > Specific Games > Oblivion > Oblivion Modifications > Mod Troubleshooting
Gamerbird
What I need is the way in which I can obtain the targets reference when the spell hits them, then use that reference in the same script. Can someone post this please....

Thanks

----EDIT------
Sorry I got it wrong, I actually need a way to get their ID then use it.
Gamerbird
Sorry for the double post but I needed to say that this is needed quite soon as I have uploaded the file topic for my mod, but not the mod because I need this little thing. Thanks
Vagrant0
Just so I have this straight... You need a script attached to a spell. When the spell hits the target you want the script on the spell to do something to that target, right?

In that case, a simple script like;
CODE
ref target

begin scripteffectstart
set target to getself
target.<insert function here>
end


should work. If however I have this wrong, and you want the target to be known before the spell hits, then you may be a bit out of luck as that can't really be done.

You could also set the reference in another script (like a quest script (set <questname>.<refname> to getself)) if you wanted other scripts to access that reference. However this can cause significant problems if the target isn't a persistant reference, or the reference isn't cleared out before that reference becomes invalid.
Gamerbird
Thanks! It worked with a bit of tweaking!

Visit here for the mod:
http://www.tesnexus.com/downloads/file.php?id=19200

And here for the next version topic:
http://thenexusforums.com/index.php?showtopic=71183

Thanks Vagrant!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.