share/hedgewars/Data/Scripts/Multiplayer/The_Specialists.lua
changeset 14537 f5487302d53b
parent 14422 6c21bd8547dd
child 14538 2fd8f4cd3aa4
equal deleted inserted replaced
14536:b54ba97c02d7 14537:f5487302d53b
    52 -- balance hog health, maybe
    52 -- balance hog health, maybe
    53 -- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything)
    53 -- add proper gameflag checking, maybe (so that we can throw in a .cfg and let the users break everything)
    54 
    54 
    55 HedgewarsScriptLoad("/Scripts/Locale.lua")
    55 HedgewarsScriptLoad("/Scripts/Locale.lua")
    56 HedgewarsScriptLoad("/Scripts/Tracker.lua")
    56 HedgewarsScriptLoad("/Scripts/Tracker.lua")
       
    57 HedgewarsScriptLoad("/Scripts/Params.lua")
       
    58 
       
    59 -- S=(S)oldier D=(D)emo E=(E)ngineer N=(N)inja P=(P)yro C=(C)lown H=(H)olyman[saint] X=Sniper [running out of letters, but X-out or X-hair or something]
       
    60 -- default team values
       
    61 local currTeamIdx = 0;
       
    62 local teamRoles = 
       
    63         {
       
    64             {'S','E','N','D','X','H','P','C'},
       
    65             {'S','E','N','D','X','H','P','C'},
       
    66             {'S','E','N','D','X','H','P','C'},
       
    67             {'S','E','N','D','X','H','P','C'},
       
    68             {'S','E','N','D','X','H','P','C'},
       
    69             {'S','E','N','D','X','H','P','C'},
       
    70             {'S','E','N','D','X','H','P','C'},
       
    71             {'S','E','N','D','X','H','P','C'}
       
    72         };
    57 
    73 
    58 local numhhs = 0
    74 local numhhs = 0
    59 local hhs = {}
    75 local hhs = {}
    60 
    76 
    61 local started = false
    77 local started = false
    62 
    78 
       
    79 function onParameters()
       
    80 	parseParams()
       
    81 	for i = 1, 8 do
       
    82         if params['t'..i] ~= nil then
       
    83             for j = 1, 8 do
       
    84                 if string.len(params['t'..i]) >= j  then
       
    85                     teamRoles[i][j] = string.upper(string.sub(params['t'..i],j,j));
       
    86                 end
       
    87             end
       
    88         end
       
    89     end
       
    90 end
       
    91 
    63 function onNewAmmoStore(groupIndex, hogIndex)
    92 function onNewAmmoStore(groupIndex, hogIndex)
    64 
    93 
    65 	SetAmmo(amSkip, 9, 0, 0, 0)
    94 	SetAmmo(amSkip, 9, 0, 0, 0)
    66 
    95     groupIndex = groupIndex + 1
    67 	if hogIndex == 0 then
    96     hogIndex = hogIndex + 1
       
    97 
       
    98     if teamRoles[groupIndex][hogIndex] == 'S' then
    68 		SetAmmo(amBazooka, 1, 0, 0, 0)
    99 		SetAmmo(amBazooka, 1, 0, 0, 0)
    69 		SetAmmo(amGrenade, 1, 0, 0, 0)
   100 		SetAmmo(amGrenade, 1, 0, 0, 0)
    70 		SetAmmo(amShotgun, 1, 0, 0, 0)
   101 		SetAmmo(amShotgun, 1, 0, 0, 0)
    71 	elseif hogIndex == 1 then
   102     elseif teamRoles[groupIndex][hogIndex] == 'E' then
    72 		SetAmmo(amGirder, 2, 0, 0, 0)
   103 		SetAmmo(amGirder, 2, 0, 0, 0)
    73 		SetAmmo(amBlowTorch, 1, 0, 0, 0)
   104 		SetAmmo(amBlowTorch, 1, 0, 0, 0)
    74 		SetAmmo(amPickHammer, 1, 0, 0, 0)
   105 		SetAmmo(amPickHammer, 1, 0, 0, 0)
    75 	elseif hogIndex == 2 then
   106     elseif teamRoles[groupIndex][hogIndex] == 'N' then
    76 		SetAmmo(amRope, 9, 0, 0, 0)
   107 		SetAmmo(amRope, 9, 0, 0, 0)
    77 		SetAmmo(amParachute, 9, 0, 0, 0)
   108 		SetAmmo(amParachute, 9, 0, 0, 0)
    78 		SetAmmo(amFirePunch, 1, 0, 0, 0)
   109 		SetAmmo(amFirePunch, 1, 0, 0, 0)
    79 	elseif hogIndex == 3 then
   110     elseif teamRoles[groupIndex][hogIndex] == 'D' then
    80 		SetAmmo(amDynamite, 1, 0, 0, 0)
   111 		SetAmmo(amDynamite, 1, 0, 0, 0)
    81 		SetAmmo(amMine, 1, 0, 0, 0)
   112 		SetAmmo(amMine, 1, 0, 0, 0)
    82 		SetAmmo(amDrill, 1, 0, 0, 0)
   113 		SetAmmo(amDrill, 1, 0, 0, 0)
    83 	elseif hogIndex == 4 then
   114     elseif teamRoles[groupIndex][hogIndex] == 'X' then
    84 		SetAmmo(amSniperRifle, 1, 0, 0, 0)
   115 		SetAmmo(amSniperRifle, 1, 0, 0, 0)
    85 		SetAmmo(amDEagle, 1, 0, 0, 0)
   116 		SetAmmo(amDEagle, 1, 0, 0, 0)
    86 		SetAmmo(amPortalGun, 2, 0, 0, 0)
   117 		SetAmmo(amPortalGun, 2, 0, 0, 0)
    87 	elseif hogIndex == 5 then
   118     elseif teamRoles[groupIndex][hogIndex] == 'H' then
    88 		SetAmmo(amSeduction, 9, 0, 0, 0)
   119 		SetAmmo(amSeduction, 9, 0, 0, 0)
    89 		SetAmmo(amResurrector, 1, 0, 0, 0)
   120 		SetAmmo(amResurrector, 1, 0, 0, 0)
    90 		SetAmmo(amInvulnerable, 1, 0, 0, 0)
   121 		SetAmmo(amInvulnerable, 1, 0, 0, 0)
    91         SetAmmo(amLowGravity, 1, 0, 0, 0)
   122         SetAmmo(amLowGravity, 1, 0, 0, 0)
    92 	elseif hogIndex == 6 then
   123     elseif teamRoles[groupIndex][hogIndex] == 'P' then
    93 		SetAmmo(amFlamethrower, 1, 0, 0, 0)
   124 		SetAmmo(amFlamethrower, 1, 0, 0, 0)
    94 		SetAmmo(amMolotov, 1, 0, 0, 0)
   125 		SetAmmo(amMolotov, 1, 0, 0, 0)
    95 		SetAmmo(amNapalm, 1, 0, 0, 0)
   126 		SetAmmo(amNapalm, 1, 0, 0, 0)
    96 	elseif hogIndex == 7 then
   127     elseif teamRoles[groupIndex][hogIndex] == 'C' then
    97 		SetAmmo(amBaseballBat, 1, 0, 0, 0)
   128 		SetAmmo(amBaseballBat, 1, 0, 0, 0)
    98 		SetAmmo(amGasBomb, 1, 0, 0, 0)
   129 		SetAmmo(amGasBomb, 1, 0, 0, 0)
    99 		SetAmmo(amKamikaze, 1, 0, 0, 0)
   130 		SetAmmo(amKamikaze, 1, 0, 0, 0)
   100 	end
   131 	end
   101 
   132 
   113 
   144 
   114 			if currTeam == lastTeam then
   145 			if currTeam == lastTeam then
   115 					z = z + 1
   146 					z = z + 1
   116 			else
   147 			else
   117 					z = 1
   148 					z = 1
       
   149                     currTeamIdx = currTeamIdx + 1;
   118 			end
   150 			end
   119 
   151 
   120 			if z == 1 then
   152 			if teamRoles[currTeamIdx][z] == 'S' then
   121 
   153 
   122 					SetHogName(hhs[i],loc("Soldier"))
   154 					SetHogName(hhs[i],loc("Soldier"))
   123 					SetHogHat(hhs[i], "sf_vega")
   155 					SetHogHat(hhs[i], "sf_vega")
   124 					SetHealth(hhs[i],200)
   156 					SetHealth(hhs[i],200)
   125 
   157 
   126 			elseif z == 2 then
   158 			elseif teamRoles[currTeamIdx][z] == 'E' then
   127 
   159 
   128 					SetHogHat(hhs[i], "Glasses")
   160 					SetHogHat(hhs[i], "Glasses")
   129 					SetHogName(hhs[i],loc("Engineer"))
   161 					SetHogName(hhs[i],loc("Engineer"))
   130 
   162 
   131 			elseif z == 3 then
   163 			elseif teamRoles[currTeamIdx][z] == 'N' then
   132 
   164 
   133 					SetHogName(hhs[i],loc("Ninja"))
   165 					SetHogName(hhs[i],loc("Ninja"))
   134 					SetHogHat(hhs[i], "NinjaFull")
   166 					SetHogHat(hhs[i], "NinjaFull")
   135 					SetHealth(hhs[i],80)
   167 					SetHealth(hhs[i],80)
   136 
   168 
   137 			elseif z == 4 then
   169 			elseif teamRoles[currTeamIdx][z] == 'D' then
   138 
   170 
   139 					SetHogName(hhs[i],loc("Demo"))
   171 					SetHogName(hhs[i],loc("Demo"))
   140 					SetHogHat(hhs[i], "Skull")
   172 					SetHogHat(hhs[i], "Skull")
   141 					SetHealth(hhs[i],200)
   173 					SetHealth(hhs[i],200)
   142 
   174 
   143 			elseif z == 5 then
   175 			elseif teamRoles[currTeamIdx][z] == 'X' then
   144 
   176 
   145 					SetHogName(hhs[i],loc("Sniper"))
   177 					SetHogName(hhs[i],loc("Sniper"))
   146 					SetHogHat(hhs[i], "Sniper")
   178 					SetHogHat(hhs[i], "Sniper")
   147 					SetHealth(hhs[i],120)
   179 					SetHealth(hhs[i],120)
   148 
   180 
   149 			elseif z == 6 then
   181 			elseif teamRoles[currTeamIdx][z] == 'H' then
   150 
   182 
   151 					SetHogName(hhs[i],loc("Saint"))
   183 					SetHogName(hhs[i],loc("Saint"))
   152 					SetHogHat(hhs[i], "angel")
   184 					SetHogHat(hhs[i], "angel")
   153 					SetHealth(hhs[i],300)
   185 					SetHealth(hhs[i],300)
   154 
   186 
   155 			elseif z == 7 then
   187 			elseif teamRoles[currTeamIdx][z] == 'P' then
   156 
   188 
   157 					SetHogName(hhs[i],loc("Pyro"))
   189 					SetHogName(hhs[i],loc("Pyro"))
   158 					SetHogHat(hhs[i], "Gasmask")
   190 					SetHogHat(hhs[i], "Gasmask")
   159 					SetHealth(hhs[i],150)
   191 					SetHealth(hhs[i],150)
   160 
   192 
   161 			elseif z == 8 then
   193 			elseif teamRoles[currTeamIdx][z] == 'C' then
   162 
   194 
   163 					SetHogName(hhs[i],loc("Loon"))
   195 					SetHogName(hhs[i],loc("Loon"))
   164 					SetHogHat(hhs[i], "clown")
   196 					SetHogHat(hhs[i], "clown")
   165 					SetHealth(hhs[i],100)
   197 					SetHealth(hhs[i],100)
   166 
   198 
   172 
   204 
   173 end
   205 end
   174 
   206 
   175 function onGameInit()
   207 function onGameInit()
   176 	ClearGameFlags()
   208 	ClearGameFlags()
   177 	EnableGameFlags(gfRandomOrder, gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo, gfSwitchHog)
   209 	EnableGameFlags(gfResetWeps, gfInfAttack, gfPlaceHog, gfPerHogAmmo, gfSwitchHog)
   178 	HealthCaseProb = 100
   210 	HealthCaseProb = 100
   179 end
   211 end
   180 
   212 
   181 function onGameStart()
   213 function onGameStart()
   182 
   214