Several Questions to Wargus

Wargus is a Warcraft 2 mod that allows you to play Warcraft 2 with the Stratagus engine.
ramadeon
Posts: 4
Joined: Thu Jun 19, 2014 11:26 pm

Several Questions to Wargus

Post by ramadeon »

Hey guys,

first i want to say thank you for that really cool mod, it is awesome to see Warcraft in a modern script language and graphics. Me and my friend will have fun with that for sure! :)

Currently, i am trying to get things running and i have some questions you could help me with.

1) In the Gui, i got on the left side the "Stratagus" and Cycles counter. Is it possible to remove both strings, making the appearance more lighter like the vanilla game?

2) Is it possible to deactivate the Journal completly (i mean the messages in the upper middle of the screen like Peasant finished building etc.)? If yes, where?

3) I tried to mod some spells to my units but failed. I want to add f.e. Fireball to the Hero danath. I did this in the units.lua by giving him mana and the CanCastSpell = {"spell-fireball"}, string. Now he got the mana, but the spell icon does not appear. Do i have to configure the spell somewhere else too?

4) Is it possible to define, that a spell is already learned or has to be developed? It would be cool if my paladin hero would get his spells right from the start, but normal paladins have to wait for the spell research.

5) My idea is to make some heros available at the townhall, letting you chose one for your game. How can i assign new units to be produced in the buildings?

Thanks alot in advance for your help.

cheers,
r.
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Several Questions to Wargus

Post by b_o »

1). Someone else will have to answer this one.

2). main menu -> options -> disable messages

3). Designate which buttons appear for which human units/buildings in scripts/human/buttons.lua

4). Edit the hero's buttons to include the spell buttons via the method in number 3

5). See number 3
ramadeon
Posts: 4
Joined: Thu Jun 19, 2014 11:26 pm

Re: Several Questions to Wargus

Post by ramadeon »

Hey,

thanks for your reply!

In my Main menu, i dont find the disable messages knob. I am running on the latest version. Any ideas?

Another question: What are the exp and level values for? do all units progress?

thanks,
r.
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Re: Several Questions to Wargus

Post by b_o »

Install the WIP (Wargus improvement project)..

In Wc2, the level reflected the number of upgrades the unit had active. In wyrmsun, the units can progress levels through gaining experience. I don't think experience has a real function in wargus .
ramadeon
Posts: 4
Joined: Thu Jun 19, 2014 11:26 pm

Re: Several Questions to Wargus

Post by ramadeon »

hey,

thanks for you answer, i got mostly all working out well. :)

in my configuration journey i got new questions:

1) i created a new upgrade for a hero. it works fine, but i can do it several times. how can i make the button disappearing when it is used already?

2) i am trying to limit the player to build an unit just one time. i know there is a max unit value but i really want to enable a player just one time to create a hero. when the hero dies, he shall be gone forever. is it possible to allow the building of the unit only once?

3) is there a possibility to use the players name as a prerequisite for a button? we are a fixed gang of players and i want to enable player johnny to create hero 1 etc.

4) is it possible to edit the campaign maps? everytime i open them in the editor, it starts the mission briefing and crashs afterward.

5) is there any fix available for the crash when loading campaign games?

6) i tried to allow the healing spell to target self and to target another unit but i could only chose one of the paramenters (self and unit). is there a way to make it working for both targets?

7) is there a way to add the regeneration flag directly to a unit without giving it via addons?

thanks guys,
r.
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Several Questions to Wargus

Post by Andrettin »

ramadeon wrote:hey,

thanks for you answer, i got mostly all working out well. :)

in my configuration journey i got new questions:

1) i created a new upgrade for a hero. it works fine, but i can do it several times. how can i make the button disappearing when it is used already?
Did you structure your upgrade button similar to how other upgrade buttons are structured?
2) i am trying to limit the player to build an unit just one time. i know there is a max unit value but i really want to enable a player just one time to create a hero. when the hero dies, he shall be gone forever. is it possible to allow the building of the unit only once?
What I did in Wyrmsun for exactly this sort of case was using a trigger which fired if the hero unit existed, and disallowed hiring the hero for all players thereafter. Here is an example:

Code: Select all

	AddTrigger(
		function()
			if (GameCycle == 0) then
				return false
			end
			return true
		end,
		function() 
			if (GetNumUnitsAt(-1, "unit-hero-baglur", {0, 0}, {256, 256}) >= 1) then
				DefineAllow("unit-hero-baglur", "FFFFFFFFFFFFFFFF")
				return false
			end
			return true
		end
	)
The trigger should be added to the SinglePlayerTriggers() function or a subfunction of it.
3) is there a possibility to use the players name as a prerequisite for a button? we are a fixed gang of players and i want to enable player johnny to create hero 1 etc.
Yes, but it is a bit complicated. You would need code that looked more or less like this:

Code: Select all

function GetArrayIncludes(array, item)
    for key, value in pairs(array) do
        if (value == item) then
        	return true
        end
    end
    return false
end

function GetFactionForbiddenUnits(faction)
	if (faction == "Norlund Clan") then
		return { "unit-goblin-spearman", "unit-goblin-archer" }
	elseif (faction == "Shinsplitter Clan") then
		return { "unit-goblin-spearman", "unit-goblin-archer" }
	elseif (faction == "Shorbear Clan") then
		return { "unit-goblin-spearman", "unit-goblin-archer", "unit-hero-rugnur", "unit-hero-rugnur-steelclad", "unit-hero-baglur", "unit-hero-thursagan", "unit-hero-durstorn" }
	elseif (faction == "Kal Kartha") then
		return { "unit-goblin-spearman", "unit-goblin-archer", "unit-hero-rugnur", "unit-hero-rugnur-steelclad", "unit-hero-baglur", "unit-hero-durstorn" }
	elseif (faction == "Knalga") then
		return { "unit-goblin-spearman", "unit-goblin-archer" }
	elseif (faction == "Lyr") then
		return { "unit-goblin-spearman", "unit-goblin-archer" }
	elseif (faction == "Goblins") then
		return { "unit-dwarven-axefighter", "unit-dwarven-scout" }
	else
		return {}
	end
end

local PlayerUnitFlag = {}
for i=0,15 do
	if (GetArrayIncludes(GetFactionForbiddenUnits(GetPlayerData(i, "Name")), HERO_NAME)) then
		PlayerUnitFlag[i] = "F"
	else
		PlayerUnitFlag[i] = "A"
	end
end
flags = PlayerUnitFlag[0] .. PlayerUnitFlag[1] .. PlayerUnitFlag[2] .. PlayerUnitFlag[3] .. PlayerUnitFlag[4] .. PlayerUnitFlag[5] .. PlayerUnitFlag[6] .. PlayerUnitFlag[7] .. PlayerUnitFlag[8] .. PlayerUnitFlag[9] .. PlayerUnitFlag[10] .. PlayerUnitFlag[11] .. PlayerUnitFlag[12] .. PlayerUnitFlag[13] .. PlayerUnitFlag[14] .. PlayerUnitFlag[15]
DefineAllow(HERO_NAME, flags)
"HERO_NAME" should be replaced by the hero's unit name (i.e. "unit-wise-man"), with quotation marks. In the GetFactionForbiddenUnits() function you should replace what I put there with what heroes would be forbidden to each player with a certain player name (the "faction" there is just that, the player name).
4) is it possible to edit the campaign maps? everytime i open them in the editor, it starts the mission briefing and crashs afterward.
It is possible. The campaign maps crash because of this sort of line in the campaign map's .smp file:

Code: Select all

DefineMapSetup("./campaigns/human/level05h_c.sms")
If you delete or comment out the line, the map will open up fine in the editor. Just remember to restore the line to the .smp file afterwards, so that they will run normally in campaign mode.
7) is there a way to add the regeneration flag directly to a unit without giving it via addons?
Yes, I think the field is called "RegenerationRate" (a value of 1 means 1 HP recovered every second IIRC).
thanks guys,
r.
I hope I've helped =)
ramadeon
Posts: 4
Joined: Thu Jun 19, 2014 11:26 pm

Re: Several Questions to Wargus

Post by ramadeon »

hey andrettin,

thanks alot for your answer, that will surely help me out.
though it seems to be more complex than i hoped, i will try my luck :)

cheers,
j.
User avatar
Kyran
Posts: 499
Joined: Sat Dec 31, 2011 5:19 pm
Location: Australia
Contact:

Re: Several Questions to Wargus

Post by Kyran »

We are working on allowing mods and custom game modes in the next version. If you keep all your changes self-contained in a single file, we'll be able to include it with the next release as a mod or custom game mode.
04:27 jim4 why haven't you added wc1 support? this project sucks. i'm only going to use freecraft
05:06 jim4 finished wc1 support yet? i've been waiting for 6 years
05:10 jim4 new things scare me
Mizukami999
Posts: 14
Joined: Tue Dec 20, 2016 7:00 am

Re: Several Questions to Wargus

Post by Mizukami999 »

Hello guys!

Regarding pt. 2:

What if I want to enable the unit every time it dies? The problem is that every time a peasant exits a mine, or finishes building, the GetNumUnitsAt trigger fails to see the unit for a moment, and allows it. Next moment, the trigger checks again and disallows the unit, but a player has enough time to start building the unit.

How to make it work? Maybe add a delay in gamecycles?
Mizukami999
Posts: 14
Joined: Tue Dec 20, 2016 7:00 am

Re: Several Questions to Wargus

Post by Mizukami999 »

This seems to fix the problem, but I wonder if it's a good method.
It's supposed to allow the unit only after certain time has passed after its disallowance

Code: Select all

local Peon1_time

  AddTrigger(
      function()
         if (GameCycle == 0) then
            return false
         end
         return true
      end,
      function() 
         if (GetNumUnitsAt(-1, "unit-peon", {0, 0}, {256, 256}) >= 1 ) then
            DefineAllow("unit-peon", "FFFFFFFFFFFFFFFF")
			Peon1_time = GameCycle
            return true
         end
         return true
      end
   )

     AddTrigger(
      function()
         if (GameCycle == 0) then
            return false
         end
         return true
      end,
      function() 
         if ((GetNumUnitsAt(-1, "unit-peon", {0, 0}, {256, 256}) <= 0) and (GameCycle - Peon1_time > 200)) then
            DefineAllow("unit-peon", "AAAAAAAAAAAAAAAA")
            return true
         end
         return true
      end
   )
Post Reply