How to change UI artwork depending on game type.

WIP aims to Wargus, while maintaining the game's ambience and gameplay experience.
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

How to change UI artwork depending on game type.

Postby DinkyDyeAussie » Mon Feb 17, 2014 2:15 pm

Was playing Wargus using WIP mod. I wanted to know if it's possible to change the artwork based on the campaign/skirmish map you're playing. I have interface artwork for Warcraft 1 and Warcraft 2, and at the moment I change which artwork the game uses, by editing the script files for orc and human.

What I'd like is for the game to change the artwork for both races, based on whether you play the war1 remake or the war2 campaign. Can this be done using scripts?
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: How to change UI artwork depending on game type.

Postby Andrettin » Mon Feb 17, 2014 6:07 pm

DinkyDyeAussie wrote:Was playing Wargus using WIP mod. I wanted to know if it's possible to change the artwork based on the campaign/skirmish map you're playing. I have interface artwork for Warcraft 1 and Warcraft 2, and at the moment I change which artwork the game uses, by editing the script files for orc and human.

What I'd like is for the game to change the artwork for both races, based on whether you play the war1 remake or the war2 campaign. Can this be done using scripts?
Yes, it can be done. Modify this part of scripts.lua to use the UI you want:

Code: Select all

if (GetPlayerData(GetThisPlayer(), "RaceName") == "human") then
	Load("scripts/human/ui.lua")
elseif (GetPlayerData(GetThisPlayer(), "RaceName") == "orc") then
	Load("scripts/orc/ui.lua")
end
So, for instance, you could add a conditional that if the current campaign is the WC1 one, then you load a different UI.
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

Re: How to change UI artwork depending on game type.

Postby DinkyDyeAussie » Tue Feb 18, 2014 9:00 am

How would I add this condition?
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: How to change UI artwork depending on game type.

Postby Andrettin » Tue Feb 18, 2014 4:52 pm

DinkyDyeAussie wrote:How would I add this condition?
This seems to work for me:

Code: Select all

if (currentExp == "wc1") then
	if (GetPlayerData(GetThisPlayer(), "RaceName") == "human") then
		Load("wip/scripts/human/wc1_ui.lua")
	elseif (GetPlayerData(GetThisPlayer(), "RaceName") == "orc") then
		Load("wip/scripts/orc/wc1_ui.lua")
	end
else
	if (GetPlayerData(GetThisPlayer(), "RaceName") == "human") then
		Load("scripts/human/ui.lua")
		Load("wip/scripts/human/ui.lua")
	elseif (GetPlayerData(GetThisPlayer(), "RaceName") == "orc") then
		Load("scripts/orc/ui.lua")
		Load("wip/scripts/orc/ui.lua")
	end
end
This code should be put at the end of the /wip/scripts.lua file, replacing this code:

Code: Select all

if (GetPlayerData(GetThisPlayer(), "RaceName") == "human") then
	Load("wip/scripts/human/ui.lua")
elseif (GetPlayerData(GetThisPlayer(), "RaceName") == "orc") then
	Load("wip/scripts/orc/ui.lua")
end
To make the code work you would, of course, need to create lua files for the WC1 orc and human UIs where described in the code (/wip/scripts/human/wc1_ui.lua and /wip/scripts/orc/wc1_ui.lua).
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

Re: How to change UI artwork depending on game type.

Postby DinkyDyeAussie » Tue Feb 18, 2014 7:44 pm

Thanks man! I'll give that a go later.

**EDIT**


Just tried it and it works. You're officially a legend now, if you weren't already before, which I imagine you were :)
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

Re: How to change UI artwork depending on game type.

Postby DinkyDyeAussie » Wed Feb 19, 2014 3:19 pm

So now I have the main in-game interface working...How do I make it so the menus also have the same textures? I have seen the:

Code: Select all

local hpanels = {
  "ui/human/panel_1.png",
  "ui/human/panel_2.png",
  "ui/human/panel_3.png",
  "ui/human/panel_4.png",
  "ui/human/panel_5.png"
}

local opanels = {
  "ui/orc/panel_1.png",
  "ui/orc/panel_2.png",
  "ui/orc/panel_3.png",
  "ui/orc/panel_4.png",
  "ui/orc/panel_5.png"
}
in the guichan file. How would I make this work with the game when I switch to Warcraft 1 and want to have those panels in the game instead of the war2 ones?
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: How to change UI artwork depending on game type.

Postby Andrettin » Wed Feb 19, 2014 6:28 pm

DinkyDyeAussie wrote:Thanks man! I'll give that a go later.

**EDIT**


Just tried it and it works. You're officially a legend now, if you weren't already before, which I imagine you were :)
I'm glad I was able to help :)
DinkyDyeAussie wrote:So now I have the main in-game interface working...How do I make it so the menus also have the same textures? I have seen the:

Code: Select all

local hpanels = {
  "ui/human/panel_1.png",
  "ui/human/panel_2.png",
  "ui/human/panel_3.png",
  "ui/human/panel_4.png",
  "ui/human/panel_5.png"
}

local opanels = {
  "ui/orc/panel_1.png",
  "ui/orc/panel_2.png",
  "ui/orc/panel_3.png",
  "ui/orc/panel_4.png",
  "ui/orc/panel_5.png"
}
in the guichan file. How would I make this work with the game when I switch to Warcraft 1 and want to have those panels in the game instead of the war2 ones?
You need to define similar things for your wc1 panels (preferentially just below the definitions you cited):

Code: Select all

local wc1_hpanels = {
  "ui/human/wc1_panel_1.png",
  "ui/human/wc1_panel_2.png",
  "ui/human/wc1_panel_3.png",
  "ui/human/wc1_panel_4.png",
  "ui/human/wc1_panel_5.png"
}

local wc1_opanels = {
  "ui/orc/wc1_panel_1.png",
  "ui/orc/wc1_panel_2.png",
  "ui/orc/wc1_panel_3.png",
  "ui/orc/wc1_panel_4.png",
  "ui/orc/wc1_panel_5.png"
}
You would have, of course, to add the mentioned PNG files to the folders and name them in the same way as they are in the definition.

Then you need to replace this:

Code: Select all

function panel(n)
  if (GetPlayerData(GetThisPlayer(), "RaceName") == "human") then
    return hpanels[n]
  else
    return opanels[n]
  end
end
...with something like this:

Code: Select all

function panel(n)
  if (currentExp == "wc1") then
    if (GetPlayerData(GetThisPlayer(), "RaceName") == "human") then
      return wc1_hpanels[n]
    else
      return wc1_opanels[n]
    end
  else
    if (GetPlayerData(GetThisPlayer(), "RaceName") == "human") then
      return hpanels[n]
    else
      return opanels[n]
    end
  end
end
User avatar
DinkyDyeAussie
Posts: 260
Joined: Fri Feb 10, 2012 10:39 am
Location: Australia

Re: How to change UI artwork depending on game type.

Postby DinkyDyeAussie » Sun Feb 23, 2014 11:09 pm

Thanks man that worked too. Got the WC1 panels working in the WC1 and the WC2 panels workin as normal too.

Now I just gotta keep making the panels for the WC1 human interface.

Who is online

Users browsing this forum: No registered users and 2 guests