Code: Select all
-- spider
local SpiderStill = UnitStill
local SpiderMove = {"unbreakable begin",
"frame 0", "move 3", "wait 2",
"frame 0", "move 3", "wait 2",
"frame 5", "move 4", "wait 2",
"frame 5", "move 3", "wait 1",
"frame 10", "move 3", "wait 2",
"frame 10", "move 3", "wait 1",
"frame 15", "move 3", "wait 2",
"frame 15", "move 3", "wait 1",
"frame 20", "move 4", "wait 2",
"frame 20", "move 3", "unbreakable end", "wait 1",}
local SpiderDeath = {"unbreakable begin",
"frame 45", "wait 1",
"frame 50", "wait 50",
"frame 55", "wait 50",
"frame 60", "wait 50",
"frame 65", "unbreakable end", "wait 1",}
DefineAnimations("animations-spider", {
Still = SpiderStill,
Move = SpiderMove,
Attack = {"unbreakable begin",
"frame 25", "wait 3",
"frame 30", "wait 3",
"frame 35", "wait 3",
"frame 40", "attack", "sound grunt-attack", "wait 5",
"frame 25", "wait 10",
"frame 25", "unbreakable end", "wait 1",},
Death = SpiderDeath,
})
Code: Select all
DefineUnitType("unit-spider", { Name = "Spider",
Image = {"file", "orc/units/spider32.png", "size", {32, 32}},
Animations = "animations-spider", Icon = "icon-spider",
Costs = {"time", 5, "gold", 0},
Speed = 15,
HitPoints = 15,
DrawLevel = 15,
TileSize = {1, 1}, BoxSize = {31, 31},
SightRange = 5, ComputerReactionRange = 6, PersonReactionRange = 4,
Armor = 0, BasicDamage = 3, PiercingDamage = 0, Missile = "missile-none",
MaxAttackRange = 1,
Priority = 60,
Points = 50,
Demand = 1,
Type = "land",
RightMouseAction = "attack",
CanAttack = true,
CanTargetLand = true,
LandUnit = true,
organic = true,
SelectableByRectangle = true,
Sounds = {
"selected", "skeleton-selected",
"help", "basic orc voices help 1",
"dead", "basic orc voices dead"} } )
Also, I may attempt to make a spiderweb projectile for a special attack which would slow a target.
The scorpion has an additional frame for it's attack, so most of the code would look like the spider code, but the attack animation code in anim.lua for the scorpion would be something like this with the death animation bumped by 5 frames:
Code: Select all
Attack = {"unbreakable begin",
"frame 25", "wait 3",
"frame 30", "wait 3",
"frame 35", "wait 3",
"frame 40", "attack", "sound grunt-attack", "wait 5",
"frame 45", "wait 10",
"frame 25", "unbreakable end", "wait 1",},
local ScorpionDeath = {"unbreakable begin",
"frame 50", "wait 1",
"frame 55", "wait 50",
"frame 60", "wait 50",
"frame 65", "wait 50",
"frame 70", "unbreakable end", "wait 1",}