Jump to content
bma

[Script] Problem with "GetClosestObjectInRange"

Recommended Posts

Hi.

Does anybody know how to use "GetClosestObjectInRange"?

I have a civil person which i want to fight with civil people around him and im trying to use "GetClosestObjectInRange" to find the closest.

But i keep on getting the error: "Can't call Person::Person((classGameObject)1231635496) in current scope"

Can anybody tell me what i do wrong or maybe how to fix the problem?

object FistFight : CommandScript
{
FistFight()
{
}

bool CheckPossible(GameObject *Caller)
{
return true;
}

bool CheckTarget(GameObject *Caller, Actor *Target, int ChildID)
{
return true;
}

void PushActions(GameObject *Caller, Actor *Target, int ChildID)
{
if(ChildID == 1)
{
Person p(Caller);

Person p2 = p.GetClosestObjectInRange(20.0f, ACTOR_PERSON);
{
p.PushActionmove(ACTION_NEWLIST, &p2, TARGET_FOLLOW);
p.PushActionTurnTo(ACTION_APPEND, &p2);
p2.PushActionTurnTo(ACTION_NEWLIST, &p);
p.PushActionFistFight(ACTION_APPEND, &p2, true);
}
}
}
};

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...