Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills
authorWuzzy <almikes@aol.com>
Sun, 15 Oct 2017 12:30:31 +0200
changeset 12708 6726d5edfdfb
parent 12707 0dfb49261cab
child 12709 c4ea9f8fb483
Loyal Highlander: loyal=true in Highlander script param, you only get stuff for *enemy* kills Normal Highlander is of course not affected by this. This setting is optional.
ChangeLog.txt
share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua
--- a/ChangeLog.txt	Fri Oct 13 23:39:36 2017 +0200
+++ b/ChangeLog.txt	Sun Oct 15 12:30:31 2017 +0200
@@ -65,6 +65,7 @@
 Highlander:
  + Show collected weapons after kill and play sound
  + Mission panel now shows all game modifiers (e.g. mines time, vampirism, etc.)
+ + Loyal Highlander (optional): With “loyal=true” in script param, you only get weapons for enemy kills (clan kills don't count)
  * Removed "Freezer"/IceGun from the default Highlander weaponset
 
 Construction Mode:
--- a/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Fri Oct 13 23:39:36 2017 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Highlander.lua	Sun Oct 15 12:30:31 2017 +0200
@@ -1,9 +1,10 @@
 --------------------------------
 -- HIGHLANDER / HOGS OF WAR
--- version 0.4b+
 -- by mikade
 --------------------------------
 
+-- Ancient changelog:
+
 -----------
 --0.1
 -----------
@@ -132,11 +133,17 @@
 
 local someHog = nil -- just for looking up the weps
 
+-- Script parameter stuff
 local mode = nil
 
+-- If true, killing hogs of your own clan doesn't give you their weapons.
+-- Otherwise, killing any hog gives you their weapons.
+local loyal = false
+
 function onParameters()
     parseParams()
     mode = params["mode"]
+    loyal = params["loyal"] == "true"
 end
 
 function CheckForWeaponSwap()
@@ -217,7 +224,7 @@
 -- this is called when a hog dies
 function TransferWeps(gear)
 
-	if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear then
+	if CurrentHedgehog ~= nil and CurrentHedgehog ~= gear and (not loyal or (GetHogClan(CurrentHedgehog) ~= GetHogClan(gear))) then
 
         local x,y,color
         local vgear
@@ -273,8 +280,12 @@
 	EnableGameFlags(gfInfAttack, gfRandomOrder, gfPerHogAmmo)
 	DisableGameFlags(gfResetWeps, gfSharedAmmo)
 	HealthCaseProb = 100
-	Goals = loc("Highlander: Eliminate enemy hogs to take their weapons") .. "|" ..
-	loc("Replenishment: Weapons are restocked on turn start of a new hog")
+	if loyal then
+		Goals = loc("Loyal Highlander: Eliminate enemy hogs to take their weapons") .. "|"
+	else
+		Goals = loc("Highlander: Eliminate hogs to take their weapons") .. "|"
+	end
+	Goals = Goals .. loc("Replenishment: Weapons are restocked on turn start of a new hog")
 end
 
 function onGameStart()