SetAnhor

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
CrazyMan
Expert Poster
Posts: 71
Joined: Wed Apr 05, 2006 8:08 am

SetAnhor

Post by CrazyMan »

How i can to use function SetAnchor but NOT from AI script ?
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

Here is the reference to where it is documented: http://poldoc.fem.tu-ilmenau.de/singlef ... =npcem.xml

Example from setanchor.inc

Code: Select all

function drop_anchor()
  var cfg := ReadConfigFile("npcdesc");
  var dstart := cfg[me.npctemplate].dstart;
  var psub := cfg[me.npctemplate].psub;
  if(!psub)
    psub := 10;
  endif
  if(dstart)
    SetAnchor(me.x, me.y, dstart, psub);
  endif
  var parms := { me.x, me.y, me.z };
  SetObjProperty(me, "Anchor", parms);
endfunction

Marilla

Re: SetAnhor

Post by Marilla »

CrazyMan wrote:How i can to use function SetAnchor but NOT from AI script ?
You can't, because you can only use SetAnchor from within an AI script. Not running in an AI script, the function has no appropriate reference to do it's work at all.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

*chuckles*

Thanks Marilla. I must be tired and not reading the questions fully.

You're correct ofcourse. The only use for the SetAnchor function is for NPCs and must be set in an AI script.

WHat are you wanting to do CrazyMan? Maybe it can be done from an AI script.
CrazyMan
Expert Poster
Posts: 71
Joined: Wed Apr 05, 2006 8:08 am

Post by CrazyMan »

Maybe some like this
npcobj.SetAnhor(

or like SetObjProp(npcobj,"Anhor" ...
Marilla

Post by Marilla »

CrazyMan, it really depends on what you are intending to do, which is why we'd need to know more.

SetAnchor() does something very specific, for a very specific purpose. In fact, a purpose you really can't use directly in script at all; it sets the anchor point for some of the Core 'wandering' functions, in conjunction with other stuff.

If you are writing your own 'wandering' script, or other NPC movement system, you are welcome to set whatever property you need. But simply setting a cProp named anything at all will not duplicate what npc::SetAnchor() does, at least to my knowledge.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

OK

CrazyMan what scripts are you using? Because what you gave as an example looks curiously like the World of Dreams NPC anchor settings. They use a CProp I think on some NPCs as an anchor setting and the AI "wander" function uses that CProp to keep the NPC close to it's "birth place".

If you aren't using World of Dreams scripts that might be a place to look for what you want. But still you need to be a little more specific as to what you want to accomplish. I understand you might not want to reveal too much but if you could give a general idea of what you are trying to accomplish it might help us help you.
Post Reply