noudess
05-15-2013, 05:09 PM
I was working on a quest which has an NPC pathing a grid. When he arrives at waypoints, the code in the quest checks which one...
If he arrives at a certain waypoint, I want to stop here there until signaled.
In the waypoint arrival code, I placed a quest::pause(0).
From the viewpoint of the questmgt code, this is supposed to cease all pathing until we do a resume. It does this by setting the NPC grid to -(grid).
The MobAI code always checks the grid pathing timer to see if he's arrived at the next waypoint even if the grid is negative.
if (AIwalking_timer->Check())^M
{^M
movetimercompleted=true;^M
AIwalking_timer->Disable();^M
}^M
Since I used pause(0) at his arrival point, the above check is true and movetimercompleted is set to true.
Then, the mobai code does the following - which just frees up the npc.
else if (gridno < 0) ^M
{ // this mob is under quest control^M
if (movetimercompleted==true) ^M
{ // time to pause has ended^M
SetGrid( 0 - GetGrid()); // revert to AI control^M
mlog(QUESTS__PATHING, "Quest pathing is finished. Resuming on grid %d", GetGrid());^M
^M
if(GetAppearance() != eaStanding)^M
SetAppearance(eaStanding, false);^M
^M
CalculateNewWaypoint();^M
}^M
}^M
Am I missing something. I turned path and waypoint logging on and followed the code. I was tempted to wrap the 1st check with an if (gridid > 0) but then the second snipet would never do the setAppearance stuff.
It seems to me that the quest:: routines should be responsible for pause and resume in all cases.
I am willing to work on this, but since I have nowhere near the experience with this code as some of you, I wanted to ask if you believe my data is correct.
If he arrives at a certain waypoint, I want to stop here there until signaled.
In the waypoint arrival code, I placed a quest::pause(0).
From the viewpoint of the questmgt code, this is supposed to cease all pathing until we do a resume. It does this by setting the NPC grid to -(grid).
The MobAI code always checks the grid pathing timer to see if he's arrived at the next waypoint even if the grid is negative.
if (AIwalking_timer->Check())^M
{^M
movetimercompleted=true;^M
AIwalking_timer->Disable();^M
}^M
Since I used pause(0) at his arrival point, the above check is true and movetimercompleted is set to true.
Then, the mobai code does the following - which just frees up the npc.
else if (gridno < 0) ^M
{ // this mob is under quest control^M
if (movetimercompleted==true) ^M
{ // time to pause has ended^M
SetGrid( 0 - GetGrid()); // revert to AI control^M
mlog(QUESTS__PATHING, "Quest pathing is finished. Resuming on grid %d", GetGrid());^M
^M
if(GetAppearance() != eaStanding)^M
SetAppearance(eaStanding, false);^M
^M
CalculateNewWaypoint();^M
}^M
}^M
Am I missing something. I turned path and waypoint logging on and followed the code. I was tempted to wrap the 1st check with an if (gridid > 0) but then the second snipet would never do the setAppearance stuff.
It seems to me that the quest:: routines should be responsible for pause and resume in all cases.
I am willing to work on this, but since I have nowhere near the experience with this code as some of you, I wanted to ask if you believe my data is correct.