Game Development Community

A few questions

by Alexander B · in General Add-On Discussion · 12/01/2009 (2:29 am) · 11 replies

For some reason the AI weapon doesn't work. I have followed the steps for putting in a new weapon but it won't fire at me and I am very confused why. I am using tge 1.5.2 and I am using a gun called BlasterGun. It is exed in game.cs and everything so It should work. So what could be wrong?

#1
12/01/2009 (2:56 am)
First make sure the weapon is working in general by testing it on your player character. Now assuming that the player can properly fire the weapon, I have a few questions. Can you see the bot holding the weapon or is it not showing at all? If you can see the weapon and the bot still isn't firing at you, the problem is most likely not due to the weapon at all. Is the bot on your team or in the teammate behavior mode? By default, the player is on team one.

EDIT: Almost forget to mention that you should check your console log and post any errors (related to the AI) that you have.
#2
12/01/2009 (4:45 am)
Well the gun works on the player and other bots from the game mechanics kit so it does work. I can see the weapon in the bots hand but as I said it does not attack me.

Here are 2 errors I am getting that may be related to the problem:

starter.fps/server/scripts/aiPlayer.cs (1955): Unable to find object: 'TeamSet1' attempting to call function 'getCount'

Object (2324) AIPlayer -> Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
#3
12/01/2009 (5:00 am)
The problem is a team related issue, not a weapon issue. Make sure your bot is on team 2 and not set to the teammate behavior mode.

In the custom TGE install instructions, double check steps 3 and 6 (actually recheck everything, but it's mostly likely one of those two).
#4
12/01/2009 (5:08 am)
Ok thanks, I will go over step 3 and 6 as I have made sure the bot is team 2. I will post an update soon.
#5
12/01/2009 (5:34 am)
Yay it works. I just used the game.cs from the univeral ai kit and edited the game.cs so it works for my game and now the ai works. Thanks so much for your help and I am glad I bought the kit.

EDIT: 1 more question hehe. How do I stop the aiguard from moving around. I want it to just stay at the same place but if there is a player I want it to chase the player, I just don't want it to start randomly movin around.
#6
12/01/2009 (6:03 am)
Change the value of $AISK_MAX_PACE or "paceDist" (called "Pace" in the editor) on the marker or datablock to be 0.
#7
12/01/2009 (6:23 am)
That worked as well. Thanks for your great quick help :) I will put you in the credits if you email me your name and I will also make sure the univeral ai kit gets in as well.
#8
12/01/2009 (11:19 pm)
Just as I thought everything was working 2 errors come up :( First the ai, after like 10 seconds or so will start changing directions really fast (so i can't sneak up on the ai) but not walk anywhere of course. Also when I spawn the ai 2 come out. I have no idea what is causing both of these probelms but I hope you know.
#9
12/01/2009 (11:40 pm)
1- Try setting: $AISK_ENHANCEFOV_CHANCE = 0;
If that doesn't fix it, this might be another symptom of your second problem.

2- Two bots are spawning because, at some point, you are accidently spawning the bots twice. By default, the bots are spawned in game.cs with code that looks like: AIPlayer::actionByGroup("all", "spawn");
But you must have that code in two places (possible in different files).

On a side note: Would you mind changing the title of this topic? Currently it's both inaccurate and bad for marketing. I don't want people to think that the kit has such bad weapons functionality that it takes 10+ replies to fix it.
#10
12/02/2009 (12:06 am)
Changed the title just then but don't worry to much as it shows how helpful you are. I am at school now but when I get home I will do as you said and search for that second line. Any guesses where i may of put the second line?
#11
12/02/2009 (6:48 pm)
Both problems are now solved. I solved the first problem by making all the lines in aiplayer.cs

The second problem turned out to never be a problem. I just clicked apply+respawn twice which made me feel pretty stupid. Anyway thanks for your help once again and be sure to email me if you want to be in the credits. I will use this thread if I ever have any more questions and other people can use it as well.