PDA

View Full Version : Running ai?



Edward
11-04-2003, 02:55 PM
Hi!
How do I make an Actor run? I've tried AISetMoveSpeed(ai,2 or 1.5) and SetActorExtraSpeed(ai,5). No run animation. HELP!

/Edward

Hell Raiser
11-06-2003, 06:29 AM
Does it have a run animation defined in its puppet file?

------------------
-Blessed Be-
I know it's the last day on earth,
We'll be together while the planet dies.
DBZ: The Destruction is Real (http://www.hellraiser64.com/tdir)

lucky_jackpot
11-06-2003, 07:34 AM
Hi there http://forums.massassi.net/html/smile.gif

Umm... I take it that (hopefully) you're not actually using the symbol keyword "ai", because that could be one potential flaw... http://forums.massassi.net/html/wink.gif

Other than that, I've noticed that none of the character actors perform "running" all to well (but they manage to do it, when you force pull a weapon)... interesting *starts to delve a little bit deeper into charcter cogs, AI and puppet files...* http://forums.massassi.net/html/wink.gif

As Hell Raiser mentions, I dare-say there's something related to the puppet file, somewhere along the line... I've just yet to find it, at the moment http://forums.massassi.net/html/wink.gif

Hope this helps http://forums.massassi.net/html/biggrin.gif

-Jackpot

------------------
Are you feeling lucky, cuz if you are, get your hands off me... ;)

"Life is mostly froth and bubble,
But two things stand in stone,
Kindness in another's trouble,
Courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

Edward
11-07-2003, 12:00 AM
The actors I've set these for are Men, Women, and Grans. I know they can run cause I gave them a SetThingVel when created. And from the view I have, when they come thrusting into view, they start off running but then slow down. I do see the running animation, but the go over to walking almost imedietly...

LordVirus
11-07-2003, 04:39 PM
That's just silly. SetThingVel?!

The best way to make an actor move is with AiSetMovePos(thing ref,vector); or AiSetMoveThing(thing ref, chase thing);

and

AiSetLookPos(thing ref,vector);

The code would be something like this:




AISetMoveSpeed(ai,2);
AiSetMoveThing(ai,MoveThing);
AiSetLookPos(ai,GetThingPos(MoveThing));



Or, if you just want the AI to run forward,



startup:
SetPulse(0.05);
return;
pulse:
MoveTo=FireProjectile(ai,nullshot,0,0,'0 1 0',0,0,0,1,1);
AISetMoveSpeed(ai,2);
AiSetMoveThing(ai,MoveTo);
AiSetLookPos(ai,GetThingPos(MoveTo));
return;


This requires that you make a template for nullshot that has a very short timer, no model or a homemade null model, no damage, no collision, and no velocity. But the actor will always run forwards, forever and ever.

Just note, I'm not exactly sure on whether the code will work or not, I don't have any of my old reference material here.

You can easily modify this code to make the actor behave in an almost animalistic way, trying to get to certain objectives by avoiding walls and such. I've made some very good pathfinding AI that way. Think BEAM robots, only more complex.

------------------
His pot is blacker than his kettle!

Phoenix Swords (http://www.phoenixswords.com)

Edward
11-08-2003, 04:55 AM
Well, I only used SetThingVel to get the people into view. Did you know that if an AI is outside the view, it won't react to the AISetMove{Pos,Thing}?

Anyway, this is the code I have.


# The big audience running!
#
# By Edward
symbols

message startup
message pulse
message entered

thing place0
thing place1
thing place2
thing place3
thing place4
thing place5
thing place6
thing place7
thing place8
thing place9
thing place10
thing place11
thing place12
thing place13
thing place14
thing place15
thing place16
thing place17
thing place18
thing place19
thing place20
thing place21
thing place22
thing place23
thing place24
thing place25
thing place26

template type0
template type1
template type2
template type3
template type4
template type5
template type6
template type7
template type8
template type9
template type10
template type11
template type12
template type13
template type14
template type15

sector ender0 mask=0xFFF
sector ender1 mask=0xFFF
sector ender2 mask=0xFFF
sector ender3 mask=0xFFF

thing i local

int z local

end
#
code
startup:
SetPulse(0.25);
return;
pulse:
i=CreateThing(type0[rand()*15],place0[rand()*26]);
CaptureThing(i);
SetThingVel(i,'0 -1 0');
AISetMode(i, 0x2000);
sleep(0.05);
AISetMoveSpeed(i,2);
AISetMovePos(i,VectorSet((rand()*2.00)-1.00,-7,0));
sleep(0.05);
SetActorExtraSpeed(i, 5);
return;
entered:
for(z=0; z<4; z=z+1) {
If(GetSenderRef()==ender0[z]) {
DestroyThing(GetSourceRef()); } }
return;
end

What I'm aiming for here is panicing people running away from a big something rather!