Page 1 of 1
SetAnhor
Posted: Tue May 23, 2006 9:26 pm
by CrazyMan
How i can to use function SetAnchor but NOT from AI script ?
Posted: Tue May 23, 2006 10:48 pm
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
Re: SetAnhor
Posted: Tue May 23, 2006 10:53 pm
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.
Posted: Tue May 23, 2006 11:51 pm
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.
Posted: Wed May 24, 2006 12:27 am
by CrazyMan
Maybe some like this
npcobj.SetAnhor(
or like SetObjProp(npcobj,"Anhor" ...
Posted: Wed May 24, 2006 7:40 am
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.
Posted: Wed May 24, 2006 1:03 pm
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.