This is what I have:
Code: Select all
function CamperDamage(%tank,%loopsElapsed)
{
%loopsElapsed++;
%tank.client.player.hurtMe(5);
if ( %loopsElapsed >= 10 || $inGoal[%tank] == false)
return;
schedule(1000,false,CamperDamage(%tank,%loopsElapsed));
}
function AntiCamp::OnEnter(%db,%this,%tank)
{
if (%tank.getFlag() != -1)
return;
$inGoal[%this,%tank] = true;
schedule(5000,0,"CamperDamage",%tank);
schedule(5000,0,"CommandToClient",%tank.client,'BottomPrint',"Please Do Not Camp!",3,3);
echo(%tank.client.nameBase SPC "Is Camping!");
}
function AntiCamp::OnLeave(%db,%this,%tank)
{
$inGoal[%this,%tank] = false;
}
datablock powerupdata(AntiCamp)
{
category = "PowerUp";
shape = "game/data/shapes/Common/AntiCamp/AntiCamp.dts";
type = "bounce";
shadow = false;
shadowAnimation = false;
startOn = true;
minOff = 1;
maxOff = 2;
Sound = "PupOnSound";
soundOff = "PupOffSound";
};
package onCreateNewGoal {
function pickGoal()
{
if (!isObject(Goal))
{
new PowerUp(Goal) {
dataBlock = DefaultGoal;
};
}
%posi = PickSpawnPoint("");
Goal.setTransform(%posi);
for (%i = 0; %i < MissionCleanUp.getCount(); %i++)
{
%item = MissionCleanUp.getObject(%i);
if (%item.dataBlock $= "AntiCamp") {
%item.delete();
}
}
new PowerUp(AntiCamp) {
dataBlock = AntiCamp;
position = %posi - 0.5;
};
return Goal;
}
};
ActivatePackage(OnCreateNewGoal);
- It doesn't seem to hurt anyone; (unable to find object ' ', attempting to call function "hurtMe") [FIXED]
- It's impossible to score (probably because there are 2 PowerUp's on exactly the same position?)
- The function doesn't reschedule itself.
- The BP doesn't work (that wasn't standard, added it) [FIXED]