Warcraft II Mod Archive

Got resources you'd like to share? Want to request some help with scripting or graphic creation? Then this is the place to be.
francot514
Posts: 87
Joined: Wed May 21, 2014 6:26 am

Re: Warcraft II Mod Archive

Post by francot514 »

Thanks for your help, now i was able to convert some stuff for this archive, now i want to ask you something, how to allow fly unit "Gnomish inventor" based to attack...
Attachments
Ogre troll
Ogre troll
ogre.png (38.08 KiB) Viewed 9920 times
Flying bomber
Flying bomber
bomber.png (14.9 KiB) Viewed 9920 times
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Warcraft II Mod Archive

Post by b_o »

Those are funny units..

I would think you could just open up the units.lua and find an attacking unit, and copy the relevant portions to the unit you want to make to attack. So you might add these if you wanted it to attack like a catapult:

Code: Select all

Missile = "missile-catapult-rock",
  MinAttackRange = 2, MaxAttackRange = 8, 
  RightMouseAction = "attack",
  CanGroundAttack = true,
  CanAttack = true,
  CanTargetLand = true, CanTargetSea = true,
francot514
Posts: 87
Joined: Wed May 21, 2014 6:26 am

Re: Warcraft II Mod Archive

Post by francot514 »

Ok, dont know why, but the "bomber" unit cannot cause damage, it can target enemies, but do not show missile shooting or cause any damage, even when i used a dragon base for doing the custom unit...

Also for example i want to allow a troll be a shaman that can use magic...
Attachments
Shaman
Shaman
shaman.png (23.62 KiB) Viewed 9912 times
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Warcraft II Mod Archive

Post by b_o »

There is a setting for damage that I didn't include in the example code, look through all of the code in the units and try to make sense of all the info there. You could try making an exact copy of the dragon, then change the name, icon, graphics, and animation tag. Or for magic, make an exact copy of a magic using unit, then change the graphics, animation, name and icon.
francot514
Posts: 87
Joined: Wed May 21, 2014 6:26 am

Re: Warcraft II Mod Archive

Post by francot514 »

You have tried to do that??? becuase it do not work, even if adding buttons for attack, upgrades to allow spell, simple do not attack, or no cast the spell...
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Warcraft II Mod Archive

Post by b_o »

I haven't tried it. Maybe post the section for that unit from the units.lua here so it can be seen ?
francot514
Posts: 87
Joined: Wed May 21, 2014 6:26 am

Re: Warcraft II Mod Archive

Post by francot514 »

Ok, here you go, code for booth units causing problem.. Also the buttons and spells need to be changed??

Code: Select all

DefineUnitType("unit-fighter", { Name = "Fighter",
  Image = {"file", "neutral/units/bomber.png", "size", {80, 80}},
  Animations = "animations-balloon", Icon = "icon-gnomish-flying-machine",
  Costs = {"time", 250, "gold", 2500},
  Speed = 14,
  HitPoints = 100,
  DrawLevel = 60,
  TileSize = {2, 2}, BoxSize = {71, 71},
  SightRange = 6, ComputerReactionRange = 8, PersonReactionRange = 6,
  Armor = 5, BasicDamage = 0, PiercingDamage = 16, Missile = "missile-catapult-rock",
  MaxAttackRange = 4,
  Priority = 65,
  Points = 150,
  Demand = 1,
  Type = "fly", ShadowFly = {Value = 0, Enable = true},
  RightMouseAction = "attack",
  CanAttack = true,
  CanTargetLand = true, CanTargetSea = true, CanTargetAir = true,
  AirUnit = true,
  DetectCloak = true,
  organic = true,
  SelectableByRectangle = true,
  Sounds = {
    "selected", "gnomish-flying-machine-selected",
    "acknowledge", "gnomish-flying-machine-acknowledge",
    "ready", "gnomish-flying-machine-ready",
    "help", "basic human voices help 1",
    "dead", "explosion"} } )

Code: Select all

DefineUnitType("unit-shaman", { Name = "Troll Shaman",
  Image = {"file", "neutral/units/shaman.png", "size", {72, 72}},
  Animations = "animations-sharp-axe", Icon = "icon-sharp-axe",
  Costs = {"time", 70, "gold", 500, "wood", 50},
  Speed = 10,
  HitPoints = 120,
  DrawLevel = 40,
  Mana = {Enable = true},
  TileSize = {1, 1}, BoxSize = {36, 36},
  SightRange = 9, ComputerReactionRange = 7, PersonReactionRange = 5,
  Armor = 5, BasicDamage = 10, PiercingDamage = 18, Missile = "missile-axe",
  MaxAttackRange = 5,
  Priority = 55,
  Points = 120,
  Demand = 1,
  Corpse = "unit-orc-dead-body",
  Type = "land",
  RightMouseAction = "attack",
  CanAttack = true,
  CanTargetLand = true, CanTargetSea = true, CanTargetAir = true,
  CanCastSpell = {
      "spell-death-coil",
      "spell-haste",
      "spell-raise-dead"},
  LandUnit = true,
  hero = true,
  organic = true,
  SelectableByRectangle = true,
  Sounds = {
    "selected", "zuljin-selected",
    "acknowledge", "zuljin-acknowledge",
--    "ready", "zuljin-ready",
    "help", "basic orc voices help 1",
    "dead", "basic orc voices dead"} } )
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Warcraft II Mod Archive

Post by b_o »

For the first one, I need to see the section from anim.lua for "animations-balloon".. The attack command is supposed to be included in the attack animation code, so if you use animation code from a unit which doesn't have an attack, it will never attack even if you tell it elsewhere that it can. buttons should be located in buttons.lua
francot514
Posts: 87
Joined: Wed May 21, 2014 6:26 am

Re: Warcraft II Mod Archive

Post by francot514 »

Thats the think, balloon, does have attack animation but is this one

Code: Select all

DefineAnimations("animations-balloon", {
  Still = {"frame 0", "wait 1", "frame 5", "wait 1", "frame 5", "wait 1",
    "frame 0", "wait 1", },
  Move = {"unbreakable begin", "frame 5", "move 4", "wait 1", "frame 5", "move 3", "wait 1",
    "frame 5", "move 3", "wait 1", "frame 0", "move 3", "wait 1",
    "frame 0", "move 3", "wait 1", "frame 5", "move 4", "wait 1",
    "frame 5", "move 3", "wait 1", "frame 5", "move 3", "wait 1",
    "frame 0", "move 3", "wait 1", "frame 0", "move 3", "unbreakable end", "wait 1", },
  Attack = {"unbreakable begin", "frame 0", "unbreakable end", "wait 1", },
  Death = {"unbreakable begin", "frame 0", "unbreakable end", "wait 1", },
})

And for the the spell usage is same thing??? animations requiered?=
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Warcraft II Mod Archive

Post by b_o »

It was missing the attack command, try replacing it with this,

Code: Select all

DefineAnimations("animations-balloon", {
  Still = {"frame 0", "wait 1", "frame 5", "wait 1", "frame 5", "wait 1",
    "frame 0", "wait 1", },
  Move = {"unbreakable begin", "frame 5", "move 4", "wait 1", "frame 5", "move 3", "wait 1",
    "frame 5", "move 3", "wait 1", "frame 0", "move 3", "wait 1",
    "frame 0", "move 3", "wait 1", "frame 5", "move 4", "wait 1",
    "frame 5", "move 3", "wait 1", "frame 5", "move 3", "wait 1",
    "frame 0", "move 3", "wait 1", "frame 0", "move 3", "unbreakable end", "wait 1", },
  Attack = {"unbreakable begin", 
                "frame 0", "wait 3",                                                  --aim 
                "frame 0", "attack", "sound catapult-attack", "wait 5",   --attack     
                "frame 0", "wait 5",                                                  -- cooldown
                "frame 0", "unbreakable end", "wait 1", },
  Death = {"unbreakable begin", "frame 0", "unbreakable end", "wait 1", },
})
But change this in the section I posted:

Code: Select all

"sound catapult-attack",
to use the sound you want to use, or just delete it. I don't know what the sounds are labeled as in your game.

But realize that any unit which uses the new animation code will think that it can attack. So you might want to make the new animation code as a separate section used only by the attacking type of unit. but if there are no other units which use this code, then just replace it.

Not sure about the spells, I think for spells you need to deal with buttons.lua, or spells.lua or both. I haven't done much with them before.
Post Reply