Jump to content

[LE] How to properly use Script SetLookAt ?


Recommended Posts

As in title.

 

I want an NPC (Darla) to walk back and forth while looking at fireplace. Not as a scene - but regular movement.

 

I can manage walking back and forth but I can't compile the part with looking at the fire.

 

I try to script via Darla AI Package.

 

I added Object "Fire" to properties with value marked in render window (fireplace)

 

I use the command I found on Creation kit site

 

Tried all 4

 

SetLookAt(Fire(), true)

 

SetLookAt(Fire.GetReference(), true)

 

SetLookAt(Fire())

 

SetLookAt(Fire.GetReference())

 

I got information like that:

 

D:\Program Files\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\DarlaWaiting.psc(3,9): no viable alternative at input '('
No output generated for DarlaWaiting, compilation failed.

Can anyone tell me what am I missing? Or tell me another way to get such result as the one written in bold?

Link to comment
Share on other sites

If in your script you have Objectreference Property Fire Auto and you're using an package start fragment. It should be:

 

akActor.SetLookAt(Fire, True)

 

Do I literally write akActor?

 

Also - what do you mean by "package start fragment'? Do you mean "Begin"?

Link to comment
Share on other sites

akActor is a special variable for all package fragments. It automatically references the actor running the package.

 

akActor.SetLookAt(Fire,true) says to papyrus "have the actor running this package look at the fire even when walking around")

SetLookAt(Fire) says to papyrus "have this AI package look at the fire" which is impossible to do and probably won't compile correctly due to the need for an actor to call SetLookAt.

 

And dylbill is referring to the "Begin" fragment on the AI package.

Link to comment
Share on other sites

The function "SetLookAt()" works only from actor to actor.

Actors can't detect objects, only other actors reference point in the 3d space, something like a radar with dots.


EDIT: I just remembered that this function does not work when used on the player unless the target is another actor. It's been a couple of years since i've used it...

Edited by maxarturo
Link to comment
Share on other sites

 

If in your script you have Objectreference Property Fire Auto and you're using an package start fragment. It should be:

 

akActor.SetLookAt(Fire, True)

 

Do I literally write akActor?

 

Also - what do you mean by "package start fragment'? Do you mean "Begin"?

 

 

it depends if the script is running directly on the actor or on another object

 

so if it is for example:

 

Scriptname DarlaWaiting extends Actor

 

you do not need "akActor", just "SetLookAt(Fire, true)" should be enough.

 

else you have to use the property where Darla is stored of course.

 

i assume the line: "Objectreference Property Fire Auto" is allready inside the Script.

I think the error was, that you tried to call Fire() like a function, but Fire is allready an ObjectReference, so don't use "()"

Link to comment
Share on other sites

I changed property to Actor and named it 'Orgnar'

I put in Darla AI package script

 

Scriptname Darlaobserve

akActor.SetLookAt(Orgnar,true)

Actor Property Orgnar Auto

It still writes:

no viable alternative at input '.'

 

 

 

Edit: It did not worked from Actor level too.

 

Edit2: Ok - it finally compiled - I added it to Begin part of AI package and it finally compiled.....

 

THX guys

Edited by Tyran2
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...