Author Topic: Checking if player is in minigame?  (Read 577 times)

How would I make this script check if the player is in minigame for it to be damaged?

Code: [Select]
function fireProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
  echo("test");
   continuousDamage(%obj,%pos,%this.damageRadius,%this.radiusDamage,"Fire",0,10000);
}

if(%obj.getClassName() $= "Player" && getMinigameFromObject(%obj) !$= "")
{
//dostuff
}
« Last Edit: May 01, 2009, 06:17:40 PM by Destiny/Zack0Wack0 »

Hmm... using that doesn't let the continuous damage work...

Code: [Select]
function fireProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{

  echo("test");
   continuousDamage(%obj,%pos,%this.damageRadius,%this.radiusDamage,"Fire",0,10000);
}

function continuousDamage(%sourceObject, %position, %radius, %damage, %damageType, %impulse,%duration)
{

radiusDamage(%sourceObject, %position, %radius, %damage, %damageType, %impulse);
if (%duration<0) return;
schedule(500,0,"continuousDamage",%sourceObject, %position, %radius, %damage, %damageType, %impulse,%duration-500);

}

try using
Code: [Select]
if(isInMinigame(%obj))
{
//dostuff
}
I'm pretty sure that function only works for players and aiplayers, so you don't need to do the player check.
EDIT: It's from the zombie mod. Here's the source, just stick it in your weapons script;
Code: [Select]
function IsInMinigame(%player)
{
if(isobject(%player))
{
if(%player.getclassname() $= "Player")
{
if(%player.client.minigame != 0 && %player.client.minigame != -1)
{
return 1;

}
}
if(%player.getclassname() $= "AiPlayer")
{
if(%player.spawnbrick.getgroup().client.minigame != 0 && %player.spawnbrick.getgroup().client.minigame != -1)
{
return 1;
}
}
return 0;
}
}
« Last Edit: May 01, 2009, 07:07:22 PM by Destiny/Zack0Wack0 »

There is a getMinigameFromObject(object); command.