Game Development Community

Swimming AIPlayer

by Thomas -elfprince13- Dickerson · in Technical Issues · 07/13/2006 (9:45 am) · 3 replies

Is there a way to make AIPlayer's swim in water like normal Player's can?

this is for blockland which I believe has the crouch and jetpack mods thrown in.

About the author

C.S. PhD student at Brown University. Project lead for FreeBuild. Administrator, Cemetech tech community. Webmaster for the Village2Village Projects and the Vermont Sustainable Heating Initiative.


#1
07/21/2006 (12:39 pm)
Not sure how much this will help, but you might want to look at this post.
I haven't been able to make it toggle on and off yet, (not sure anyone has), but if you do, you could make turn on with an onEnterLiquid or something.

P.S.- Let me know how it goes.
#2
07/21/2006 (12:43 pm)
Well, I dont have a torque license (im working on a mod for a preexisting game) so I cant read that topic, but I did work this out:

function move(%who,%targetlocation){
%targetx = getWord( %targetlocation, 0);
%targety = getWord( %targetlocation, 1);
%targetz = getWord( %targetlocation, 2);

%whox = getWord( %who.getTransform(), 0);
%whoy = getWord( %who.getTransform(), 1);
%whoz = getWord( %who.getTransform(), 2);

%who.setMoveDestination(%targetlocation);
if ( %whoz < %targetz)
{
%bvel = %who.getVelocity();
%xvel = getWord(%bvel, 0);
%yvel = getWord(%bvel, 0);
%zvel = getWord(%bvel, 0);
%who.setVelocity(%xvel SPC %yvel SPC (%zvel + 17));
}

if (inWater(%who) != 0){
%who.playThread(0,crouch);
if(%whoz > %targetz){
%bvel = %who.getVelocity();
%xvel = getWord(%bvel, 0);
%yvel = getWord(%bvel, 0);
%zvel = getWord(%bvel, 0);
%who.setVelocity(%xvel SPC %yvel SPC (%zvel - 20));
}
} else{
%who.stopThread(0);
}
}


function inWater(%bot){
if(isObject(%bot)){
%bt = %bot.getTransform();
%center = getWords(%bt, 0 ,2);

initContainerRadiusSearch(%center,1.0,$TypeMasks::WaterObjectType);
return containerSearchNext();
}
return 0;
}
#3
07/21/2006 (2:11 pm)
Nice! Well glad I could almost help ;)