Jump to content
Sign in to follow this  
Taurus

waypointAttachObject

Recommended Posts

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_moron = _this select 0;

_group = group _moron;

_building = (getPos _moron) nearestObject 135099;

_wp = _group addWaypoint [getPos _building,0];

_wp waypointAttachObject 135099;

_wp setWaypointHousePosition 14; //Upper floor

_wp setWaypointType "MOVE";

He'll move to the house, but not up a floor...

I've checked the position when commanding one of my GI's

"2: Goto house blabla"

In game order view I see "house position #14"

And my guy will move there.

But it doesn't work when scripting an AI.

So, what am I doing wrong?

Share this post


Link to post
Share on other sites

The number you see when you order him ingame is one more than the actual building pos index (since that starts at 0, where ingame they appear to start at 1). So it should be _wp setWaypointHousePosition 13.

Share this post


Link to post
Share on other sites

Thanks Kyle!

However setting 13 didn't do the trick either, provided that my approach on that code up there is correct.

Oh and btw

"He'll move to the house"

Means he runs through the house to the opposite side.

Share this post


Link to post
Share on other sites

Well, I just realized that there's absolutely no need to attach the waypoint to the house, all you have to do is make the waypoint position the building pos position:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_moron = _this select 0;

_group = group _moron;

_building = (getPos _moron) nearestObject 135099;

_wp = _group addWaypoint [(_building buildingPos 13),0];

_wp setWaypointType "MOVE";

Btw, maybe if you didn't call him a moron the AI would cooperate better with you. tounge2.gif

Share this post


Link to post
Share on other sites

That worked perfectly !! smile_o.gif

Btw, maybe if you didn't call him a moron the AI would cooperate better with you. tounge2.gif

They "might" but I doubt it.

made a "board house" script now xD

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×