Script and schemes: Pro Roper

No replies
Wuzzy
Wuzzy's picture
User offline. Last seen 24 weeks 4 days ago. Offline
Joined: 2012-06-20
Posts: 1310

I present you a script+weapon scheme+game scheme combination called “Pro Roper”.

It works like this:

All players (should) start with 1 hog which you place somewhere on the map. Every round a health crate with 15 HP spawns. The available things are: rope, grenade, cluster bomb, mine and bazooka.
The terrain has no land objects and no girders and can’t be destroyed. There is a border around the terrain, so you can’t drown.
Pro Roper must be played on a map where you can reach every spot; there should be no enclosed areas. Maybe good maps for Pro Roper have to be designed first, who knows?
Wink Smiley

There are two special rules which are enforced by the script:

  • You have to collect one health crate first to unlock the weapons; a message will appear if the weapons have been unlocked.
  • You only can attack from a rope or while flying with a rope selected

The turn time is only 15s, so you have to be quick!

I have tested the stuff and it seems to work so far. There is only one minor problem: At the first turn no health crate drops. This is very strange; simply skip the turn in this case. It does not really affect the game. If somebody can explain me what’s wrong here I’d be glad.

I hope you like it. And I’ll probably suck in this as hell. xD



Here are the files you need to install Pro Roper:

Data/Scripts/Multiplayer/Pro Roper.lua:
--[[
Pro Roper
version 0.1
]]

HedgewarsScriptLoad("/Scripts/Locale.lua")
HedgewarsScriptLoad("/Scripts/Tracker.lua")

local crateCollected = false
local weaponSet = 0
local ropeGear = nil

function onGameInit()
	Goals = loc("You must collect a crate before you can attack.|You must attack from the rope.")
end

function onNewTurn()
	crateCollected = false
	deactivateWeapons(CurrentHedgehog)
end

function onGearDelete(gear)
	-- was the gear a health crate?
	if (GetGearType(gear)==gtCase and band(GetGearPos(gear),2) ~= 0 and crateCollected == false) then
		crateCollected = true
		activateWeapons(CurrentHedgehog)
		AddCaption(loc("Weapons activated."))
	elseif (GetGearType(gear)==gtRope) then
		ropeGear = nil
		disableAttackIfNotOnRope()
	end
end

function onGearAdd(gear)
	if(GetGearType(gear) == gtRope) then
		ropeGear = gear
	end
end

function onAmmoStoreInit()
	SetAmmo(amRope, 9, 0, 0, 0)
	SetAmmo(amSkip, 9, 0, 0, 0)
end

function onSlot()
	weaponSet=2
end

function onSetWeapon()
	weaponSet=2
end

function onGameTick()
	if(weaponSet>0) then
		weaponSet = weaponSet - 1
		if(weaponSet==0) then
			disableAttackIfNotOnRope()
		end
	end
end

function disableAttackIfNotOnRope()
	local ammo = GetCurAmmoType()
	if(not (ammo == amRope or ammo == amSkip)) then
		if(ropeGear ~= nil) then
			if(GetGearElasticity(ropeGear) == 0) then
				SetInputMask(band(0xFFFFFFF, bnot(gmAttack)))
				WriteLnToConsole(loc("Weapons deactivated."))
			else
				SetInputMask(0xFFFFFFF)
				WriteLnToConsole(loc("Weapons activated."))
			end
		else
			SetInputMask(band(0xFFFFFFF, bnot(gmAttack)))
			WriteLnToConsole(loc("Weapons deactivated."))
		end
	else
		SetInputMask(0xFFFFFFF)
		WriteLnToConsole(loc("Weapons activated."))
	end
end



function activateWeapons(gear)
	AddAmmo(gear, amGrenade, 100)
	AddAmmo(gear, amBazooka, 100)
	AddAmmo(gear, amClusterBomb, 100)
	AddAmmo(gear, amMine, 100)
end

function deactivateWeapons(gear)
	AddAmmo(gear, amGrenade, 0)
	AddAmmo(gear, amBazooka, 0)
	AddAmmo(gear, amClusterBomb, 0)
	AddAmmo(gear, amMine, 0)
end



Data/Scripts/Multiplayer/Pro Roper.cfg:
Pro_Roper
Pro_Roper



To be inserted into schemes.ini:
15\name=Pro Roper
15\fortsmode=false
15\divteams=false
15\solidland=true
15\border=true
15\lowgrav=false
15\laser=false
15\invulnerability=false
15\resethealth=false
15\vampiric=false
15\karma=false
15\artillery=false
15\randomorder=true
15\king=false
15\placehog=true
15\sharedammo=false
15\disablegirders=true
15\disablelandobjects=true
15\aisurvival=false
15\infattack=false
15\resetweps=false
15\perhogammo=false
15\disablewind=false
15\morewind=false
15\tagteam=false
15\bottomborder=true
15\damagefactor=100
15\turntime=15
15\health=150
15\suddendeath=50
15\caseprobability=1
15\minestime=3
15\minesnum=0
15\minedudpct=0
15\explosives=0
15\healthprobability=100
15\healthcaseamount=15
15\waterrise=0
15\healthdecrease=0
15\ropepct=100
15\getawaytime=100

(remember to change the numbers and the “size” parameter at the top of the file)


To be inserted into weapons.ini:
Pro%20Roper=9990009990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111110111111111111111111111111111111111111111111111111

Hi, I am a Hedgewars developer. Smile

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]