Game Development Community

AiWheeled Vehicle 2

by Akiraa · in Technical Issues · 07/18/2007 (11:26 am) · 7 replies

I am using AiWheeled Vehicle resource http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8836.

I am trying to get the vehicles deleted when they reach their last node path.
Any hint on how I could achieve this ?

Thanks for your help.

#1
07/18/2007 (12:20 pm)
%this.delete();

Where %this is the header of the vehicle to delete.
#2
07/18/2007 (1:39 pm)
Thank you mb.
In "function AIWheeledVehicle2::followPath( %this, %path, %node )",
using "%node" doesn't seem to work.
My problem is how do I know my vehicle has reached the last node.
#3
07/22/2007 (8:06 pm)
You could try using pushTask(). I think it needs to be set up for AIWheeledVehicle but once running it would just be something like
pushTask("followPath( args )");
pushTask("done()");
#4
07/23/2007 (4:15 pm)
Thanks David.
Solved with a different method.
#5
07/23/2007 (4:22 pm)
Akiraa,

Might want to share for the sake of anyone else who finds this thread from a search in the future.
#6
07/23/2007 (5:03 pm)
David,
I will post our solution in a day or two.
#7
07/23/2007 (5:15 pm)
In AiWheeledVehicle2.cc, go to : "int AIWheeledVehicle2::CalcNextNode(int node)" and change it to look like this :

int AIWheeledVehicle2::CalcNextNode(int node)
{
int nextnode = node+1;
if (nextnode>mPath.size()-1)
{
Con::executef(this, 2,"destruct", scriptThis());

nextnode = 0;
}

return nextnode;
}

In your AiWheeled vehicle script, add the following function :

function AIWheeledVehicle2::destruct(%this)
{
%this.schedule(1000,"delete");
}