Author Topic: AND gate input event  (Read 451 times)

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: [Select]
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;
}
}
}

Is %p a projectile or a projectileData? If it's a projectile, you may need to .getDatablock() and check the uiName of that.

wouldn't it be easier to just event it?