Ai player fire weapon.
by Danny Goss · in Torque Game Engine · 03/03/2004 (6:17 am) · 11 replies
I am having problems getting my bot to fire its weapon. The problem is I can't find anything on it. I've looked at some tutorial's and it looks like setTrigger(0, true); should cause the weapon to fire, but I cannot find any reference to setTrigger. I've found setTriggerImage, but I cannot figure out how it works or if this even what I need. I just want the bot to fire it's weapon. Right now I don't care about aiming, I just want it to shoot.
What I have is two bots running big circles around building hitting waypoints. What I want is the bots to fire each time they hit a waypoint. I know where in the script to put fire command, I just don't know what the command is. Can anyone point me in a direction? Thanks for any help. If you cannot tell by this trivial problem, Yes, I am a NEWBIE :).
What I have is two bots running big circles around building hitting waypoints. What I want is the bots to fire each time they hit a waypoint. I know where in the script to put fire command, I just don't know what the command is. Can anyone point me in a direction? Thanks for any help. If you cannot tell by this trivial problem, Yes, I am a NEWBIE :).
#2
03/03/2004 (6:25 am)
Heh, dbbl post
#3
Try this resource:
tork.beffy.de/_tutorials/AI/bots/advanced_bots.php
03/03/2004 (6:34 am)
Hi Daniel;Try this resource:
tork.beffy.de/_tutorials/AI/bots/advanced_bots.php
#4
Ace: What's the difference between adding aiplayer.h to the project and it being included in aiplayer.cc?
Kimberly: Thanks. That is the tutorial I had, except for the minor little update about setImageTrigger. I will play with it and see if I can figure out how setImageTrigger works.
03/03/2004 (6:55 am)
Thanks,Ace: What's the difference between adding aiplayer.h to the project and it being included in aiplayer.cc?
Kimberly: Thanks. That is the tutorial I had, except for the minor little update about setImageTrigger. I will play with it and see if I can figure out how setImageTrigger works.
#5
If you get this all working please post what you find out. I'm have problems with this too. I'm tring to get the Bot to shoot at the player and it just won't work.
03/03/2004 (10:52 am)
Daniel;If you get this all working please post what you find out. I'm have problems with this too. I'm tring to get the Bot to shoot at the player and it just won't work.
#6
03/03/2004 (1:34 pm)
Sure thing Kimberly. I don't know when that may be. I don't get to work on it but a couple hours a week.
#7
I posted some console code in the thread below that shows some aiPlayer stuff you can do just with the built in fps demo (I believe):
www.garagegames.com/mg/forums/result.thread.php?qt=16329
Basically you need to mount a weapon image, add some ammo, and then call setImageTrigger(0,1) to start firing. setImageTrigger(0,0) should stop.
-Pascal
03/03/2004 (6:23 pm)
Hey, I posted some console code in the thread below that shows some aiPlayer stuff you can do just with the built in fps demo (I believe):
www.garagegames.com/mg/forums/result.thread.php?qt=16329
Basically you need to mount a weapon image, add some ammo, and then call setImageTrigger(0,1) to start firing. setImageTrigger(0,0) should stop.
-Pascal
#8
I got that working last night. setImageTrigger(0, true); fires the weapon. The main thing that helped me was the dump() functions. I was using a tutorial I downloaded as a base, and the ai extensions tutorial. My problem was in the ai tutorial the line to fire was %this.setImageTrigge(0, true);, but in the function of the aiplayer script it should have been
%obj.setImageTrigger(0, true);. I am assuming that the first parameter in setImageTrigger specifies which mounted weapon to fire. The second parameter pulls the trigger when it is true, and releases the trigger when it is false.
03/04/2004 (6:40 am)
Yea, I got that working last night. setImageTrigger(0, true); fires the weapon. The main thing that helped me was the dump() functions. I was using a tutorial I downloaded as a base, and the ai extensions tutorial. My problem was in the ai tutorial the line to fire was %this.setImageTrigge(0, true);, but in the function of the aiplayer script it should have been
%obj.setImageTrigger(0, true);. I am assuming that the first parameter in setImageTrigger specifies which mounted weapon to fire. The second parameter pulls the trigger when it is true, and releases the trigger when it is false.
#10
You are correct in the the first parameter is for the slot the weapon is mounted in and the second parameter controls firing.
True = fire
False = check fire
03/04/2004 (10:02 am)
No, not much as I already have the setImageTrigger() being called by the Bot object.You are correct in the the first parameter is for the slot the weapon is mounted in and the second parameter controls firing.
True = fire
False = check fire
#11
When the target enters the Bots LOS it starts firing and it stops when it exits by using the setImageTriger(0,true) and setImageTriger(0,false).
03/09/2004 (1:09 pm)
I got the Bot to fire correctly. I needed to setup the enter and exit LOS for the AttackTarget and FollowTarget.When the target enters the Bots LOS it starts firing and it stops when it exits by using the setImageTriger(0,true) and setImageTriger(0,false).
Torque Owner Ace