Fixing For the Motherland

Wargus is a Warcraft 2 mod that allows you to play Warcraft 2 with the Stratagus engine.
Post Reply
User avatar
Yukiko
Posts: 63
Joined: Sun May 24, 2015 6:52 pm

Fixing For the Motherland

Post by Yukiko »

I would like to reintroduce the Caanoo folder and use it to house mod scripts which can be loaded at will.

I'm thinking of the following structure:
/scripts/caanoo/ftm.lua < Scripts which are used only for the FtM game type.
/scripts/caanoo/expanded.lua < Additional units which can be used in custom maps.
/scripts/caanoo/frontline.lua < Scripts which are used only for the Frontline game type.
/scripts/caanoo/escape.lua < Scripts which are used only for the Escape game type.
/scripts/caanoo/stand.lua < Scripts which are used only for the Last Stand game type.

I'll like to create three new game types from maps from the Frontier Force campaign: Escape, Last Stand, and Scenario.

Escape - One team must get from one side of the map to the other. The other team has to stop them.
Last Stand - One side attacks with FtM mechanics. The other side defends as long as possible with standard mechanics.
Scenario - Standalone scenario missions.

I'll start by getting all the FtM maps working correctly.
User avatar
Yukiko
Posts: 63
Joined: Sun May 24, 2015 6:52 pm

Re: Fixing For the Motherland

Post by Yukiko »

I've been having trouble with crashes. I'm trying to only define needed units, but it likes to crash if everything in the Caanoo scripts isn't defined.

"unit-order-paladin" is an issue. If it is not defined it'll crash when I load a FtM map. I believe the issue is the Ai is putting this unit in an AttackForce. It is probably used in the Frontier Force campaign.
User avatar
Yukiko
Posts: 63
Joined: Sun May 24, 2015 6:52 pm

Re: Fixing For the Motherland

Post by Yukiko »

Ai.lua has the issue. It references unit-order-paladin via AiEliteSoldier.

Code: Select all

function AiEliteSoldier(race)
  if (race == nil) then race = AiGetRace() elseif (type(race) == "number") then race = GetPlayerData(race, "RaceName") end
  if (race == race1) then
    return "unit-order-paladin"
  else
    return "unit-order-paladin"
  end
end
It could be safe to remove AiBones.

Code: Select all

function AiBones(race)
  if (race == nil) then race = AiGetRace() elseif (type(race) == "number") then race = GetPlayerData(race, "RaceName") end
  if (race == race1) then
    return "unit-skeleton"
  else
    return "unit-skeleton"
  end
end
This isn't used anywhere, but it could be a problem one day.

Code: Select all

function AiLonerShooter(race)
  if (race == nil) then race = AiGetRace() elseif (type(race) == "number") then race = GetPlayerData(race, "RaceName") end
  if (race == race1) then
    return "unit-yeoman"
  else
    return "unit-nomad"
  end
end
User avatar
Yukiko
Posts: 63
Joined: Sun May 24, 2015 6:52 pm

Re: Fixing For the Motherland

Post by Yukiko »

OK, looks like I've got it working. I've changed some maps and ai.lua but those should all carry over when I make a pull request.
Attachments
ftm.lua
(36.62 KiB) Downloaded 12 times
User avatar
Yukiko
Posts: 63
Joined: Sun May 24, 2015 6:52 pm

Re: Fixing For the Motherland

Post by Yukiko »

Next I'll try to fix Mushroom Panic. It has an error of: attempt to index global 'ftm_index_start' (a nil value)

Comparing Mushroom Panic to Nick's Duel, I can see Nick's Duel uses a function to define variable values, but Mushroom Panic defines the variables directly.

Code: Select all

AiRedRibbon_Setup_2014()
AiRed_Resources_Setup_2014(10, 100, 50, 100, 11, "Pickers")
GameDefinitionSetup("For the Motherland", "Standard", 2014, "Nick's Duel")

-- SetPlayerFtM2014(player, race, faction, gold, wood, oil, startx, starty, istart, iend, teamx1, teamy1, teamx2, teamy2, match, aispawner, aibot)
SetPlayerFtM2014(2, "orc", "Hipsters", 5000, 2500, 500, 25, 28, 51, 65, 22, 27, 24, 29, 8, "ai_redribbon_2014", "Aya Kalang")
SetPlayerFtM2014(3, "man", "Tradies", 5000, 2500, 500, 6, 3, 1, 15, 7, 2, 9, 4, 8, "ai_redribbon_2014", "Aya Kalang")

Code: Select all

-- player configuration
SetupPlayer(0, "man", "ai_redribbon_2014", 5000, 4500, 5000, 49, 165)
SetupPlayer(1, "orc", "ai_redribbon_2014", 7000, 6500, 5000, 50, 68)
SetupPlayer(2, "orc", "ai_red1", 25000, 15000, 15000, 37, 248)
SetupPlayer(3, "man", "ai_red_2014", 25000, 15000, 15000, 36, 8)
SetupPlayer(4, "man", "ai-passive", 0, 0, 0, 32, 252)

AiRedRibbon_Setup_2014()

ftm_faction[0] = "Pechka"
ftm_faction[1] = "Pechenka"
ftm_faction[2] = "Pechenka"
ftm_faction[3] = "Pechka"

ftm_team[0] = 0
ftm_team[1] = 1
ftm_team[2] = 1
ftm_team_x1[2] = 1
ftm_team_y1[2] = 1
ftm_team_x2[2] = 64
ftm_team_y2[2] = 256
ftm_team[3] = 0
ftm_team_x1[3] = 1
ftm_team_y1[3] = 1
ftm_team_x2[3] = 64
ftm_team_y2[3] = 256
	
ftm_choice[0] = 3
ftm_choice[1] = 2
ftm_index_start[1] = 51
ftm_index_end[1] = 65
ftm_index_start[0] = 1
ftm_index_end[0] = 15

ftm_origin_x[1] = 38
ftm_origin_y[1] = 34
ftm_origin_x[2] = 38
ftm_origin_y[2] = 34
ftm_origin_x[3] = 29
ftm_origin_y[3] = 24
ftm_origin_x[4] = 29
ftm_origin_y[4] = 24
ftm_origin_x[5] = 29
ftm_origin_y[5] = 24
ftm_origin_x[6] = 30
ftm_origin_y[6] = 40
ftm_origin_x[7] = 30
ftm_origin_y[7] = 40
ftm_origin_x[8] = 30
ftm_origin_y[8] = 40
ftm_origin_x[9] = 16
ftm_origin_y[9] = 27
ftm_origin_x[10] = 32
ftm_origin_y[10] = 32
ftm_origin_x[11] = 32
ftm_origin_y[11] = 45
ftm_origin_x[12] = 32
ftm_origin_y[12] = 32
ftm_origin_x[13] = 8
ftm_origin_y[13] = 8
ftm_origin_x[14] = 40
ftm_origin_y[14] = 48
ftm_origin_x[15] = 32
ftm_origin_y[15] = 32

ftm_origin_x[51] = 41
ftm_origin_y[51] = 215
ftm_origin_x[52] = 42
ftm_origin_y[52] = 216
ftm_origin_x[53] = 28
ftm_origin_y[53] = 223
ftm_origin_x[54] = 28
ftm_origin_y[54] = 223
ftm_origin_x[55] = 28
ftm_origin_y[55] = 223
ftm_origin_x[56] = 17
ftm_origin_y[56] = 216
ftm_origin_x[57] = 17
ftm_origin_y[57] = 216
ftm_origin_x[58] = 17
ftm_origin_y[58] = 216
ftm_origin_x[59] = 22
ftm_origin_y[59] = 233
ftm_origin_x[60] = 30
ftm_origin_y[60] = 230
ftm_origin_x[61] = 31
ftm_origin_y[61] = 217
ftm_origin_x[62] = 30
ftm_origin_y[62] = 230
ftm_origin_x[63] = 22
ftm_origin_y[63] = 250
ftm_origin_x[64] = 47
ftm_origin_y[64] = 237
ftm_origin_x[65] = 30
ftm_origin_y[65] = 230

ftm_team_startx[0] = 31
ftm_team_starty[0] = 31
ftm_team_startx[1] = 29
ftm_team_starty[1] = 229
ftm_team_startx[2] = 37
ftm_team_starty[2] = 248
ftm_team_startx[3] = 36
ftm_team_starty[3] = 8
User avatar
Yukiko
Posts: 63
Joined: Sun May 24, 2015 6:52 pm

Re: Fixing For the Motherland

Post by Yukiko »

It is interesting how the Orc player starts with more wood and gold in Mushroom Panic. I'll assume that is an error are make both the Horde and Alliance start with the same resources.
User avatar
Yukiko
Posts: 63
Joined: Sun May 24, 2015 6:52 pm

Re: Fixing For the Motherland

Post by Yukiko »

I've have Mushroom Panic running for a little bit.

I had to change the definition file. It would crash if the map was 64x256, but would load if it was defined as 256x256.

Code: Select all

--       _________ __                 __
--      /   _____//  |_____________ _/  |______     ____  __ __  ______
--      \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
--      /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \ 
--     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
--             \/                  \/          \//_____/            \/ 
--  ______________________                           ______________________
--                        T H E   W A R   B E G I N S
--         Stratagus - A free fantasy real time strategy game engine
--
--	(c) Copyright 2014 by Kyran Jackson
--
--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation; either version 2 of the License, or
--      (at your option) any later version.
--  
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--  
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
--

SetMapTeams(8, 1, 1)
SetMapTeams(9, 2, 1)

--DefinePlayerTypes("computer", "computer", "person", "person")
DefinePlayerTypes("computer", "computer", "nobody", "nobody", "nobody", "nobody", "nobody", "nobody", "person", "person")
PresentMap("Mushroom Panic", 2, 256, 256, 1)
I updated Mushroom Panic's scripts.

Code: Select all

--       _________ __                 __
--      /   _____//  |_____________ _/  |______     ____  __ __  ______
--      \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
--      /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \ 
--     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
--             \/                  \/          \//_____/            \/ 
--  ______________________                           ______________________
--                        T H E   W A R   B E G I N S
--         Stratagus - A free fantasy real time strategy game engine
--
--	(c) Copyright 2014 by Kyran Jackson
--
--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation; either version 2 of the License, or
--      (at your option) any later version.
--  
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--  
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
--

AiRedRibbon_Setup_2014()
-- AiRed_Resources_Setup_2014(first user, gold, wood, oil, last user)
GameDefinitionSetup("For the Motherland", "Standard", 2014, "Mushroom Panic")

--AiRed_Strategy_Horde_Mass_2014(2)
--AiRed_Strategy_Alliance_Mass_2014(3)



-- player configuration
-- SetPlayerFtM2014(player, race, faction, gold, wood, oil, startx, starty, istart, iend, teamx1, teamy1, teamx2, teamy2, match, aispawner, aibot)
--ai_red1 + ai_red_2014
SetPlayerFtM2014(0, "orc", "Pechka", 25000, 15000, 15000, 37, 248, 1, 15, 1, 1, 64, 256, 8, "ai_redribbon_2014", "Aya Kalang")
SetPlayerFtM2014(1, "man", "Pechenka", 25000, 15000, 15000, 36, 8, 51, 65, 1, 1, 64, 256, 8, "ai_redribbon_2014", "Aya Kalang")
--SetupPlayer(4, "man", "ai-passive", 0, 0, 0, 32, 252)

AiRed_Resources_Setup_2014(8, 100, 100, 50, 9, "Pickers")

-- AiRedRibbon_Auto_Origin_2014(player, target, x, y, class)

-- Orc
AiRedRibbon_Auto_Origin_2014(0, "standard", 29, 24, AiBarracks(0))
AiRedRibbon_Auto_Origin_2014(0, "elite", 30, 40, AiBarracks(0))
AiRedRibbon_Auto_Origin_2014(0, "hero", 16, 27, AiBarracks(0))
AiRedRibbon_Auto_Origin_2014(0, "defender", 38, 34, AiBarracks(0))
AiRedRibbon_Auto_Origin_2014(0, "worker", 32, 32, AiCityCenter(0))
AiRedRibbon_Auto_Origin_2014(0, "fodder", 32, 32, AiCityCenter(0))
AiRedRibbon_Auto_Origin_2014(0, AiSuicideBomber(0), 32, 45, AiScientific(0))
AiRedRibbon_Auto_Origin_2014(0, "air", 8, 8, AiAirport(0))
AiRedRibbon_Auto_Origin_2014(0, AiMage(0), 40, 48, AiMageTower(0))

-- Human
AiRedRibbon_Auto_Origin_2014(1, "standard", 18, 217, AiBarracks(0))
AiRedRibbon_Auto_Origin_2014(1, "elite", 29, 224, AiBarracks(0))
AiRedRibbon_Auto_Origin_2014(1, "hero", 23, 234, AiBarracks(0))
AiRedRibbon_Auto_Origin_2014(1, "defender", 43, 217, AiBarracks(0))
AiRedRibbon_Auto_Origin_2014(1, "worker", 30, 230, AiCityCenter(0))
AiRedRibbon_Auto_Origin_2014(1, "fodder", 30, 230, AiCityCenter(0))
AiRedRibbon_Auto_Origin_2014(1, AiSuicideBomber(0), 32, 218, AiScientific(0))
AiRedRibbon_Auto_Origin_2014(1, "air", 22, 250, AiAirport(0))
AiRedRibbon_Auto_Origin_2014(1, AiMage(0), 48, 238, AiMageTower(0))
User avatar
Yukiko
Posts: 63
Joined: Sun May 24, 2015 6:52 pm

Re: Fixing For the Motherland

Post by Yukiko »

I have gotten Mushroom Panic to not crash. It seems I haven't defined a spawn location for one of the units.
Post Reply