Page 1 of 1
Custom mosters attack animation playing only 2 frames
Posted: Thu Feb 16, 2017 4:02 pm
by Eliont
Hello and good time of day.
Doing new monters for my mod and have strange problem - some spritesheets working as intended, though others playing only first two frames of attack animation. Its all right with "run" and "die" animation in both cases.
Deleting cache was not solve the problem.
Working well: youtu.be/BT_Pod3HyZw
Working wrong: yadi.sk/i/HdrQ0px13EAXi2
Same animation script, only difference is file.
Someone know what the matter?
Thanks in advance.
Re: Custom mosters attack animation playing only 2 frames
Posted: Thu Feb 16, 2017 9:48 pm
by Adil
Prototypes definitions are hard, and do you expect people to just guess what did you do wrong?
The files have different numbers of frames, the attack speed may be high.
Re: Custom mosters attack animation playing only 2 frames
Posted: Fri Feb 17, 2017 1:34 am
by Eliont
Nothing so hard in definition, at least for monsters. Except i don't get what field "order" do.
butcher.lua Code: Select all
require ("prototypes.entity.demo-enemy-sounds")
require ("functions")
local name = 'butcher'
local size = 128
local height = size
local width = size
local scale = 1
animation_data[name] = {}
animation_data[name]['run'] = {}
animation_data[name]['run']['name'] = name
animation_data[name]['run']['action'] = 'run'
animation_data[name]['run']['height'] = height
animation_data[name]['run']['width'] = width
animation_data[name]['run']['frame_count'] = 8
animation_data[name]['run']['direction_count'] = 8
animation_data[name]['run']['scale'] = scale
animation_data[name]['run']['animation_speed'] = 0.1
animation_data[name]['attack'] = {}
animation_data[name]['attack']['name'] = name
animation_data[name]['attack']['action'] = 'attack'
animation_data[name]['attack']['height'] = height
animation_data[name]['attack']['width'] = width
animation_data[name]['attack']['frame_count'] = 12
animation_data[name]['attack']['direction_count'] = 8
animation_data[name]['attack']['scale'] = scale
animation_data[name]['attack']['animation_speed'] = 0.1
animation_data[name]['die'] = {}
animation_data[name]['die']['name'] = name
animation_data[name]['die']['action'] = 'die'
animation_data[name]['die']['height'] = height
animation_data[name]['die']['width'] = width
animation_data[name]['die']['frame_count'] = 15
animation_data[name]['die']['direction_count'] = 8
animation_data[name]['die']['scale'] = scale
animation_data[name]['die']['animation_speed'] = 0.1
data:extend(
{
{
type = "unit",
name = "fw-"..name,
icon = "__base__/graphics/icons/small-biter.png",
flags = {"placeable-player", "placeable-enemy", "placeable-off-grid", "breaths-air"},
max_health = 15,
order = "b-b-a",
subgroup="enemies",
healing_per_tick = 0.01,
collision_box = {{-0.5, -0.5}, {0.5, 0.5}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
attack_parameters =
{
type = "projectile",
range = 0.5,
cooldown = 35,
ammo_category = "melee",
ammo_type = make_unit_melee_ammo_type(6),
sound = make_biter_roars(0.5),
animation = animate(animation_data[name]['attack'])
},
vision_distance = 30,
movement_speed = 0.1,
distance_per_frame = 0.1,
pollution_to_join_attack = 200,
distraction_cooldown = 300,
corpse = "fw-"..name.."-corpse",
dying_explosion = "",
dying_sound = make_biter_dying_sounds(1.0),
working_sound = make_biter_calls(0.7),
run_animation = animate(animation_data[name]['run'])
},
{
type = "corpse",
name = "fw-"..name.."-corpse",
icon = "__fantasy_warfare__/graphics/"..name.."/corpse.png",
selection_box = {{-0.8, -0.8}, {0.8, 0.8}},
selectable_in_game = false,
subgroup="corpses",
order = "c[corpse]-a[biter]-a[small]",
flags = {"placeable-neutral", "placeable-off-grid", "building-direction-8-way", "not-repairable", "not-on-map"},
dying_speed = 0.01,
time_before_removed = 15 * 60 * 60,
final_render_layer = "corpse",
animation = animate(animation_data[name]['die'])
}
})
crystalwalker.lua Code: Select all
require ("prototypes.entity.demo-enemy-sounds")
require ("functions")
local name = 'crystalwalker'
local size = 125
local height = size
local width = size
local scale = 1
animation_data[name] = {}
animation_data[name]['run'] = {}
animation_data[name]['run']['name'] = name
animation_data[name]['run']['action'] = 'run'
animation_data[name]['run']['height'] = height
animation_data[name]['run']['width'] = width
animation_data[name]['run']['frame_count'] = 8
animation_data[name]['run']['direction_count'] = 8
animation_data[name]['run']['scale'] = scale
animation_data[name]['run']['animation_speed'] = 0.1
animation_data[name]['attack'] = {}
animation_data[name]['attack']['name'] = name
animation_data[name]['attack']['action'] = 'attack'
animation_data[name]['attack']['height'] = height
animation_data[name]['attack']['width'] = width
animation_data[name]['attack']['frame_count'] = 8
animation_data[name]['attack']['direction_count'] = 8
animation_data[name]['attack']['scale'] = scale
animation_data[name]['attack']['animation_speed'] = 0.05
animation_data[name]['die'] = {}
animation_data[name]['die']['name'] = name
animation_data[name]['die']['action'] = 'die'
animation_data[name]['die']['height'] = height
animation_data[name]['die']['width'] = width
animation_data[name]['die']['frame_count'] = 5
animation_data[name]['die']['direction_count'] = 8
animation_data[name]['die']['scale'] = scale
animation_data[name]['die']['animation_speed'] = 0.1
data:extend(
{
{
type = "unit",
name = "fw-"..name,
icon = "__base__/graphics/icons/small-biter.png",
flags = {"placeable-player", "placeable-enemy", "placeable-off-grid", "breaths-air"},
max_health = 15,
order = "b-b-a",
subgroup="enemies",
healing_per_tick = 0.01,
collision_box = {{-0.5, -0.5}, {0.5, 0.5}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
attack_parameters =
{
type = "projectile",
range = 0.5,
cooldown = 35,
ammo_category = "melee",
ammo_type = make_unit_melee_ammo_type(6),
sound = make_biter_roars(0.5),
animation = animate(animation_data[name]['attack'])
},
vision_distance = 30,
movement_speed = 0.1,
distance_per_frame = 0.1,
pollution_to_join_attack = 200,
distraction_cooldown = 300,
corpse = "fw-"..name.."-corpse",
dying_explosion = "",
dying_sound = make_biter_dying_sounds(1.0),
working_sound = make_biter_calls(0.7),
run_animation = animate(animation_data[name]['run'])
},
{
type = "corpse",
name = "fw-"..name.."-corpse",
icon = "__fantasy_warfare__/graphics/"..name.."/corpse.png",
selection_box = {{-0.8, -0.8}, {0.8, 0.8}},
selectable_in_game = false,
subgroup="corpses",
order = "c[corpse]-a[biter]-a[small]",
flags = {"placeable-neutral", "placeable-off-grid", "building-direction-8-way", "not-repairable", "not-on-map"},
dying_speed = 0.02,
time_before_removed = 15 * 60 * 60,
final_render_layer = "corpse",
animation = animate(animation_data[name]['die'])
}
})
functions.lua Code: Select all
function animate(d)
return
{
layers =
{
{
width = d['width'],
height = d['height'],
frame_count = d['frame_count'],
direction_count = d['direction_count'],
shift = {0, -1},
animation_speed = d['animation_speed'],
scale = d['scale'],
stripes =
{
{
filename = "__fantasy_warfare__/graphics/"..d['name'].."/"..d['action']..".png",
width_in_frames = d['frame_count'],
height_in_frames = d['direction_count']
}
}
}
}
}
end
Re: Custom mosters attack animation playing only 2 frames
Posted: Fri Feb 17, 2017 1:50 am
by Nexela
Eliont wrote: Except i don't get what field "order" do.
Order on entities is the order in the Subgroup it is placed in on the entity selection window for the map editor.
Subgroup is the group (think row) where these icons are placed,
If your entity doesn't have any of the "placeable" flags then Order and Subgroup are not needed. The Placeable flags just tell the map editor that these entities can be placed.
Re: Custom mosters attack animation playing only 2 frames
Posted: Fri Feb 17, 2017 1:57 am
by Eliont
Thanks for clarification.