<< Back to Programming Forum   Search

Posts 1 - 2 of 2   
Limited movement mod (through own territory): 2020-04-11 05:28:41


krinid 
Level 63
Report
Actually a continuation of the following thread but it's been >30 days so it's locked:
https://www.warzone.com/Forum/390148-mod-multiattack-through-territory

Recap: Looking to make a mod to allow movement through own territory some # of times (transfer units). Same as limited multiattack mod but for unit transfers. Essentially this makes it a "limited movement mod" regardless of whether transferring through own or attacking.

Now before anyone says it, I'll call it out myself: no, I'm not saying unlimited movement. Limited, and it should be a configurable setting same as it is with the limited MA mod. So relative to the game map, you can set it to 2, 5, 10 or 50 if you so desired. I personally would recommend 2-5 for most maps though depending on what you're looking for.

So the crux of my question, is anyone familiar enough with the Limited Multiattack mod to identify the part within it that stops movement if you move units to a territory you already occupy? Last time I posted this, I didn't realize that it is really simple coding that makes up these mods... not sure what language that is but it looks awfully similar to C/Java/Many forms of Basic/Scripting/etc so as long as I know where I need to make the change, I might be able to do this myself.

So I'm looking at this mod:
https://github.com/dabo123148/WarlightMod/tree/master/LimitedMultiattack

First question - is this the right mod? There seem to be 2 packages for LMA mods.

Second question - which code file/code block contains the code to end MA moves when you hit your own territories? I don't see
anything related to it in any of the files. Is it perhaps not here b/c that functionality is governed by the main game code itself, and this just focuses on 'attacks' and not 'transfers'?

Any other suggestions any experienced modders have?
Limited movement mod (through own territory): 2020-04-11 06:22:00


TBest 
Level 60
Report
Do you want to limit the total number of transfers or to support some limited Multi-transfer thing?

https://www.warzone.com/wiki/Mod_Developers_Guide this page and the page about hooks are key for understanding.


not sure what language that is but it looks awfully similar to C/Java/Many forms of Basic/Scripting/etc

It's Lua, which is built from C# I belive. {Or technically, it's using the Lua interpreter Moonsharp 2.0, as that is what you get when you call the env variable}. But yes, it's pretty straightforward.

First question - is this the right mod? There seem to be 2 packages for LMA mods.

You can't really know from Github, but if you go through Warzone and click on the mod, you get the link.
https://github.com/dabo123148/WarlightMod/tree/master/LimitedMultiattack

Second question - which code file/code block contains the code to end MA moves when you hit your own territories?

Mod's can't change the WZ UI, meaning we can't stop the client from entering many MA moves in
to the order list. However, we can skip orders.

Dabo's mod has the option for a MA card, which (essentaly) works as a bool variable for whether you can MA that turn. However, what you are looking for is what he does with the GameOrderAttackTransfer.

if(order.proxyType == 'GameOrderAttackTransfer') then
		if(UbrigeAngriffe[order.From] > 0 or (activated[order.PlayerID] and Mod.Settings.MaxAttacks == 0))then
			if(result.IsSuccessful)then
				if(game.ServerGame.LatestTurnStanding.Territories[order.From].OwnerPlayerID ~= game.ServerGame.LatestTurnStanding.Territories[order.To].OwnerPlayerID)then
					UbrigeAngriffe[order.To] = UbrigeAngriffe[order.From];
				else
					UbrigeAngriffe[order.To] = -1;
				end
				if(Mod.Settings.MaxAttacks == 0 and UbrigeAngriffe[order.To] ~= 0)then
					UbrigeAngriffe[order.To] = UbrigeAngriffe[order.To] - 1;
				else
					if(UbrigeAngriffe[order.To] ~= 0)then
						UbrigeAngriffe[order.To] = UbrigeAngriffe[order.To] - 1;
					end
				end
			else
				if(order.PlayerID == game.ServerGame.LatestTurnStanding.Territories[order.From].OwnerPlayerID)then
					if(Mod.Settings.ContinueAttackIfFailed == nil or Mod.Settings.ContinueAttackIfFailed == false)then
						UbrigeAngriffe[order.From] = -1;
					end
				end
			end
		else
			skipThisOrder(WL.ModOrderControl.Skip);
		end
	end


Edited 4/11/2020 06:24:31
Posts 1 - 2 of 2