Adding new AI
by Stephen · in Game Mechanics Kit · 08/25/2009 (11:24 pm) · 1 replies
So I have a new model for my enemy AI and would like to know how to add the new AI to GMK. Also I would like to have this AI charge at the player and attack them. So where should I start? I know I need to first at melee to GMK but I'm not sure about the scripting for GMK.
Torque Owner Yuri Dobronravin
Logicking
The best way to check this is to setup datablock inherited DefaultPlayerData for your model and run your character as player controlled. See players/BoomBot.cs for example.
2) Take a look at server/logickingMechanics/SampleObjects/spaceOrcBot.cs
You can use this file as a starting point to create your own AI. Refer to Desiner's Guide AiBot section for meaning of specific params of AiBot.
3) The easiest way to get AI attacking your player is to call from scripts %bot.setEnemy($playerForAi). %bot is a reference to your AI, can be name just like SpaceOrcBot01. $playerForAi is equal to LocalClientConnection.getControlObject() - a variable for current client player (won't work over the network though).
You can also activate AI from a trigger, use this video as tutorial.