Blockland Forums > Modification Help
AND gate input event
(1/1)
Club559:
I just need explanation on what I'm doing wrong here. This is to go with Cca's server, and it's supposed to detect 2 different types of projectiles: The gun bullet and the radio wave. If it detects both,  activates input.

--- Code: ---registerInputEvent("fxDTSBrick","onANDGate","Self fxDTSBrick" TAB "Projectile Projectile");

package AndGate
{
function fxDTSBrick::onProjectileHit(%this,%p)
{
AndGate(%this,%p);
parent::onProjectileHit(%this,%p);
}
};
activatePackage(AndGate);

function AndGate(%b,%p)
{
if(!%b.p1)
{
%b.p1=0;
}
if(!%b.p2)
{
%b.p2=0;
}
if(%p.uiName$="Radio Wave")
{
if(%b.p1==1)
{
%b.p1=0;
if(%b.p2==1)
{
%b.processInputEvent("onANDGate",%p);
}
}
else
{
if(%b.p2==1)
{
%b.processInputEvent("onANDGate",%p);
}
%b.p1=1;
}
}
if(%p.uiName$="Gun Bullet")
{
if(%b.p2==1)
{
%b.p2=0;
if(%b.p1==1)
{
%b.processInputEvent("onANDGate",%p);
}
}
else
{
if(%b.p1==1)
{
%b.processInputEvent("onANDGate",%p);
}
%b.p2=1;
}
}
}
--- End code ---
Uristqwerty:
Is %p a projectile or a projectileData? If it's a projectile, you may need to .getDatablock() and check the uiName of that.
phflack:
wouldn't it be easier to just event it?
Club559:

--- Quote from: phflack on November 02, 2010, 12:19:23 AM ---wouldn't it be easier to just event it?

--- End quote ---

No.
Navigation
Message Index

Go to full version