Hi guys,
I want to create my own AI at the moment, so it do exactly what I want and I not must use the standard overthought scripts which are more complicated to read and to understand than ever before.
So I tried to get my head into how it works and I have my first problem:
local searchPlr = 0
function hide_and_seek_init(e)
CharacterControlManual(e)
AIObjNo = g_Entity[e]['obj']
AISetEntityControl(AIObjNo,AI_MANUAL)
ai_bot_oldhealth[e] = g_Entity[e]['health']
ai_bot_substate[e] = 0
ai_bot_targetx[e] = nil
ai_bot_pointtime[e] = -1
ai_bot_patroltime[e] = 0
ai_bot_targetx[e] = g_Entity[e]['x']
ai_bot_targety[e] = g_Entity[e]['y']
ai_bot_targetz[e] = g_Entity[e]['z']
end
function hide_and_seek_main(e)
if searchPlr == 0 then
Prompt("Press E to search plr")
MoveForward(e,0.0)
end
if searchPlr == 1 then
Prompt("Press Q to stop search")
MoveForward(e,AIGetEntitySpeed(AIObjNo))
AIEntityGoToPosition(g_Entity[e]['obj'],g_PlayerPosX-100,g_Entity[e]['y'],g_PlayerPosZ-100)
end
if g_KeyPressE==1 then
searchPlr = 1
end
if g_KeyPressQ == 1 then
searchPlr = 0
end
end
This is my script and the AI should just go in the near of the player when I press E. It is a flat map with a single character.
But the AI just moves forward(I know there is the moveforward command).
Then I read the manual and it says:
This command sets the entity's destination to the specified position, the entity will immediately calculate a path to the new destination and begin moving towards it. If the destination lies inside an obstacle an attempt will be made to choose the closest point which is not inside an obstacle. If this fails, or the path to the destination is blocked completely by obstacles the entity will not move.
So did I miss something? Is the preview broken in this part? Or is it just my game guru?
I would be happy if someone can answer my question.
Ebe Editor Free - Build your own EBE structures with easy and without editing any text files
Thread and Download