LUA Script
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Zombie character script v1.00
function zombie_main(e)
-- Get player distance from zombie
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX; PlayerDY = g_Entity[e]['y'] - g_PlayerPosY; PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));
-- Zombie unaware of player
if PlayerDist > 800 and PlayerDist < 1000 and g_Entity[e]['animating'] == 0 then
-- Play one of the idle animations (31-34)
SetAnimation(34); PlayAnimation(e); g_Entity[e]['animating'] = 1;
end
-- Zombie aware of player. Starts running at player
if PlayerDist > 200 and PlayerDist < 800 and g_Entity[e]['animating'] == 0 then
-- Play one of the run animations (5,6,29,30)
SetAnimation(29); PlayAnimation(e); g_Entity[e]['animating'] = 1;
end
-- Zombie attacking player. Start melee attack
if PlayerDist < 200 and g_Entity[e]['animating'] == 0 then
-- Play one of the attacks animations randomly (35,36,37,38)
rnd = math.random(35,38);
SetAnimation(rnd); PlayAnimation(e); g_Entity[e]['animating'] = 1;
end
end
I used Mender and Animer to convert the models.
Fpe file for one of the zombies.
;header
desc = German Zombie 1
;visualinfo
textured = germanzombie1_d.dds
effect = effectbank\reloaded\character_basic.fx
castshadow = 0
;orientation
model = germanzombie1.X
offx = 0
offy = 0
offz = 0
rotx = 0
roty = 0
rotz = 0
defaultstatic = 0
materialindex = 0
;statistics
strength = 100
explodable = 0
debrisshape = 0
;ai
aiinit = appear.lua
aimain = zombie.lua
aidestroy = disappear.lua
;spawn
spawnmax = 0
spawndelay = 0
spawnqty = 0
;anim
animmax = 45
;INITIAL POSE
anim0 = 0,0
;WALK LEAN BACK
anim1 = 1158,1188
;WALK -ANIM2 RESERVED FOR WAYPOINTS!
anim2 = 1107,1137
;WALK ARMS OUT
anim3 = 1208,1238
;MARCH
anim4 = 1259,1306
;RUN 1
anim5 = 1334,1355
;RUN2
anim6 = 1362,1383
;BODY HIT 1
anim7 = 1394,1464
;BODY HIT 2
anim8 = 1504,1595
;BODY HIT 3 - probably won't use
anim9 = 1610,1658
;HEADSHOT 1
anim10 = 1685,1757
;HEADSHOT2
anim11 = 1780,1883
;HEADSHOT 3
anim12 = 1900,2011
;LEFT ARM HIT 1
anim13 = 2020,2148
;LEFT ARM HIT 2
anim14 = 2215,2291
;LEFT LEG DIE 1
anim15 = 2350,2415
;LEFT LEG DIE 2
anim16 = 2500,2669
;RIGHT ARM HIT 1
anim17 = 2780,2870
;RIGHT ARM HIT 2
anim18 = 2980,3087
;RIGHT LEG DIE 1
anim19 = 3140,3205
;RIGHT LEG DIE 2
anim20 = 3300,3469
;LEFT LEG HIT TO PRONE
anim21 = 3578,3647
;RIGHT LEG HIT TO PRONE
anim22 = 3709,3779
;PRONE
anim23 = 3818,3818
;UP FROM PRONE
anim24 = 3819,3864
;PRONE ATTACK
anim25 = 3865,3912
;PRONE DIE
anim26 = 3913,3967
;CRAWL REACH
anim27 = 3973,3993
;CRAWL PULL
anim28 = 3994,4013
;ORIGINAL ZOMBIE APOC ANIMS
;GIRL RUN
anim29 = 8,28
;MALE RUN
anim30 = 8,28
;IDLE 1
anim31 = 38,98
;IDLE 2
anim32 = 105,164
;IDLE 3
anim33 = 172,231
;IDLE 4
anim34 = 239,298
;DOUBLE ARM SLASH
anim35 = 304,392
;SINGLE ARM SLASH
anim36 = 407,459
;OVERHEAD SLASH LEFT
anim37 = 473,536
;OVERHEAD SLASH RIGHT
anim38 = 551,615
;RAGE 1
anim39 = 629,687
;RAGE 2
anim40 = 701,760
;BOUNCE FALL
anim41 = 773,849
;FACEPLANT
anim42 = 869,932
;FALLBACK
anim43 = 946,1001
;FALLSIDE
anim44 = 1030,1101
playanimineditor = 0