Blockland Forums > Modification Help

Event Help

Pages: (1/5) > >>

¥ola:

I'm pretty sure I did this somewhat correctly, more than likely not though.

Anyone see any major issues as to why the events don't show up in the event list, because it shows up on the addon list


--- Code: ---registerOutputEvent(fxDtsBrick, "checkMask", "", 1);
registerInputEvent(fxDtsBrick, "onMaskTrue", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");
registerInputEvent(fxDtsBrick, "onMaskFalse", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");


function fxDTSBrick::onMaskTrue(%this, %obj, %client)
{
$inputTarget_self = %this;
$inputTarget_client = %client;
$inputTarget_player = %client.player;
$inputTarget_miniGame = getMiniGameFromObject(%this);
%this.processInputEvent("VariableTrue", %client);
}

function fxDTSBrick::onMaskFalse(%this, %obj, %client)
{
$inputTarget_self = %this;
$inputTarget_client = %client;
$inputTarget_player = %client.player;
$inputTarget_miniGame = getMiniGameFromObject(%this);
%this.processInputEvent("VariableFalse", %client);
}

function fxDTSBrick::checkMask(%this, %obj, %client)
{
if(%obj.client.Gasmask == 0)
{
if(%obj.getType() & $TypeMasks::PlayerObjectType && %obj.getState() !$= "Dead")
{
%db = %obj.getDatablock();

if(!%obj.isPlayer)
{
%this.onMaskFalse(%client);
else
%this.onMaskTrue(%client);
}
}
}
}

--- End code ---


Port:

That looks pretty dangerous. What if I did like this?

onActivate -> Self -> checkMask
VariableTrue -> Self -> CheckMask

Anyway, something you're doing wrong is that you're registering checkMask as a brick event, not a client event.
Also, why are you registering onMaskTrue and onMaskFalse if you aren't using them?

By the way, it has a syntax error. You're missing the ending bracket for the first clause and the starting bracket for the second clause here:

            if(!%obj.isPlayer)
            {
               %this.onMaskFalse(%client);
            else
               %this.onMaskTrue(%client);
            }

¥ola:

Nevermind.

If I'm using the Gasmask's variables, do I need to make it a forced addon?

¥ola:

Okay well.

This is starting to piss me off.

The events all show up but don't do anything when you use them.


--- Code: ---registerOutputEvent(fxDTSBrick, checkMask);
registerInputEvent(fxDTSBrick, "onMaskTrue", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");
registerInputEvent(fxDTSBrick, "onMaskFalse", "Self fxDtsBrick\tPlayer Player\tClient GameConnection\tMinigame Minigame");

function fxDTSBrick::onMaskTrue(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskTrue", %client);
}

function fxDTSBrick::onMaskFalse(%this, %obj, %client)
{
$InputTarget_["Self"] = %obj;
$InputTarget_["Player"] = %client.player;
$InputTarget_["Client"] = %client;

if($Server::LAN)
   {
      $InputTarget_["MiniGame"] = getMiniGameFromObject(%client);
   }
   else
   {
      if(getMiniGameFromObject(%obj) == getMiniGameFromObject(%client))
         $InputTarget_["MiniGame"] = getMiniGameFromObject(%obj);
      else
         $InputTarget_["MiniGame"] = 0;
   }
%this.processInputEvent("onMaskFalse", %client);
}

function fxDTSBrick::checkMask(%obj,%client)
{
if(%obj.client.Gasmask == 0)
{
if(%obj.getType() & $TypeMasks::PlayerObjectType && %obj.getState() !$= "Dead")
{
%db = %obj.getDatablock();

if(!%obj.isPlayer)
{
%this.onMaskFalse(%client);
}

else

{
%this.onMaskTrue(%client);
}
}
}
}
--- End code ---


Port:

If they don't have a gasmask:
    If the brick is a player and the brick is not dead:
        If the brick is not a player:
            Run "onMaskFalse"
        Otherwise:
            Run "onMaskTrue"

What the hell are you doing?

Pages: (1/5) > >>

Go to full version