Author Topic: Drop all weapons projectile?  (Read 759 times)

How could I make a projectile in way that when it is fired, the person who is touched by ti drops all thei weapons? However, if this is not possible clearing their weapons would work also. I have never done any kind of "Special" projectile before, so I'm not really sure if/how this would work.

Edit: Just saw badspot's projectile damage sticky, wait up, ima see if I can grasp that...
« Last Edit: May 05, 2009, 10:34:10 AM by cucumberdude »

You could also do Yourprojectile::Oncollision

All right, as much as I tried, I had trouble figuring it out. I understood how one would put such a segement of script into the weapon's script, but I have no clue at how to code the actual dropItem thing I want. I did a trace, and I got DropTool when I dropped my tool...Help?

Have you tried clearTools?
Also, you may want to look at the drop item on death script by Iban X. It's on RTB in the server mods section.

You could also do Yourprojectile::Oncollision
No. Do YourProjectile::Damage, as is in Badspot's example code. That would affect people outside of minigames and potentially not work with mods that affect minigame damaging code if badly done.

"dropTool" is the client-side code - no matter who is hit by the projectile, using that would make the host (you) drop their current tool.

Use servercmdDropTool(%client,%slot) to make a client drop their weapons. Loop through slots 0 to %player.dataBlock.maxTools for all weapons, or just do %player.currTool for the weapon they are currently holding. Note that this may not work with some bot mods if the bots do not have a valid client object and tools set up correctly.

Alternately, %player.clearTools() would work, but this would make them remove all weapons rather than dropping them.

Yeah, you have a point Space Guy, but I have a question, do you really need to right out all that damage stuff that he has in his demonstration to add an effect to your damage? Or could you just Parent::Damage(%args)?

It would be better to have all of the args.
However, you don't need every one of them.
For ::onCollision, the normal args are (%this, %obj, %col, %pos, %normal). If you need to get %obj from that, you would need to have %obj and all arguments before it. So you would need (%this, %obj).
I just tested all of that and it works.

All right, thanks for all the feedback! Space's sounds like what I want.

I kind of doubt I did it right, I really am new to scripting:

Code: [Select]
function ProjectileData::damage(%this,%obj,%col,%fade,%pos,%normal)
{
   if(%this.directDamage <= 0)
      return;

   %damageType = $DamageType::Direct;
   if(%this.DirectDamageType)
      %damageType = %this.DirectDamageType;

   %drop = serverCmdDropTool(%player.currtool);
 
   if(%col.getType() & $TypeMasks::PlayerObjectType)
   {
      %col.damage(%obj, %pos, %directDamage, %damageType);
   }
   else
   {
      %col.damage(%obj, %pos, %directDamage, %damageType);
   }
}

Also, all this stuff about direct damage is confusing. Can I just...delete it or something? Sorry about being so clueless, but the most complex scripting I've done is all that (useless) message all stuff :/
« Last Edit: May 06, 2009, 09:52:28 PM by cucumberdude »

It looks like you didn't change a thing. You didn't even change ProjectileData to the datablock name.

I was referring to my placement of serverCmdDropTool.

Ah didn't see that, well, you didn't do it right.

Try:
serverCmdDropTool(%col.client, %col.currtool);

The direct damage parts would be if your weapon deals minor damage as well as the effect.
Code: [Select]
   if(%col.getType() & $TypeMasks::PlayerObjectType && isObject(%col.client))
   {
      serverCmdDropTool(%col.client, %col.currtool);
      %col.damage(%obj, %pos, %directDamage, %damageType);
   }
   else
   {
      %col.damage(%obj, %pos, %directDamage, %damageType);
   }

Replacing the playerobjecttype section with that would make the weapon deal any damage it normally does to all objects, and force them to drop their current tool if they are holding one.