Author Topic: Dwand moving vehicles.  (Read 972 times)

Could someone make a script that allows the dwand to move vehicles like the hammer does? Maybe a little bit stronger?


Doesn't it do that already? Or is that only for players?


someone please i need this


package DwandMovingVehicles {

function AdminWandProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal)
{
    if(!isObject(%obj.client)
        return;
    if(isObject(%col))
    {
        if(isObject(%obj.client))
        {
            if(%col.getClassName() $= "Vehicle")
                %col.setVelocity("10 0 10");
            else
                Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
        }
    }
}

};
activatePackage(DwandMovingVehicles);

This might work; it might not. I'm on my phone right now and haven't tested it yet.
               


package DwandMovingVehicles {

function AdminWandProjectile::onCollision(%this, %obj, %col, %fade, %pos, %normal)
{
    if(!isObject(%obj.client)
        return;
    if(isObject(%col))
    {
        if(isObject(%obj.client))
        {
            if(%col.getClassName() $= "Vehicle")
                %col.setVelocity("10 0 10");
            else
                Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
        }
    }
}

};
activatePackage(DwandMovingVehicles);

This might work; it might not. I'm on my phone right now and haven't tested it yet.
Many problems/mistakes with this.

1. You check twice if %obj.client exists.
2. There are multiple vehicle class names. WheeledVehicle, FlyingVehicle(?), etc, and I don't think just Vehicle is one of them.
3. The vehicle will always go in the same direction, no matter where you hit it and no matter where you're standing.
4. Why would you not always want to parent onCollision?

Many problems/mistakes with this.

1. You check twice if %obj.client exists.
2. There are multiple vehicle class names. WheeledVehicle, FlyingVehicle(?), etc, and I don't think just Vehicle is one of them.
3. The vehicle will always go in the same direction, no matter where you hit it and no matter where you're standing.
4. Why would you not always want to parent onCollision?

Okay, thanks! I understand 1 through 3, but 4? I wouldn't call it if the class name isn't wheeled vehicle or whatever because nothing normally happens when it does. Or should I do %vehicle.setVelocity() and then call the parent? I can't seem to figure it out, do you mind doing it?
« Last Edit: July 03, 2014, 10:53:08 AM by Ninjaman 4 »

Okay, thanks! I understand 1 through 3, but 4? I wouldn't call it if the class name isn't wheeled vehicle or whatever because nothing normally happens when it does.
If nothing is normally going to happen if you parent it, then why not parent it? Better not to break other mods that do something when the D-wand hits a vehicle.
Or should I do %vehicle.setVelocity() and then call the parent?
No. Why would you do that?

Maybe try %col.getType() == $TypeMasks::VehicleObjectType ?
« Last Edit: July 03, 2014, 11:44:31 AM by Advanced Bot »

Maybe try %col.getType() ?
Good idea. if(%col.getType() & $TypeMasks::VehicleObjectType). That'll cover all of the types of vehicles.

Saw that ninja too.

this is all gibberish to me i have no idea what to do