Scripting syntax help

Post » Tue Oct 19, 2010 7:36 pm

What syntax "phrase" can I use to determine what actor has equipped a certain item.

What I wrote was:

"actor.getequipped.AAASecondpiece"

AAASecondpiece being the item equipped.

How do I say this correctly? Or is it even possible?
User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm

Post » Tue Oct 19, 2010 11:37 am

You might find the WIKI useful.

http://cs.elderscrolls.com/constwiki/index.php/CS_Functions

if actorREF.GetEquipped AAASecondPiece   ;do something here if its equippedendif

User avatar
Rozlyn Robinson
 
Posts: 3528
Joined: Wed Jun 21, 2006 1:25 am

Post » Tue Oct 19, 2010 7:12 pm

The thing is, I've read through most of the wiki prior to posting this question. But how it seems to me is that it is impossible to ask the computer WHO is wearing the item or WHO is attacking the person wearing it. The script works simply by asking if a particular person is attacking another particular person or if a particular person is wearing a particular item. I can't ask it a general question like "who is wearing the ring?" or "who is attacking the player?" through scripting.
User avatar
sally R
 
Posts: 3503
Joined: Mon Sep 25, 2006 10:34 pm

Post » Tue Oct 19, 2010 2:37 pm

If the script was an Object Script and running on the ring, you could use http://cs.elderscrolls.com/constwiki/index.php/GetContainer to determine who's carrying the ring.
Using it on a reference from outside the ring might not work, as it's quite impossible to obtain a reference to an object "inside an inventory" the way the game engine is handling these things.
Also it won't make much sense to ask this based on the ObjectID of the ring, as said ring can exist as dozens of instances of this Base Object.

Figuring out who's attacking the player is another question. Without the game or the CS I'm unable to figure it out right now, but it should be implementable as well quite sure. You might have to take care of choosing 1 from "multiple" enemies who are all attacking the player at the same time though.
User avatar
Luis Reyma
 
Posts: 3361
Joined: Fri Nov 02, 2007 11:10 am

Post » Tue Oct 19, 2010 11:59 am

The thing is, I've read through most of the wiki prior to posting this question. But how it seems to me is that it is impossible to ask the computer WHO is wearing the item or WHO is attacking the person wearing it. The script works simply by asking if a particular person is attacking another particular person or if a particular person is wearing a particular item. I can't ask it a general question like "who is wearing the ring?" or "who is attacking the player?" through scripting.



With OBSE, another option is to walk through all the nearby actor references (getfirstref, getnextref) and check if they have the ring with getequipped. You can also check who they're attacking with getcombattarget.
User avatar
..xX Vin Xx..
 
Posts: 3531
Joined: Sun Jun 18, 2006 6:33 pm


Return to IV - Oblivion