I'm making a Blackhole Generating device as the next WMD. I've tried making a shield in the past and came up with a similar problem: I can't get the impulse to "remain" or linger, it acts 1 time on everyone and everything in the specified Radius and then that's it.
What I need is a code that will generate an impulse field/zone, like the FireDamage script for the fire arrows in the ammo add-on. The FireDamage script from the firearrows would apply damage every X second(s), and last a certain amount of time. The fire damage would actually take into account the DamageRadius as well, so you could create huge feilds of firedamage. I need something like this, but for ImpulseForce instead of Damage. As for suction/pull, that's been resolved (RadiusImpulseforce was set to a NEGATIVE value)
Here are the last bits of the Blackhole generator script (called VoidCaller). I had added the FireArrow firedamage feature to it (which works perfectly), and another code someone gave me to help me with the sheild (under Firedamage, and this one doesn't quite work).
//This part works.
$FireSpeed = 100; //Higher = Slower
$FireAmount =5; //Higher = More Damage
$FireDamageTime = 10000;
function VoidCallerProjectile::radiusDamage(%this, %obj, %col, %distanceFactor, %pos, %damageAmt)
{
if(%col.getClassName() $= "Player" && %col.getState() !$= "Dead" && isObject(%col.client.minigame)){
%col.psn=schedule($FireSpeed,0,"timedmg",%col,$FireAmount,$DamageType::FArrowDirect,$FireSpeed,$FireDamageTime);}
%col.psnamount = 0;
}
function timedmg(%col,%amount,%type,%timer,%maxtime)
{
if(%col.getClassName() $= "Player" && %col.getState() !$= "Dead" && isObject(%col.client.minigame)){
%col.damage(%col, "Head", %amount, %type);
%col.burn(1000);
%col.psnamount = %col.psnamount + $FireSpeed;
if(%col.psnamount < %maxtime){
%col.psn=schedule($FireSpeed,0,"timedmg",%col,%amount,%type,%timer,%maxtime);}}
}
function VoidCallerdProjectile::onCollision(%this, %obj, %slot){
if(!%obj.client.isSuperAdmin && !%obj.client.isAdmin)
return;
%i = new Trigger() {
position = %pos;
rotation = "1 0 0 0";
scale = "3 24 3";
dataBlock = LastingImpulse;
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
};
schedule(20000,0,TriggerDelete,%i);
}
//This part does not work.
datablock TriggerData(LastingImpulse){
tickPeriodMS = 100;
};
function LastingImpulse::OnEnter(%this, %trigger, %obj){
%obj.setVelocity(vectorAdd(%obj.getVelocity(),"0 0 500"));
}
function TriggerDelete(%obj){
%obj.delete();
}
Could you guys help me out? I gave you the last bits which could or could not be salvaged, I'm just not sure.
Also I'm programming illiterate, and can't decipher/create code very well, so I might not understand what to do with a chunk of code you throw at me.