Ai Questions

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
matt_moh
Sergeant
Posts: 65
Joined: Sat Feb 08, 2003 12:04 am

Ai Questions

Post by matt_moh »

I'm working on the finishing touches for my Spearhead level. It takes place on a moving train and is similar to a level form MOH Frontline. I have a couple of questions about how to do certain things with my AI:

1. What animations should I use if I want to make an AI sit down on a chair or the ground?

2. I have an allied soldier who I want to aim and fire at a particular spot.
This is what my script looks like for him:

level_start:
$cappy exec global/disable_ai.scr
$cappy aimat $enemy_1
while (isalive $enemy_1)
{
$cappy fire
wait .15
}
end

The allied soldier's bullets hit the right enemy but the soldier points his gun in the opposite direction. Is there any solution to this problem?

3. This may sound wierd, but is there any way to move a dead AI's corpse from one spot to another? I want to put a scripted event in my level where if you shoot a particular guy, he does a balcony death and falls off the train. The only problem is that when his dead body lands on the ground, it doesn't move with the rest of the scenery, it just sits at the same place where he died.

Any answers to these questiond will be a big help.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

1. Hmm don't know if Spearhead has any nice animations. For AA, models/human/animation/scripted/table.tik (in pak0.pk3) is the file to look at.

2. That's pertty weird :?. Is $cappy very close to the enemy?

3. Multiple ways to do that. Probably the easiest is the 'origin scripting'. Just change the origin of the character a bit every frame. You'd have to find out when he reaches the ground though :? Pretty complicated I think :(.

Anyway, the actual move script would be something like this:

Code: Select all

while(self)
{
    self.origin += (16 0 0) // move speed vector in units per 0.05 second
    wait 0.05
}
Not sure if the game allows += in this case. Otherwise type:
self.origin = self.origin + (16 0 0).

You'd have to play with the numbers. In this example, the guy would move 320 units / second in the positive x direction.

0.05 is the default server frame time. You could use 'waitframe' instead, but that might affect movement speed depending on server settings.
Image
matt_moh
Sergeant
Posts: 65
Joined: Sat Feb 08, 2003 12:04 am

Post by matt_moh »

Thanks for the help. Just a few more questions. Is it possible to use AA animations in Spearhead? I know that if you edit the ubersound file you can get sounds from AA to work in Spearhead. Do I have to edit anything for AA animations to work? Also, yes, the $cappy is very close to the enemy. I tried letting the $cappy just do his thing without any scripting assistance but he rarely shoots at the enemy. Is there another way I can make $cappy shoot at the enemy?
Post Reply