Hi,
Finally groping, I managed to improve everything.
I change the FPE file, then I create change the LUA script related scorpio.
But the only problem is that advance back (as the above pictures).
If you have an idea to solve this problem I thank you =)
LUA Script (ai_scorpio.lua) :
-- LUA Script - precede every function and global member with lowercase name of script
attackstart = {}
attackend = {}
damageframestart = {}
damageframeend = {}
lastroar = {}
lastswipe = {}
function ai_scorpio_init(e)
ai_soldier_state[e] = "patrol"
ai_soldier_pathindex[e] = -1
SetAnimationFrames(0,30)
LoopAnimation(e)
ModulateSpeed(e,1.0)
SetAnimationSpeed(e,1.0)
attackstart[e]=62
attackend[e]=123
damageframestart[e]=124
damageframeend[e]=139
lastroar[e] = 0
lastswipe[e] = 0
ai_old_health[e] = -1
SetCharacterSoundSet(e)
end
function ai_scorpio_main(e)
PlayerDist = GetPlayerDistance(e)
EntObjNo = g_Entity[e]['obj']
if ai_soldier_state[e] == "patrol" then
if ai_soldier_pathindex[e] == -1 then
ai_soldier_pathindex[e] = -2
CharacterControlArmed(e)
PathIndex = -1
PathPointIndex = -1
pClosest = 99999
for pa = 1, AIGetTotalPaths(), 1 do
for po = 1 , AIGetPathCountPoints(pa), 1 do
pDX = g_Entity[e]['x'] - AIPathGetPointX(pa,po)
pDZ = g_Entity[e]['z'] - AIPathGetPointZ(pa,po)
pDist = math.sqrt(math.abs(pDX*pDX)+math.abs(pDZ*pDZ))
if pDist < pClosest and pDist < 200 then
pClosest = pDist
PathIndex = pa
PathPointIndex = po
end
end -- po
end -- pa
if PathIndex > -1 then
ai_soldier_pathindex[e] = PathIndex
ai_path_point_index[e] = PathPointIndex
ModulateSpeed(e,1.0)
SetCharacterToWalk(e)
ai_path_point_direction[e] = 1
ai_path_point_max[e] = AIGetPathCountPoints(ai_soldier_pathindex[e])
end
end
if ai_soldier_pathindex[e] > -1 then
ai_patrol_x[e] = AIPathGetPointX(ai_soldier_pathindex[e],ai_path_point_index[e])
ai_patrol_z[e] = AIPathGetPointZ(ai_soldier_pathindex[e],ai_path_point_index[e])
AIEntityGoToPosition(EntObjNo,ai_patrol_x[e],ai_patrol_z[e])
tDistX = g_Entity[e]['x'] - ai_patrol_x[e]
tDistZ = g_Entity[e]['z'] - ai_patrol_z[e]
DistFromPath = math.sqrt(math.abs(tDistX*tDistX)+math.abs(tDistZ*tDistZ))
if DistFromPath < 50 then
if ai_path_point_direction[e] == 1 then
ai_path_point_index[e] = ai_path_point_index[e] + 1
if ( ai_path_point_index[e] > ai_path_point_max[e] ) then
ai_path_point_index[e] = ai_path_point_max[e] - 1
ai_path_point_direction[e] = 0
end
else
ai_path_point_index[e] = ai_path_point_index[e] - 1
if ( ai_path_point_index[e] < 1 ) then
ai_path_point_index[e] = 2
ai_path_point_direction[e] = 1
end
end
end
end
end
if PlayerDist < 900 then
if GetPlayerDistance(e)<100 then
if ai_soldier_state[e] ~= "attack" then
AIEntityStop(EntObjNo)
ai_soldier_state[e] = "attack"
CharacterControlLimbo(e)
SetAnimationFrames(62,92)
LoopAnimation(e)
end
else
if ai_soldier_state[e] ~= "charge" then
ai_soldier_state[e] = "charge"
CharacterControlArmed(e)
SetCharacterToWalk(e)
ModulateSpeed(e,1.5)
end
end
if ai_soldier_state[e] == "charge" then
RotateToPlayer(e)
AIEntityGoToPosition(EntObjNo,g_PlayerPosX,g_PlayerPosZ)
end
if ai_soldier_state[e] == "attack" then
RotateToPlayer(e)
if GetAnimationFrame(e)>damageframestart[e] and GetAnimationFrame(e)<damageframeend[e] then
if GetPlayerDistance(e)<100 then
PlaySound(e,1)
HurtPlayer(e,1)
end
end
end
end
if ai_old_health[e]==-1 then
ai_old_health[e] = g_Entity[e]['health']
end
if g_Entity[e]['health'] < ai_old_health[e] then
ai_old_health[e] = g_Entity[e]['health']
PlayCharacterSound(e,"onHurt")
end
if PlayerDist >= 900 and ai_soldier_state[e]~="patrol" then
ai_soldier_state[e] = "patrol"
SetCharacterToWalk(e)
ModulateSpeed(e,1.0)
end
end
function ai_fantasycharacter_exit(e)
PlayCharacterSound(e,"onDeath")
CollisionOff(e)
end
FPE Files :
;header
desc = Scorpion
;visualinfo
textured = body_D.dds
effect = effectbank\reloaded\character_basic.fx
castshadow = 0
;orientation
model = scorpio.X
offx = 0
offy = 0
offz = 0
rotx = 0
roty = 0
rotz = 0
defaultstatic = 0
materialindex = 6
collisionmode = 21
fixnewy = 0
ragdoll = 1
skipfvfconvert = 1
;Sound
soundset =
soundset1 =
;identity details
ischaracter = 1
hasweapon =
isobjective = 0
cantakeweapon = 0
;headlimbs
;headlimbs = 0,30
;statistics
strength = 100
explodable = 0
debrisshape = 0
;decal
decalmax = 0
;ai
aimain = ai_scorpio.lua
;spawn
spawnmax = 0
spawndelay = 0
spawnqty = 0
;anim
animspeed = 100
animmax = 1
anim0 = 0,30
playanimineditor = 1
;AIAnims
csi_relaxed1 = 0,30
csi_relaxed2 = 0,30
csi_relaxedmovefore = 62,92
csi_cautious = 62,92
csi_cautiousmovefore = 62,92
;csi_unarmed1 = 31,61
;csi_unarmed2 = 31,61
csi_unarmed1 = 62,92
csi_unarmed2 = 62,92
csi_unarmedconversation =
csi_unarmedexplain =
csi_unarmedpointfore =
csi_unarmedpointback =
csi_unarmedpointleft =
csi_unarmedpointright =
csi_unarmedmovefore = 31,61
csi_unarmedmoverun = 31,61
csi_unarmedstairascend =
csi_unarmedstairdecend =
csi_unarmedladderascend1 =
csi_unarmedladderascend2 =
csi_unarmedladderascend3 =
csi_unarmedladderdecend1 =
csi_unarmedladderdecend2 =
csi_unarmeddeath =
csi_unarmedimpactfore =
csi_unarmedimpactback =
csi_unarmedimpactleft =
csi_unarmedimpactright =
csi_inchair =
csi_inchairsit =
csi_inchairgetup =
csi_swim =
csi_swimmovefore =
csi_stoodnormal = 124,139
csi_stoodrocket =
csi_stoodfidget1 = 124,139
csi_stoodfidget2 = 124,139
csi_stoodfidget3 = 124,139
csi_stoodfidget4 = 124,139
csi_stoodstartled =
csi_stoodpunch =
csi_stoodkick =
csi_stoodmovefore = 31,61
csi_stoodmoveback = 31,61
csi_stoodmoveleft = 31,61
csi_stoodmoveright = 31,61
csi_stoodstepleft =
csi_stoodstepright =
csi_stoodstrafeleft =
csi_stoodstraferight =
csi_stoodturnleft =
csi_stoodsubtleturnleft =
csi_stoodvault =
csi_stoodmoverun = 31,61
csi_stoodmoverunleft = 31,61
csi_stoodmoverunright = 31,61
csi_stoodreload =
csi_stoodreloadrocket =
csi_stoodwave =
csi_stoodtoss =
csi_stoodfirerocket =
csi_stoodincoverleft =
csi_stoodincoverpeekleft =
csi_stoodincoverthrowleft =
csi_stoodincoverright =
csi_stoodincoverpeekright =
csi_stoodincoverthrowright =
csi_crouchidlenormal1 =
csi_crouchidlenormal2 =
csi_crouchidlerocket =
csi_crouchdown =
csi_crouchdownrocket =
csi_crouchrolldown =
csi_crouchrollup =
csi_crouchmovefore =
csi_crouchmoveback =
csi_crouchmoveleft =
csi_crouchmoveright =
csi_crouchmoverun =
csi_crouchreload =
csi_crouchreloadrocket =
csi_crouchwave =
csi_crouchtoss =
csi_crouchfirerocket =
csi_crouchimpactfore =
csi_crouchimpactback =
csi_crouchimpactleft =
csi_crouchimpactright =
csi_crouchgetup =
csi_crouchgetuprocket =
Unfortunately I can not give you the complete scorpion because the object is not free.
But you can buy on the link posted first.
Thanks you !