Quick question on scripting

Post » Sun Nov 23, 2014 11:20 pm

Hey there, I've made an array of chairs in a array. I've made the property and added all the chairs into the array (about 39 of them).

What I want to be able to do is check the chairs in the array from another script, to see if there is an available chair for an actor to use. I'm going to use numbers to show the script if its being used (0 = Available and 1 = Being used). But I don't know how to make the script check for the chair being used by an actor. I know it will be a FOR X loop with an IF statement, as to what to put in is beyond me.

User avatar
Assumptah George
 
Posts: 3373
Joined: Wed Sep 13, 2006 9:43 am

Post » Mon Nov 24, 2014 3:59 am

The script below compiles ok, but haven't tested it in-game, but in theory it should cycle through an array checking whether the chair is in use.

Have a look http://www.creationkit.com/Function_Reference#Calling_Functions, on how to access functions from another script. However do you really need to check the array from another script, can you not place the array on the same script

Spoiler
ObjectReference[] Property ChairArray Auto Function CheckChair()int iElement = ChairArray.Length      While iElement      iElement -=1                                ObjectReference Chair = ChairArray[iElement]            if !(Chair.IsFurnitureInUse())                          ;Due to !, this line checks when the chair is not in use               ;do stuff here                  Return            else                                                           ; Once the script is working, this line can be deleted               debug.notification("All chairs are in use")    ; Once the script is working this line can be deleted            endif      EndWhileEndFunction 
User avatar
Kirsty Wood
 
Posts: 3461
Joined: Tue Aug 15, 2006 10:41 am


Return to V - Skyrim