share/hedgewars/Data/Scripts/Multiplayer/Continental_supplies.lua
author Vatten
Sat, 22 Nov 2014 17:46:04 +0100
changeset 10527 285b428f391c
parent 10453 7e90d5856d56
child 10956 80c3314f8123
permissions -rw-r--r--
desync fix for Continental Supplies
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
     1
--[[
10527
285b428f391c desync fix for Continental Supplies
Vatten
parents: 10453
diff changeset
     2
Made for 0.9.21
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
     3
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
     4
Copyright (C) 2012 Vatten
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
     5
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
     6
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
     7
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
     8
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
     9
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    10
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    11
]]
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    12
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7936
diff changeset
    13
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7936
diff changeset
    14
HedgewarsScriptLoad("/Scripts/Utils.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7936
diff changeset
    15
HedgewarsScriptLoad("/Scripts/Tracker.lua")
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    16
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    17
function int_sqrt(num)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    18
	local temp=num
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    19
	while(temp*temp-div(temp,2)>num)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    20
	do
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    21
		temp=div((temp+div(num,temp)),2)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    22
	end
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    23
	
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    24
	return math.abs(temp)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    25
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    26
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    27
function norm(xx,yy)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    28
	--to fix overflows
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    29
	if(((math.abs(xx)^2)+(math.abs(yy)^2))>2^26)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    30
	then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    31
		local bitr=2^13
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    32
		return int_sqrt((div(math.abs(xx),bitr)^2)+(div(math.abs(yy),bitr)^2))*bitr
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    33
	else
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    34
		return int_sqrt((math.abs(xx)^2)+(math.abs(yy)^2))
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    35
	end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    36
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    37
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    38
function positive(num)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    39
	if(num<0)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    40
	then
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    41
		return -1
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    42
	else
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    43
		return 1
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    44
	end
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    45
end
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
    46
10527
285b428f391c desync fix for Continental Supplies
Vatten
parents: 10453
diff changeset
    47
function EndTurn()
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    48
	SetState(CurrentHedgehog,bor(GetState(CurrentHedgehog),gstAttacked))
10527
285b428f391c desync fix for Continental Supplies
Vatten
parents: 10453
diff changeset
    49
	--3 sec espace time
285b428f391c desync fix for Continental Supplies
Vatten
parents: 10453
diff changeset
    50
	TurnTimeLeft = GetAwayTime*10*3
285b428f391c desync fix for Continental Supplies
Vatten
parents: 10453
diff changeset
    51
end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    52
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    53
--for sundaland
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    54
local turnhog=0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    55
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    56
local teams_ok = {}
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    57
local wepcode_teams={}
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    58
local swapweps=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    59
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    60
--variables for seeing if you have swaped around on a weapon
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    61
local australianSpecial=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    62
local africanSpecial=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    63
local africaspecial2=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    64
local samericanSpecial=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    65
local namericanSpecial=1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    66
local sniper_s_in_use=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    67
local kergulenSpecial=1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    68
local shotgun_s=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    69
local europe_s=0
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    70
local VampOn=0
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    71
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    72
local austmine=nil
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    73
local inpara=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    74
local asianflame=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    75
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    76
local visualcircle=nil
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    77
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    78
local temp_val=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    79
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    80
--for sabotage
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    81
local disallowattack=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    82
local disable_moving={}
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    83
local disableRand=0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    84
--local disableoffsetai=0
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    85
local onsabotageai=false
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    86
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    87
local continent = {}
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    88
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    89
local generalinfo="- "..loc("Per team weapons").."|- 10 "..loc("weaponschemes").."|- "..loc("Unique new weapons").."| |"..loc("Select continent first round with the Weapon Menu or by").." (["..loc("switch").."/"..loc("tab").."]="..loc("Increase")..",["..loc("presice").."/"..loc("left shift").."]="..loc("Decrease")..") "..loc("on Skip").."|"..loc("Some weapons have a second option. Find them with").." ["..loc("switch").."/"..loc("tab").."]"
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    90
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    91
local weapontexts = {
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    92
loc("Green lipstick bullet: [Poisonous, deals no damage]"),
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    93
loc("REMOVED"),
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    94
loc("Anno 1032: [The explosion will make a strong push ~ Wide range, wont affect hogs close to the target]"),
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
    95
loc("Dust storm: [Deals 15 damage to all enemies in the circle]"),
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    96
loc("Cricket time: [Drop a fireable mine! ~ Will work if fired close to your hog & far away from enemy ~ 1 sec]"),
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    97
loc("Drop a bomb: [Drop some heroic wind that will turn into a bomb on impact]"),
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
    98
loc("Penguin roar: [Deal 15 damage + 15% of your hogs health to all hogs around you and get 2/3 back]"),
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
    99
loc("Disguise as a Rockhopper Penguin: [Swap place with a random enemy hog in the circle]"),
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   100
loc("REMOVED"),
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   101
loc("Lonely Cries: [Rise the water if no hog is in the circle and deal 7 damage to all enemy hogs]"),
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   102
loc("Hedgehog projectile: [Fire your hog like a Sticky Bomb]"),
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   103
loc("Napalm rocket: [Fire a bomb with napalm!]"),
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   104
loc("Eagle Eye: [Blink to the impact ~ One shot]"),
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   105
loc("Medicine: [Fire some exploding medicine that will heal all hogs effected by the explosion]"),
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   106
loc("Sabotage/Flare: [Sabotage all hogs in the circle and deal ~1 dmg OR Fire a cluster up into the air]")
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   107
}
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   108
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   109
local weaponsets = 
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   110
{
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   111
{loc("North America"),loc("Area")..": 24,709,000 km2, "..loc("Population")..": 529,000,000",loc("- Will give you an airstrike every fifth turn.").."|"..loc("Special Weapons:").."|"..loc("Shotgun")..": "..weapontexts[13].."|"..loc("Sniper Rifle")..": "..weapontexts[1],amSniperRifle,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   112
{{amShotgun,100},{amDEagle,100},{amLaserSight,4},{amSniperRifle,100},{amCake,1},{amAirAttack,2},{amSwitch,5}}},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   113
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   114
{loc("South America"),loc("Area")..": 17,840,000 km2, "..loc("Population")..": 387,000,000",loc("Special Weapons:").."|"..loc("GasBomb")..": "..weapontexts[3],amGasBomb,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   115
{{amBirdy,100},{amHellishBomb,1},{amBee,100},{amGasBomb,100},{amFlamethrower,100},{amNapalm,1},{amExtraDamage,3}}},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   116
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   117
{loc("Europe"),loc("Area")..": 10,180,000 km2, "..loc("Population")..": 740,000,000",loc("Special Weapons:").."|"..loc("Molotov")..": "..weapontexts[14],amBazooka,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   118
{{amBazooka,100},{amGrenade,100},{amMortar,100},{amMolotov,100},{amVampiric,3},{amPiano,1},{amResurrector,2},{amJetpack,4}}},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   119
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   120
{loc("Africa"),loc("Area")..": 30,222,000 km2, "..loc("Population")..": 1,033,000,000",loc("Special Weapons:").."|"..loc("Seduction")..": "..weapontexts[4].."|"..loc("Sticky Mine")..": "..weapontexts[11].."|"..loc("Sticky Mine")..": "..weapontexts[12],amSMine,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   121
{{amSMine,100},{amWatermelon,1},{amDrillStrike,1},{amDrill,100},{amInvulnerable,4},{amSeduction,100},{amLandGun,2}}},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   122
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   123
{loc("Asia"),loc("Area")..": 44,579,000 km2, "..loc("Population")..": 3,880,000,000",loc("- Will give you a parachute every second turn.").."|"..loc("Special Weapons:").."|"..loc("Parachute")..": "..weapontexts[6],amRope,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   124
{{amRope,100},{amFirePunch,100},{amParachute,1},{amKnife,2},{amDynamite,1}}},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   125
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   126
{loc("Australia"),loc("Area")..": 8,468,000 km2, "..loc("Population")..": 31,000,000",loc("Special Weapons:").."|"..loc("Baseballbat")..": "..weapontexts[5],amBaseballBat,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   127
{{amBaseballBat,100},{amMine,100},{amLowGravity,4},{amBlowTorch,100},{amRCPlane,2},{amTeleport,3}}},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   128
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   129
{loc("Antarctica"),loc("Area")..": 14,000,000 km2, "..loc("Population")..": ~1,000",loc("Antarctic summer: - Will give you one girder/mudball and two sineguns/portals every fourth turn."),amIceGun,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   130
{{amSnowball,2},{amIceGun,2},{amPickHammer,100},{amSineGun,4},{amGirder,2},{amExtraTime,2},{amPortalGun,2}}},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   131
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   132
{loc("Kerguelen"),loc("Area")..": 1,100,000 km2, "..loc("Population")..": ~100",loc("Special Weapons:").."|"..loc("Hammer")..": "..weapontexts[7].."|"..loc("Hammer")..": "..weapontexts[8].." ("..loc("Duration")..": 2)|"..loc("Hammer")..": "..weapontexts[10].."|"..loc("Hammer")..": "..weapontexts[15],amHammer,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   133
{{amHammer,100},{amMineStrike,2},{amBallgun,1}}},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   134
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   135
{loc("Zealandia"),loc("Area")..": 3,500,000 km2, "..loc("Population")..": 5,000,000",loc("- Will Get 1-3 random weapons") .. "|" .. loc("- Massive weapon bonus on first turn"),amInvulnerable,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   136
{{amBazooka,1},{amGrenade,1},{amBlowTorch,1},{amSwitch,100},{amRope,1},{amDrill,1},{amDEagle,1},{amPickHammer,1},{amFirePunch,1},{amWhip,1},{amMortar,1},{amSnowball,1},{amExtraTime,1},{amInvulnerable,1},{amVampiric,1},{amFlamethrower,1},{amBee,1},{amClusterBomb,1},{amTeleport,1},{amLowGravity,1},{amJetpack,1},{amGirder,1},{amLandGun,1},{amBirdy,1}}},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   137
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   138
{loc("Sundaland"),loc("Area")..": 1,850,000 km2, "..loc("Population")..": 290,000,000",loc("- You will recieve 2-4 weapons on each kill! (Even on own hogs)"),amTardis,
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   139
{{amClusterBomb,3},{amTardis,4},{amWhip,100},{amKamikaze,4}}}
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   140
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   141
}
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   142
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   143
local weaponsetssounds=
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   144
{
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   145
	{sndShotgunFire,sndCover},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   146
	{sndEggBreak,sndLaugh},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   147
	{sndExplosion,sndEnemyDown},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   148
	{sndMelonImpact,sndCoward},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   149
	{sndRopeAttach,sndComeonthen},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   150
	{sndBaseballBat,sndNooo},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   151
	{sndSineGun,sndOops},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   152
	{sndPiano5,sndStupid},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   153
	{sndSplash,sndFirstBlood},
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   154
	{sndWarp,sndSameTeam}
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   155
}
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   156
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   157
--weapontype,ammo,?,duration,*times your choice,affect on random team (should be placed with 1,0,1,0,1 on the 6th option for better randomness)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   158
local weapons_dmg = {
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   159
	{amKamikaze, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   160
	{amSineGun, 0, 1, 0, 1, 1},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   161
	{amBazooka, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   162
	{amMineStrike, 0, 1, 5, 1, 2},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   163
	{amGrenade, 0, 1, 0, 1, 0},
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   164
	{amPiano, 0, 1, 5, 1, 0},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   165
	{amClusterBomb, 0, 1, 0, 1, 0},
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   166
	{amBee, 0, 1, 0, 1, 0},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   167
	{amShotgun, 0, 0, 0, 1, 1},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   168
	{amMine, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   169
	{amSniperRifle, 0, 1, 0, 1, 1},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   170
	{amDEagle, 0, 1, 0, 1, 0},
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   171
	{amDynamite, 0, 1, 5, 1, 1},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   172
	{amFirePunch, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   173
	{amHellishBomb, 0, 1, 5, 1, 2},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   174
	{amWhip, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   175
	{amNapalm, 0, 1, 5, 1, 2},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   176
	{amPickHammer, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   177
	{amBaseballBat, 0, 1, 0, 1, 1},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   178
	{amMortar, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   179
	{amCake, 0, 1, 4, 1, 2},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   180
	{amSeduction, 0, 0, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   181
	{amWatermelon, 0, 1, 5, 1, 2},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   182
	{amDrill, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   183
	{amBallgun, 0, 1, 5, 1, 2},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   184
	{amMolotov, 0, 1, 0, 1, 0},
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   185
	{amBirdy, 0, 1, 0, 1, 0},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   186
	{amBlowTorch, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   187
	{amRCPlane, 0, 1, 5, 1, 2},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   188
	{amGasBomb, 0, 0, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   189
	{amAirAttack, 0, 1, 4, 1, 1},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   190
	{amFlamethrower, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   191
	{amSMine, 0, 1, 0, 1, 1},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   192
	{amHammer, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   193
	{amDrillStrike, 0, 1, 4, 1, 2},
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   194
	{amSnowball, 0, 1, 0, 1, 0}
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   195
}
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   196
local weapons_supp = {
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   197
	{amParachute, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   198
	{amGirder, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   199
	{amSwitch, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   200
	{amLowGravity, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   201
	{amExtraDamage, 0, 1, 2, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   202
	{amRope, 0, 1, 0, 1, 1},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   203
	{amInvulnerable, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   204
	{amExtraTime, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   205
	{amLaserSight, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   206
	{amVampiric, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   207
	{amJetpack, 0, 1, 0, 1, 1},
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   208
	{amPortalGun, 0, 1, 2, 1, 1},
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   209
	{amResurrector, 0, 1, 3, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   210
	{amTeleport, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   211
	{amLandGun, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   212
	{amTardis, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   213
	{amIceGun, 0, 1, 0, 1, 0},
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   214
	{amKnife, 0, 1, 0, 1, 0}
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   215
}
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   216
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   217
--will check after borders and stuff
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   218
function validate_weapon(hog,weapon,amount)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   219
	if(MapHasBorder() == false or (MapHasBorder() == true and weapon ~= amAirAttack and weapon ~= amMineStrike and weapon ~= amNapalm and weapon ~= amDrillStrike and weapon ~= amPiano))
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   220
	then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   221
		if(amount==1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   222
		then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   223
			AddAmmo(hog, weapon)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   224
		else
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   225
			AddAmmo(hog, weapon,amount)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   226
		end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   227
	end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   228
end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   229
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   230
function RemoveWeapon(hog,weapon)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   231
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   232
	if(GetAmmoCount(hog, weapon)<100)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   233
	then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   234
		AddAmmo(hog,weapon,GetAmmoCount(hog, weapon)-1)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   235
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   236
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   237
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   238
--reset all weapons for a team
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   239
function cleanweps(hog)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   240
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   241
	local i=1
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   242
	--+1 for skip +1 for freezer
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   243
	while(i<=table.maxn(weapons_supp)+table.maxn(weapons_dmg)+2)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   244
	do
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   245
		AddAmmo(hog,i,0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   246
		i=i+1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   247
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   248
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   249
	AddAmmo(hog,amSkip,100)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   250
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   251
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   252
--get the weapons from a weaponset
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   253
function load_weaponset(hog, num)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   254
	for v,w in pairs(weaponsets[num][5]) 
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   255
	do
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   256
		validate_weapon(hog, w[1],w[2])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   257
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   258
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   259
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   260
--list up all weapons from the icons for each continent
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   261
function load_continent_selection(hog)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   262
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   263
	if(GetHogLevel(hog)==0)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   264
	then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   265
		for v,w in pairs(weaponsets) 
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   266
		do
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   267
			validate_weapon(hog, weaponsets[v][4],1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   268
		end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   269
		AddAmmo(hog,amSwitch) --random continent
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   270
	
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   271
	--for the computers
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   272
	else
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   273
		--europe
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   274
		validate_weapon(hog, weaponsets[3][4],1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   275
		--north america
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   276
		validate_weapon(hog, weaponsets[1][4],1)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   277
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   278
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   279
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   280
--shows the continent info
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   281
function show_continent_info(continent,time,generalinf)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   282
	local geninftext=""
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   283
	local ns=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   284
	if(time==-1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   285
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   286
		time=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   287
		ns=true
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   288
	end
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   289
	if(generalinf)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   290
	then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   291
		geninftext="| |"..loc("General information")..": |"..generalinfo
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   292
	end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   293
	ShowMission(weaponsets[continent][1],weaponsets[continent][2],weaponsets[continent][3]..geninftext, -weaponsets[continent][4], time)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   294
	if(ns)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   295
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   296
		HideMission()
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   297
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   298
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   299
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   300
--will show a circle of gears (eye candy)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   301
function visual_gear_explosion(range,xpos,ypos,gear1,gear2)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   302
	local degr=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   303
	local lap=30
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   304
	while(lap<range)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   305
	do
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   306
		while(degr < 6.2831)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   307
		do
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   308
			AddVisualGear(xpos+math.cos(degr+0.1)*(lap+5), ypos+math.sin(degr+0.1)*(lap+5), gear1, 0, false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   309
			if(gear2~=false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   310
			then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   311
				AddVisualGear(xpos+math.cos(degr)*lap, ypos+math.sin(degr)*lap, gear2, 0, false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   312
			end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   313
			degr=degr+((3.1415*3)*0.125) --1/8 = 0.125
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   314
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   315
		lap=lap+30
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   316
		degr=degr-6.2831
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   317
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   318
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   319
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   320
--zealandia (generates weapons from the weaponinfo above
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   321
function get_random_weapon(hog)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   322
	if(GetGearType(hog) == gtHedgehog and continent[GetHogTeamName(hog)]==9 and getTeamValue(GetHogTeamName(hog), "rand-done-turn")==nil)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   323
	then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   324
		cleanweps(hog)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   325
	
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   326
		local random_weapon = 0
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   327
		local old_rand_weap = 0
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   328
		local rand_weaponset_power = 0
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   329
		
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   330
		local numberof_weapons_supp=table.maxn(weapons_supp)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   331
		local numberof_weapons_dmg=table.maxn(weapons_dmg)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   332
		
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   333
		local rand1=math.abs(GetRandom(numberof_weapons_supp)+1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   334
		local rand2=math.abs(GetRandom(numberof_weapons_dmg)+1)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   335
		
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   336
		random_weapon = math.abs(GetRandom(table.maxn(weapons_dmg))+1)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   337
		
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   338
		while(weapons_dmg[random_weapon][4]>TotalRounds or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   339
		do
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   340
			if(random_weapon>=numberof_weapons_dmg)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   341
			then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   342
				random_weapon=0
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   343
			end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   344
			random_weapon = random_weapon+1
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   345
		end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   346
		validate_weapon(hog, weapons_dmg[random_weapon][1],1)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   347
		rand_weaponset_power=weapons_dmg[random_weapon][6]
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   348
		old_rand_weap = random_weapon
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   349
		
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   350
		if(rand_weaponset_power <2)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   351
		then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   352
			random_weapon = rand1
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   353
			while(weapons_supp[random_weapon][4]>TotalRounds or rand_weaponset_power+weapons_supp[random_weapon][6]>2)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   354
			do
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   355
				if(random_weapon>=numberof_weapons_supp)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   356
				then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   357
					random_weapon=0
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   358
				end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   359
				random_weapon = random_weapon+1
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   360
			end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   361
			validate_weapon(hog, weapons_supp[random_weapon][1],1)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   362
			rand_weaponset_power=rand_weaponset_power+weapons_supp[random_weapon][6]
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   363
		end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   364
		--check again if  the power is enough
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   365
		if(rand_weaponset_power <1)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   366
		then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   367
			random_weapon = rand2
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   368
			while(weapons_dmg[random_weapon][4]>TotalRounds or old_rand_weap == random_weapon or weapons_dmg[random_weapon][6]>0 or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   369
			do
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   370
				if(random_weapon>=numberof_weapons_dmg)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   371
				then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   372
					random_weapon=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   373
				end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   374
				random_weapon = random_weapon+1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   375
			end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   376
			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   377
		end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   378
			
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   379
		setTeamValue(GetHogTeamName(hog), "rand-done-turn", true)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   380
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   381
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   382
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   383
--sundaland add weps
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   384
function get_random_weapon_on_death(hog)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   385
	
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   386
		local random_weapon = 0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   387
		local old_rand_weap = 0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   388
		local rand_weaponset_power = 0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   389
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   390
		local firstTurn=0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   391
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   392
		local numberof_weapons_supp=table.maxn(weapons_supp)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   393
		local numberof_weapons_dmg=table.maxn(weapons_dmg)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   394
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   395
		local rand1=GetRandom(numberof_weapons_supp)+1
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   396
		local rand2=GetRandom(numberof_weapons_dmg)+1
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   397
		local rand3=GetRandom(numberof_weapons_dmg)+1
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   398
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   399
		random_weapon = GetRandom(numberof_weapons_dmg)+1
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   400
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   401
		if(TotalRounds<0)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   402
		then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   403
			firstTurn=-TotalRounds
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   404
		end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   405
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   406
		while(weapons_dmg[random_weapon][4]>(TotalRounds+firstTurn) or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   407
		do
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   408
			if(random_weapon>=numberof_weapons_dmg)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   409
			then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   410
				random_weapon=0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   411
			end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   412
			random_weapon = random_weapon+1
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   413
		end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   414
		validate_weapon(hog, weapons_dmg[random_weapon][1],1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   415
		rand_weaponset_power=weapons_dmg[random_weapon][6]
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   416
		old_rand_weap = random_weapon
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   417
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   418
		random_weapon = rand1
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   419
		while(weapons_supp[random_weapon][4]>(TotalRounds+firstTurn) or rand_weaponset_power+weapons_supp[random_weapon][6]>2)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   420
		do
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   421
			if(random_weapon>=numberof_weapons_supp)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   422
			then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   423
				random_weapon=0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   424
			end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   425
			random_weapon = random_weapon+1
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   426
		end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   427
		validate_weapon(hog, weapons_supp[random_weapon][1],1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   428
		rand_weaponset_power=rand_weaponset_power+weapons_supp[random_weapon][6]
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   429
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   430
		--check again if  the power is enough
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   431
		if(rand_weaponset_power <2)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   432
		then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   433
			random_weapon = rand2
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   434
			while(weapons_dmg[random_weapon][4]>(TotalRounds+firstTurn) or old_rand_weap == random_weapon or weapons_dmg[random_weapon][6]>0 or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   435
			do
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   436
				if(random_weapon>=numberof_weapons_dmg)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   437
				then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   438
					random_weapon=0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   439
				end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   440
				random_weapon = random_weapon+1
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   441
			end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   442
			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   443
			rand_weaponset_power=weapons_dmg[random_weapon][6]
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   444
		end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   445
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   446
		if(rand_weaponset_power <1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   447
		then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   448
			random_weapon = rand3
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   449
			while(weapons_dmg[random_weapon][4]>(TotalRounds+firstTurn) or old_rand_weap == random_weapon or weapons_dmg[random_weapon][6]>0 or (MapHasBorder() == true and (weapons_dmg[random_weapon][1]== amAirAttack or weapons_dmg[random_weapon][1] == amMineStrike or weapons_dmg[random_weapon][1] == amNapalm or weapons_dmg[random_weapon][1] == amDrillStrike or weapons_dmg[random_weapon][1] == amPiano)))
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   450
			do
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   451
				if(random_weapon>=numberof_weapons_dmg)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   452
				then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   453
					random_weapon=0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   454
				end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   455
				random_weapon = random_weapon+1
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   456
			end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   457
			validate_weapon(hog, weapons_dmg[random_weapon][1],1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   458
		end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   459
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   460
		AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace,0, false)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   461
		PlaySound(sndReinforce,hog)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   462
end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   463
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   464
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   465
--this will take that hogs settings for the weapons and add them
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   466
function setweapons()
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   467
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   468
	cleanweps(CurrentHedgehog)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   469
	load_weaponset(CurrentHedgehog,continent[GetHogTeamName(CurrentHedgehog)])
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   470
	
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   471
	visualstuff=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-5, vgtDust,0, false)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   472
	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(visualstuff)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   473
	SetVisualGearValues(visualstuff, v1, v2, v3, v4, v5, v6, v7, 2, v9, GetClanColor(GetHogClan(CurrentHedgehog)))
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   474
	
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   475
	show_continent_info(continent[GetHogTeamName(CurrentHedgehog)],0,false)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   476
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   477
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   478
--show health tag (will mostly be used when a hog is damaged)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   479
function show_damage_tag(hog,damage)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   480
	healthtag=AddVisualGear(GetX(hog), GetY(hog), vgtHealthTag, damage, false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   481
	v1, v2, v3, v4, v5, v6, v7, v8, v9, v10 = GetVisualGearValues(healthtag)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   482
	SetVisualGearValues(healthtag, v1, v2, v3, v4, v5, v6, v7, v8, v9, GetClanColor(GetHogClan(hog)))
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   483
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   484
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   485
--will use int_sqrt
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   486
function fire_gear(hedgehog,geartype,vx,vy,timer)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   487
	local hypo=norm(vx,vy)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   488
	return AddGear(div((GetGearRadius(hedgehog)*2*vx),hypo)+GetX(hedgehog), div((GetGearRadius(hedgehog)*2*vy),hypo)+GetY(hedgehog), geartype, 0, vx, vy, timer)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   489
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   490
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   491
--==========================run throw all hog/gear weapons ==========================
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   492
--will check if the mine is nicely placed 
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   493
function weapon_aust_check(hog)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   494
	if(GetGearType(hog) == gtHedgehog)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   495
	then
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   496
		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 50, false)==true and hog ~= CurrentHedgehog)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   497
		then
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   498
			temp_val=1
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   499
		end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   500
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   501
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   502
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   503
--african special on sedunction
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   504
function weapon_duststorm(hog)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   505
	if(GetGearType(hog) == gtHedgehog)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   506
	then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   507
		local dmg=15
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   508
		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 250, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   509
		then
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   510
			if(GetHealth(hog) > dmg)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   511
			then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   512
				temp_val=temp_val+div(dmg*VampOn,100)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   513
				SetHealth(hog, GetHealth(hog)-dmg)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   514
			else
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   515
				temp_val=temp_val+div(GetHealth(hog)*VampOn,100)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   516
				SetHealth(hog, 0)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   517
			end
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   518
			show_damage_tag(hog,dmg)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   519
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   520
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   521
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   522
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   523
--kerguelen special on structure 
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   524
function weapon_scream_pen(hog)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   525
	if(GetGearType(hog) == gtHedgehog)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   526
	then
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   527
		if(gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 120, false)==true and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   528
		then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   529
			local dmg=15+GetHealth(CurrentHedgehog)*0.15
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   530
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   531
			if(GetHealth(hog)>dmg)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   532
			then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   533
				temp_val=temp_val+div(dmg*2,3)+div(dmg*VampOn*2,100*3)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   534
				SetHealth(hog, GetHealth(hog)-dmg)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   535
			else
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   536
				temp_val=temp_val+(GetHealth(hog)*0.75)+(GetHealth(CurrentHedgehog)*0.1)+div((GetHealth(hog)+(GetHealth(CurrentHedgehog)*0.15))*VampOn,100)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   537
				SetHealth(hog, 0)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   538
			end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   539
			show_damage_tag(hog,dmg)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   540
			AddVisualGear(GetX(hog), GetY(hog), vgtExplosion, 0, false)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   541
			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   542
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   543
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   544
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   545
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   546
--kerguelen special swap hog
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   547
function weapon_swap_kerg(hog)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   548
	if(GetGearType(hog) == gtHedgehog)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   549
	then
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   550
		if(kergulenSpecial ~= -1 and GetHogClan(hog) ~= GetHogClan(CurrentHedgehog) and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 450, false))
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   551
		then
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   552
			local thisX=GetX(CurrentHedgehog)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   553
			local thisY=GetY(CurrentHedgehog)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   554
			SetGearPosition(CurrentHedgehog, GetX(hog), GetY(hog))
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   555
			SetGearPosition(hog, thisX, thisY)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   556
			kergulenSpecial=-1
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   557
		end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   558
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   559
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   560
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   561
--kerguelen special will apply sabotage
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   562
function weapon_sabotage(hog)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   563
	if(GetGearType(hog) == gtHedgehog)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   564
	then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   565
		if(CurrentHedgehog~=hog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 80, false))
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   566
		then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   567
			temp_val=1
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   568
			disable_moving[hog]=true
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   569
			AddGear(GetX(hog), GetY(hog), gtCluster, 0, 0, 0, 1)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   570
			PlaySound(sndNooo,hog)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   571
		end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   572
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   573
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   574
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   575
--south american special (used fire gear)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   576
function weapon_anno_south(hog)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   577
	local power_radius_outer=230
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   578
	local power_radius_inner=45
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   579
	local power_sa=500000
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   580
	local hypo=0
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   581
	if(gearIsInCircle(hog,GetX(temp_val), GetY(temp_val), power_radius_outer, false) and gearIsInCircle(hog,GetX(temp_val), GetY(temp_val), power_radius_inner, false)==false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   582
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   583
		if(hog == CurrentHedgehog)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   584
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   585
			SetState(CurrentHedgehog, gstMoving)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   586
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   587
		SetGearPosition(hog, GetX(hog),GetY(hog)-3)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   588
		hypo=norm(math.abs(GetX(hog)-GetX(temp_val)),math.abs(GetY(hog)-GetY(temp_val)))
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   589
		SetGearVelocity(hog, div((power_radius_outer-hypo)*power_sa*positive(GetX(hog)-GetX(temp_val)),power_radius_outer), div((power_radius_outer-hypo)*power_sa*positive(GetY(hog)-GetY(temp_val)),power_radius_outer))
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   590
	end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   591
end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   592
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   593
--first part on kerguelen special (lonely cries)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   594
function weapon_cries_a(hog)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   595
	if(GetGearType(hog) == gtHedgehog and hog ~= CurrentHedgehog and gearIsInCircle(hog,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 500, false))
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   596
	then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   597
		kergulenSpecial=-1
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   598
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   599
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   600
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   601
--second part on kerguelen special (lonely cries)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   602
function weapon_cries_b(hog)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   603
	if(GetGearType(hog) == gtHedgehog)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   604
	then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   605
		local dmg=7
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   606
		if(GetHogClan(hog) ~= GetHogClan(CurrentHedgehog))
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   607
		then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   608
			if(GetHealth(hog) > dmg)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   609
			then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   610
				temp_val=temp_val+div(dmg*VampOn,100)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   611
				SetHealth(hog, GetHealth(hog)-dmg)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   612
			else
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   613
				temp_val=temp_val+div(GetHealth(hog)*VampOn,100)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   614
				SetHealth(hog, 0)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   615
			end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   616
			show_damage_tag(hog,dmg)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   617
			AddVisualGear(GetX(hog), GetY(hog)-30, vgtEvilTrace, 0, false)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   618
		end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   619
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   620
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   621
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   622
--north american special on sniper
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   623
function weapon_lipstick(hog)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   624
	if(GetGearType(hog) == gtHedgehog)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   625
	then
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   626
		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 20, false))
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   627
		then
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   628
			SetEffect(hog, hePoisoned, 1)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   629
			PlaySound(sndBump)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   630
		end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   631
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   632
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   633
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   634
--european special on molotov (used fire gear)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   635
function weapon_health(hog)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   636
	if(GetGearType(hog) == gtHedgehog)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   637
	then
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   638
		if(gearIsInCircle(temp_val,GetX(hog), GetY(hog), 100, false))
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   639
		then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   640
			SetHealth(hog, GetHealth(hog)+25+(div(25*VampOn,100)))
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   641
			SetEffect(hog, hePoisoned, false)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   642
		end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   643
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   644
end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   645
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   646
--for sundaland
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   647
function find_other_hog_in_team(hog)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   648
	if(GetGearType(hog) == gtHedgehog)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   649
	then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   650
		if(GetHogTeamName(turnhog)==GetHogTeamName(hog))
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   651
		then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   652
			turnhog=hog
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   653
		end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   654
	end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   655
end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   656
--============================================================================
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   657
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   658
--set each weapons settings
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   659
function onAmmoStoreInit()
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   660
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   661
	SetAmmo(amSkip, 9, 0, 0, 0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   662
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   663
	for v,w in pairs(weapons_dmg) 
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   664
	do
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   665
		SetAmmo(w[1], w[2], w[3], w[4], w[5])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   666
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   667
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   668
	for v,w in pairs(weapons_supp) 
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   669
	do
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   670
		SetAmmo(w[1], w[2], w[3], w[4], w[5])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   671
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   672
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   673
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   674
function onGameStart()
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   675
	--trackTeams()
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   676
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   677
	ShowMission(loc("Continental supplies"),loc("Let a Continent provide your weapons!"),
10453
7e90d5856d56 Remove loc() called with a variable.
nemo
parents: 9805
diff changeset
   678
	generalinfo, -amLowGravity, 0)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   679
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   680
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   681
--what happen when a turn starts
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   682
function onNewTurn()
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   683
	
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   684
	--will refresh the info on each tab weapon
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   685
	australianSpecial=true
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   686
	austmine=nil
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   687
	africanSpecial=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   688
	samericanSpecial=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   689
	africaspecial2=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   690
	kergulenSpecial=1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   691
	namericanSpecial=1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   692
	asianflame=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   693
	shotgun_s=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   694
	sniper_s_in_use=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   695
	europe_s=0
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   696
	VampOn=0
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   697
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   698
	temp_val=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   699
	
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   700
	turnhog=CurrentHedgehog
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   701
	
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   702
	--for sabotage
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   703
	if(disable_moving[CurrentHedgehog]==true)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   704
	then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   705
		disallowattack=-100
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   706
		disableRand=GetRandom(3)+5
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   707
	end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   708
	
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   709
	--when all hogs are "placed"
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   710
	if(GetCurAmmoType()~=amTeleport)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   711
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   712
		--will run once when the game really starts (after placing hogs and so on
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   713
		if(teams_ok[GetHogTeamName(CurrentHedgehog)] == nil)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   714
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   715
			AddCaption("["..loc("Select continent!").."]")
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   716
			load_continent_selection(CurrentHedgehog)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   717
			continent[GetHogTeamName(CurrentHedgehog)]=0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   718
			swapweps=true
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   719
			teams_ok[GetHogTeamName(CurrentHedgehog)] = 2
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   720
			
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   721
			if(disable_moving[CurrentHedgehog]==true)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   722
			then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   723
				disallowattack=-1000
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   724
			end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   725
		else
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   726
			--if its not the initialization turn
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   727
			swapweps=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   728
			if(continent[GetHogTeamName(CurrentHedgehog)]==0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   729
			then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   730
				continent[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(weaponsets))+1
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   731
				setweapons()
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   732
			end
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   733
			show_continent_info(continent[GetHogTeamName(CurrentHedgehog)],-1,true)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   734
			
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   735
			--give zeelandia-teams new weapons so they can plan for the next turn
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   736
			runOnGears(get_random_weapon)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   737
			
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   738
			--some specials for some continents (temp_val is from get random weapons)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   739
			if(continent[GetHogTeamName(CurrentHedgehog)]==9)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   740
			then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   741
				setTeamValue(GetHogTeamName(CurrentHedgehog), "rand-done-turn", nil)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   742
			elseif(continent[GetHogTeamName(CurrentHedgehog)]==7)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   743
			then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   744
				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")==nil)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   745
				then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   746
					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 1)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   747
				end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   748
				
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   749
				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")>=4)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   750
				then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   751
					AddAmmo(CurrentHedgehog,amPortalGun)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   752
					AddAmmo(CurrentHedgehog,amPortalGun)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   753
					AddAmmo(CurrentHedgehog,amSineGun)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   754
					AddAmmo(CurrentHedgehog,amSineGun)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   755
					AddAmmo(CurrentHedgehog,amGirder)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   756
					AddAmmo(CurrentHedgehog,amSnowball)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   757
					setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", 0)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   758
				end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   759
				setTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Antarctica2-turntick")+1)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   760
				
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   761
			elseif(continent[GetHogTeamName(CurrentHedgehog)]==5)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   762
			then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   763
				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")==nil)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   764
				then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   765
					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   766
				end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   767
				
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   768
				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")>=2)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   769
				then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   770
					AddAmmo(CurrentHedgehog,amParachute)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   771
					setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", 0)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   772
				end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   773
				setTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "Asia-turntick")+1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   774
			elseif(continent[GetHogTeamName(CurrentHedgehog)]==1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   775
			then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   776
				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick")==nil)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   777
				then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   778
					setTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick", 1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   779
				end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   780
				
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   781
				if(getTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick")>=5)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   782
				then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   783
					validate_weapon(CurrentHedgehog,amAirAttack,1)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   784
					setTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick", 0)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   785
				end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   786
				setTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick", getTeamValue(GetHogTeamName(CurrentHedgehog), "NA-turntick")+1)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   787
			end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   788
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   789
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   790
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   791
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   792
--what happens when you press "tab" (common button)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   793
function onSwitch()
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   794
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   795
	--place mine (australia)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   796
	if(GetCurAmmoType() == amBaseballBat and australianSpecial==true)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   797
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   798
		temp_val=0
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
   799
		runOnGears(weapon_aust_check)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   800
		
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   801
		if(temp_val==0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   802
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   803
			austmine=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+5, gtMine, 0, 0, 0, 0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   804
			SetHealth(austmine, 100)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   805
			SetTimer(austmine, 1000)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   806
			australianSpecial=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   807
			swapweps=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   808
		else
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   809
			PlaySound(sndDenied)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   810
		end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   811
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   812
	--Asian special
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   813
	elseif(inpara==1)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   814
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   815
		asiabomb=AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)+3, gtSnowball, 0, 0, 0, 0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   816
		SetGearMessage(asiabomb, 1)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   817
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   818
		inpara=2
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   819
		swapweps=false
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   820
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   821
	--africa
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   822
	elseif(GetCurAmmoType() == amSeduction)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   823
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   824
		if(africanSpecial==0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   825
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   826
			africanSpecial = 1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   827
			AddCaption(weapontexts[4])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   828
		else
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   829
			africanSpecial = 0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   830
			AddCaption(loc("NORMAL"))
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   831
		end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   832
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   833
	--south america
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   834
	elseif(GetCurAmmoType() == amGasBomb)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   835
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   836
		if(samericanSpecial==false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   837
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   838
			samericanSpecial = true
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   839
			AddCaption(weapontexts[3])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   840
		else
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   841
			samericanSpecial = false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   842
			AddCaption(loc("NORMAL"))
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   843
		end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   844
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   845
	--africa
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   846
	elseif(GetCurAmmoType() == amSMine)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   847
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   848
		if(africaspecial2==0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   849
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   850
			africaspecial2 = 1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   851
			AddCaption(weapontexts[11])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   852
		elseif(africaspecial2 == 1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   853
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   854
			africaspecial2 = 2
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   855
			AddCaption(weapontexts[12])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   856
		elseif(africaspecial2 == 2)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   857
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   858
			africaspecial2 = 0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   859
			AddCaption(loc("NORMAL"))
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   860
		end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   861
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   862
	--north america (sniper)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   863
	elseif(GetCurAmmoType() == amSniperRifle and sniper_s_in_use==false)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   864
	then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   865
		if(namericanSpecial==2)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   866
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   867
			namericanSpecial = 1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   868
			AddCaption(loc("NORMAL"))
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   869
		elseif(namericanSpecial==1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   870
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   871
			namericanSpecial = 2
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   872
			AddCaption("#"..weapontexts[1])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   873
		end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   874
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   875
	--north america (shotgun)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   876
	elseif(GetCurAmmoType() == amShotgun and shotgun_s~=nil)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   877
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   878
		if(shotgun_s==false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   879
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   880
			shotgun_s = true
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   881
			AddCaption(weapontexts[13])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   882
		else
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   883
			shotgun_s = false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   884
			AddCaption(loc("NORMAL"))
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   885
		end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   886
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   887
	--europe
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   888
	elseif(GetCurAmmoType() == amMolotov)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   889
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   890
		if(europe_s==0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   891
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   892
			europe_s = 1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   893
			AddCaption(weapontexts[14])
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   894
		else
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   895
			europe_s = 0
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   896
			AddCaption(loc("NORMAL"))
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   897
		end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   898
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   899
	--swap forward in the weaponmenu (1.0 style)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   900
	elseif(swapweps==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   901
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   902
		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]+1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   903
		
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   904
		if(continent[GetHogTeamName(CurrentHedgehog)]> table.maxn(weaponsets))
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   905
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   906
			continent[GetHogTeamName(CurrentHedgehog)]=1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   907
		end
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   908
		setweapons()
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   909
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   910
	--kerguelen
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   911
	elseif(GetCurAmmoType() == amHammer)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   912
	then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   913
		if(kergulenSpecial==6)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   914
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   915
			kergulenSpecial = 1
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   916
			AddCaption("Normal")
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   917
		elseif(kergulenSpecial==1)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   918
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   919
			kergulenSpecial = 2
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   920
			AddCaption("#"..weapontexts[7])
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   921
		elseif(kergulenSpecial==2 and TotalRounds>=1)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   922
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   923
			kergulenSpecial = 3
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   924
			AddCaption("##"..weapontexts[8])
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   925
		elseif(kergulenSpecial==3 or (kergulenSpecial==2 and TotalRounds<1))
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   926
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   927
			kergulenSpecial = 5
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   928
			AddCaption("###"..weapontexts[10])
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   929
		elseif(kergulenSpecial==5)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   930
		then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   931
			kergulenSpecial = 6
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   932
			AddCaption("####"..weapontexts[15])
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   933
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   934
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   935
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   936
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   937
function onPrecise()
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   938
	--swap backwards in the weaponmenu (1.0 style)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   939
	if(swapweps==true and (GetCurAmmoType() == amSkip or GetCurAmmoType() == amNothing))
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   940
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   941
		continent[GetHogTeamName(CurrentHedgehog)]=continent[GetHogTeamName(CurrentHedgehog)]-1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   942
		
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   943
		if(continent[GetHogTeamName(CurrentHedgehog)]<=0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   944
		then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   945
			continent[GetHogTeamName(CurrentHedgehog)]=table.maxn(weaponsets)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   946
		end
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   947
		setweapons()
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   948
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   949
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   950
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   951
function onGameTick20()
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   952
	--if you picked a weaponset from the weaponmenu (icon)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   953
	if(continent[GetHogTeamName(CurrentHedgehog)]==0)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   954
	then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   955
		if(GetCurAmmoType()==amSwitch)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   956
		then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   957
			continent[GetHogTeamName(CurrentHedgehog)]=GetRandom(table.maxn(weaponsets))+1
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   958
			setweapons()
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   959
			PlaySound(sndMineTick)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   960
		else
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   961
			for v,w in pairs(weaponsets) 
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   962
			do
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   963
				if(GetCurAmmoType()==weaponsets[v][4])
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   964
				then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   965
					continent[GetHogTeamName(CurrentHedgehog)]=v
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   966
					setweapons()
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   967
					PlaySound(weaponsetssounds[v][1])
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   968
					PlaySound(weaponsetssounds[v][2],CurrentHedgehog)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   969
				end
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   970
			end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   971
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   972
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   973
	
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   974
	--show the kerguelen ring
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   975
	if(kergulenSpecial > 1 and GetCurAmmoType() == amHammer)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   976
	then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   977
		if(visualcircle==nil)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   978
		then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   979
			visualcircle=AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtCircle, 0, true)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   980
		end
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   981
		
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   982
		if(kergulenSpecial == 2) --walrus scream
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   983
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   984
			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 120, 4, 0xff0000ee)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   985
		elseif(kergulenSpecial == 3) --swap hog
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   986
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   987
			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 450, 3, 0xffff00ee)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   988
		elseif(kergulenSpecial == 5) --cries
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   989
		then
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   990
			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 500, 1, 0x0000ffee)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
   991
		elseif(kergulenSpecial == 6) --sabotage
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   992
		then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
   993
			SetVisualGearValues(visualcircle, GetX(CurrentHedgehog), GetY(CurrentHedgehog),20, 200, 0, 0, 100, 80, 10, 0x00ff00ee)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   994
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   995
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   996
	elseif(visualcircle~=nil)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   997
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   998
		DeleteVisualGear(visualcircle)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
   999
		visualcircle=nil
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1000
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1001
	
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1002
	--sabotage
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1003
	if(disable_moving[CurrentHedgehog]==true)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1004
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1005
	
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1006
		if(TurnTimeLeft<=150)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1007
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1008
			disable_moving[CurrentHedgehog]=false
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1009
			SetInputMask(0xFFFFFFFF)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1010
		elseif(disallowattack >= (25*disableRand)+5)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1011
		then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1012
			temp_val=0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1013
			
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1014
			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-10, gtCluster, 0, 0, -160000, 40)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1015
			
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1016
			disallowattack=0
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1017
		elseif(disallowattack % 20 == 0 and disallowattack>0)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1018
		then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1019
			SetInputMask(band(0xFFFFFFFF, bnot(gmLJump + gmHJump)))
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1020
			AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmokeWhite, 0, false)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1021
			disallowattack=disallowattack+1
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1022
		else
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1023
			SetInputMask(0xFFFFFFFF)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1024
			disallowattack=disallowattack+1
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1025
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1026
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1027
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1028
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1029
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1030
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1031
--if you used hogswitch or any similar weapon, dont enable any weaponchange
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1032
function onAttack()
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1033
	swapweps=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1034
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1035
	--african special
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1036
	if(africanSpecial == 1 and GetCurAmmoType() == amSeduction and band(GetState(CurrentHedgehog),gstAttacked)==0)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1037
	then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1038
		--SetState(CurrentHedgehog, gstAttacked)
10527
285b428f391c desync fix for Continental Supplies
Vatten
parents: 10453
diff changeset
  1039
		EndTurn()
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1040
		
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1041
		temp_val=0
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1042
		runOnGears(weapon_duststorm)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1043
		SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1044
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1045
		--visual stuff
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1046
		visual_gear_explosion(250,GetX(CurrentHedgehog), GetY(CurrentHedgehog),vgtSmoke,vgtSmokeWhite)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1047
		PlaySound(sndParachute)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1048
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1049
		RemoveWeapon(CurrentHedgehog,amSeduction)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1050
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1051
	--Kerguelen specials
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1052
	elseif(GetCurAmmoType() == amHammer and kergulenSpecial > 1 and band(GetState(CurrentHedgehog),gstAttacked)==0)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1053
	then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1054
		--SetState(CurrentHedgehog, gstAttacked)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1055
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1056
		
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1057
		--scream
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1058
		if(kergulenSpecial == 2)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1059
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1060
			temp_val=0
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1061
			runOnGears(weapon_scream_pen)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1062
			SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1063
			PlaySound(sndHellish)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1064
		
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1065
		--swap
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1066
		elseif(kergulenSpecial == 3 and TotalRounds>=1)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1067
		then
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1068
			runOnGears(weapon_swap_kerg)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1069
			PlaySound(sndPiano3)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1070
			
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1071
		--cries
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1072
		elseif(kergulenSpecial == 5)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1073
		then
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1074
			runOnGears(weapon_cries_a)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1075
			if(kergulenSpecial~=-1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1076
			then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1077
				AddGear(0, 0, gtWaterUp, 0, 0,0,0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1078
				PlaySound(sndWarp)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1079
				PlaySound(sndMolotov)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1080
				
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1081
				temp_val=0
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1082
				runOnGears(weapon_cries_b)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1083
				SetHealth(CurrentHedgehog, GetHealth(CurrentHedgehog)+temp_val)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1084
			else
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1085
				HogSay(CurrentHedgehog, loc("Hogs in sight!"), SAY_SAY)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1086
			end
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1087
		
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1088
		--sabotage
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1089
		elseif(kergulenSpecial == 6)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1090
		then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1091
			temp_val=0
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1092
			runOnGears(weapon_sabotage)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1093
			if(temp_val==0)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1094
			then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1095
				PlaySound(sndThrowRelease)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1096
				AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog)-20, gtCluster, 0, 0, -1000000, 32)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1097
			end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1098
		end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1099
		
10527
285b428f391c desync fix for Continental Supplies
Vatten
parents: 10453
diff changeset
  1100
		EndTurn()
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1101
		
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1102
		DeleteVisualGear(visualcircle)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1103
		visualcircle=nil
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1104
		kergulenSpecial=0
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1105
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1106
		RemoveWeapon(CurrentHedgehog,amHammer)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1107
		
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1108
	elseif(GetCurAmmoType() == amVampiric)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1109
	then
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1110
		VampOn=75
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1111
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1112
	--Australian special
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1113
	if(GetGearType(austmine) == gtMine and austmine ~= nil)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1114
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1115
		temp_val=0
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1116
		runOnGears(weapon_aust_check)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1117
		
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1118
		if(gearIsInCircle(austmine,GetX(CurrentHedgehog), GetY(CurrentHedgehog), 30, false)==false or temp_val==1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1119
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1120
			AddVisualGear(GetX(austmine), GetY(austmine), vgtDust, 0, false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1121
			DeleteGear(austmine)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1122
			PlaySound(sndDenied)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1123
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1124
		
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1125
		austmine=nil
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1126
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1127
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1128
	australianSpecial=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1129
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1130
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1131
function onGearAdd(gearUid)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1132
	swapweps=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1133
	
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1134
	--track the gears im using
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1135
	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1136
	then
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1137
		trackGear(gearUid)
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1138
	end
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1139
	
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1140
	--remove gasclouds on gasbombspecial
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1141
	if(GetGearType(gearUid)==gtPoisonCloud and samericanSpecial == true)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1142
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1143
		DeleteGear(gearUid)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1144
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1145
	elseif(GetGearType(gearUid)==gtSMine)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1146
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1147
		vx,vy=GetGearVelocity(gearUid)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1148
		if(africaspecial2 == 1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1149
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1150
			SetState(CurrentHedgehog, gstHHDriven+gstMoving)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1151
			SetGearPosition(CurrentHedgehog, GetX(CurrentHedgehog),GetY(CurrentHedgehog)-3)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1152
			SetGearVelocity(CurrentHedgehog, vx, vy)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1153
			DeleteGear(gearUid)
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1154
			
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1155
		elseif(africaspecial2 == 2)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1156
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1157
			fire_gear(CurrentHedgehog,gtNapalmBomb, vx, vy, 0)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1158
			DeleteGear(gearUid)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1159
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1160
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1161
	elseif(GetGearType(gearUid)==gtSniperRifleShot)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1162
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1163
		sniper_s_in_use=true
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1164
		if(namericanSpecial~=1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1165
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1166
			SetHealth(gearUid, 1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1167
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1168
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1169
	elseif(GetGearType(gearUid)==gtShotgunShot)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1170
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1171
		if(shotgun_s==true)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1172
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1173
			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1174
			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1175
			AddVisualGear(GetX(gearUid), GetY(gearUid), vgtFeather, 0, false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1176
			PlaySound(sndBirdyLay)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1177
		else
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1178
			shotgun_s=nil
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1179
		end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1180
		
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1181
	elseif(GetGearType(gearUid)==gtMolotov and europe_s==1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1182
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1183
		vx,vy=GetGearVelocity(gearUid)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1184
		e_health=fire_gear(CurrentHedgehog,gtCluster, vx, vy, 1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1185
		SetGearMessage(e_health, 2)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1186
		DeleteGear(gearUid)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1187
		
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1188
	elseif(GetGearType(gearUid)==gtParachute)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1189
	then
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1190
		inpara=1
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1191
	end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1192
end
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1193
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1194
function onGearDelete(gearUid)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1195
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1196
	if(GetGearType(gearUid) == gtHedgehog or GetGearType(gearUid) == gtMine or GetGearType(gearUid) == gtExplosives) 
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1197
	then
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1198
		trackDeletion(gearUid)
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1199
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1200
		--sundaland special
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1201
		if(GetGearType(gearUid) == gtHedgehog and continent[GetHogTeamName(turnhog)]==10)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1202
		then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1203
			if(turnhog==CurrentHedgehog)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1204
			then
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1205
				runOnGears(find_other_hog_in_team)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1206
			end
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1207
		
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1208
			get_random_weapon_on_death(turnhog)
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1209
		end
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1210
	end
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1211
	
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1212
	--north american lipstick
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1213
	if(GetGearType(gearUid)==gtSniperRifleShot )
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1214
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1215
		sniper_s_in_use=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1216
		if(namericanSpecial==2)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1217
		then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1218
			temp_val=gearUid
7895
ac1610a7b7fa apparently an older version was provided earlier and this one is newer and theoretically desync free. untested.
Vatten
parents: 7893
diff changeset
  1219
			runOnGears(weapon_lipstick)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1220
		end
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1221
	--north american eagle eye
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1222
	elseif(GetGearType(gearUid)==gtShotgunShot and shotgun_s==true)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1223
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1224
		SetState(CurrentHedgehog, gstMoving)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1225
		SetGearPosition(CurrentHedgehog, GetX(gearUid), GetY(gearUid)+7)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1226
		PlaySound(sndWarp)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1227
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1228
	--south american special
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1229
	elseif(GetGearType(gearUid)==gtGasBomb and samericanSpecial == true)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1230
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1231
		temp_val=gearUid
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1232
		runOnGears(weapon_anno_south)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1233
		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1234
	
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1235
	--asian special
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1236
	elseif(GetGearType(gearUid)==gtSnowball and GetGearMessage(gearUid)==1)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1237
	then
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1238
		AddGear(GetX(gearUid), GetY(gearUid), gtCluster, 0, 0, 0, 22)
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1239
	
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1240
	--europe special
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1241
	elseif(GetGearType(gearUid)==gtCluster and GetGearMessage(gearUid)==2)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1242
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1243
		temp_val=gearUid
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1244
		runOnGears(weapon_health)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1245
		visual_gear_explosion(100,GetX(gearUid), GetY(gearUid),vgtSmokeWhite,vgtSmokeWhite)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1246
		AddVisualGear(GetX(gearUid), GetY(gearUid), vgtExplosion, 0, false)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1247
		PlaySound(sndGraveImpact)
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1248
	
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1249
	--asia (using para)
7893
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1250
	elseif(GetGearType(gearUid)==gtParachute)
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1251
	then
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1252
		inpara=false
50e8f6714b22 new script specialising in altering weapon behaviour
Vatten
parents:
diff changeset
  1253
	end
7936
9f44e39d856c Script typos
nemo
parents: 7895
diff changeset
  1254
end
9805
1795c34ab8db Updated continental to the latest
Vatten
parents: 8618
diff changeset
  1255
--[[sources (populations & area):
8618
7e71dba4e7f3 avoid floating point desync, other script tweaks
Vatten
parents: 8043
diff changeset
  1256
Own calculations
10453
7e90d5856d56 Remove loc() called with a variable.
nemo
parents: 9805
diff changeset
  1257
Some are approximations.]]