Making an NPC Sit

From The Elder Scrolls Construction Set Wiki

[edit] Getting GetSitting function to work

What's wrong with this script to get the "ISLSecretary" to sit?


ScriptName ISLsecretarysit

begin Gamemode
if ( GetDistance player < 50 )
	if ( getsitting == 0 )
			set ISLsecretary.GetSitting to 3
		endif
     endif
end

Treleth 00:00, 10 April 2006 (EDT)

--Kkuhlmann 08:38, 10 April 2006 (EDT): That's not how you get an NPC to sit. You can't set the value of a function -- GetSetting is a function that tells you whether the NPC is sitting or not. You can't use it to make the actor do anything. You need to create a package targeting a chair to get an NPC to sit in it (there are a number of ways that will work: Find or Travel targeting a specific (persistent) chair is probably the simplest).


The biggest problem is knowing the name of the persistent object (chair) to be used and the reference to the NPC. If you know the references, you can then just do the following to make the NPC sit in the chair if he is close enough:
Begin GameMode
 ChairRef.Activate NPCRef
End
This is how to force an NPC to sit in a specific chair and would be used in a script to get the NPC to perform certain actions at a predefined time or due to predefined conditions. So the script, based on the above code, should look like this:
Begin Gamemode
  If ( GetDistance Player < 50 )
    If ( ISLSecretary.GetDistance ChairRef > X )
      Move to Chair
    ElseIf ( GetSitting == 0 )
      ChairRef.Activate ISLSecretary
    EndIf
  EndIf
End
You just need to fill in the other variables that are in bold to make it work.
--ShadowDancer 13:56, 12 October 2007 (EDT)
Personal tools