Thanks, i haven't actually changed it that much atm (was working with your character_waypoint script)
I changed the animations, and was going to try to add a sprite to the convo i am actually going to use both if i can m8 as they both have their own merits
But tbh i like the character_waypoint script without the waypoint if you get me so as i could have a few freeroaming characters that just stop when the player is close and engage in convo. P.s ive noticed in that script that they should face the player but don't is that correct m8?
local destx = {}
local desty = {}
local destz = {}
function ai_freeroam_init(e)
CharacterControlManual(e)
destx[e] = g_Entity[e]['x']+math.random(-1000,1000)
desty[e] = g_Entity[e]['y']
destz[e] = g_Entity[e]['z']+math.random(-1000,1000)
ai_bot_state[e] = "roam"
end
function ai_freeroam_main(e)
if ai_bot_state[e] == "roam" then
if GetDistanceToPoint(e,destx[e],destz[e]) < 100 then
destx[e] = g_Entity[e]['x']+math.random(-1000,1000)
desty[e] = g_Entity[e]['y']
destz[e] = g_Entity[e]['z']+math.random(-1000,1000)
else
AIEntityGoToPosition(g_Entity[e]['obj'],destx[e],desty[e],destz[e])
MoveForward(e,AIGetEntitySpeed(g_Entity[e]['obj']))
SetRotation(e,0,AIGetEntityAngleY(g_Entity[e]['obj']),0)
AISetEntityPosition(g_Entity[e]['obj'],GetEntityPositionX(e),GetEntityPositionY(e),GetEntityPositionZ(e))
if g_Entity[e]['animating'] > 0 then
if g_Entity[e]['animating'] ~= 3 then
StopAnimation(e)
end
else
SetAnimationFrames(3870,3900)
LoopAnimation(e)
g_Entity[e]['animating'] = 3
end
end
if g_Entity[e]['plrvisible'] == 1 or AIGetEntityHeardSound(g_Entity[e]['obj']) == 1 or GetPlayerDistance(e) < AIGetEntityViewRange(g_Entity[e]['obj'])*0.1 then
ai_bot_state[e] = "move to player"
end
elseif ai_bot_state[e] == "move to player" then
if g_Entity[e]['plrvisible'] == 1 then
destx[e] = g_PlayerPosX
desty[e] = g_PlayerPosY
destz[e] = g_PlayerPosZ
end
if (GetPlayerDistance(e) > AIGetEntityViewRange(g_Entity[e]['obj'])*0.25 or g_Entity[e]['plrvisible'] == 0) then
if g_Entity[e]['animating'] ~= 2 then
if GetDistanceToPoint(e,destx[e],destz[e]) > 100 then
AIEntityGoToPosition(g_Entity[e]['obj'],destx[e],desty[e],destz[e])
MoveForward(e,AIGetEntitySpeed(g_Entity[e]['obj'])*2)
SetRotation(e,0,AIGetEntityAngleY(g_Entity[e]['obj']),0)
AISetEntityPosition(g_Entity[e]['obj'],GetEntityPositionX(e),GetEntityPositionY(e),GetEntityPositionZ(e))
if g_Entity[e]['animating'] > 0 then
if g_Entity[e]['animating'] ~= 1 then
StopAnimation(e)
end
else
SetAnimationFrames(3870,3900)
LoopAnimation(e)
g_Entity[e]['animating'] = 1
end
else
ai_bot_state[e] = "roam"
end
else
AIEntityStop(g_Entity[e]['obj'])
SetRotation(e,0,AngleToPoint(e,g_PlayerPosX,g_PlayerPosZ),0)
AISetEntityPosition(g_Entity[e]['obj'],GetEntityPositionX(e),GetEntityPositionY(e),GetEntityPositionZ(e))
FireWeapon(e)
end
else
AIEntityStop(g_Entity[e]['obj'])
SetRotation(e,0,AngleToPoint(e,g_PlayerPosX,g_PlayerPosZ),0)
AISetEntityPosition(g_Entity[e]['obj'],GetEntityPositionX(e),GetEntityPositionY(e),GetEntityPositionZ(e))
if g_Entity[e]['animating'] > 0 then
if g_Entity[e]['animating'] ~= 2 then
StopAnimation(e)
end
else
SetAnimationFrames(3110,3420)
-- was going to try to add a sprite here to work with the coversation animation
PlayAnimation(e)
g_Entity[e]['animating'] = 2
end
-- FireWeapon(e)
end
end
end
function ai_freeroam_exit(e)
end
function GetDistanceToPoint(e,x,z)
if g_Entity[e] ~= nil and g_Entity[e] ~= 0 then
local disx = GetEntityPositionX(e) - x
local disz = GetEntityPositionZ(e) - z
return math.sqrt(disx^2 + disz^2)
end
end
function AngleToPoint(e,x,z)
if g_Entity[e] ~= nil and x > 0 and z > 0 then
local destx = x - g_Entity[e]['x']
local destz = z - g_Entity[e]['z']
local angle = math.atan2(destx,destz)
angle = angle * (180.0 / math.pi)
if angle < 0 then
angle = 360 + angle
elseif angle > 360 then
angle = angle - 360
end
--SetRotation(e,0,angle,0)
return angle
end
end
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel
I only smile because i have absolutely no idea whats going on