Author Topic: Questions  (Read 4894 times)

Ok, I got the script done but in the console it says
Unknown Command Damage
Code: [Select]
function ProjectileData::damage(%this,%obj,%col,%fade,%pos,%normal)
{
   if(%col.dataBlock.getName() $= "TankVehicle" || %col.dataBlock.getName() $= "GhostVehicle") //Only works on certain vehicles
{
if(%this.VehiDamage > 0)
{
    %Vehidamage2 = %this.VehiDamage;
%damageType = $DamageType::Direct;
        if(%this.DirectDamageType)
      %damageType = %this.DirectDamageType;
%scale = getWord(%obj.getScale(), 2);
    %NewDamage = mClampF(%this.Vehidamage, -100, 100) * %scale;

%col.damage(%obj, %pos, %NewDamage, %damageType);

}
}
parent::damage(%this,%obj,%col,%fade,%pos,%normal);
}

Because of
Code: [Select]
parent::damage(%this,%obj,%col,%fade,%pos,%normal);
You need to have it in a package first, and instead of just letting that sit there, change it like this:

Code: [Select]
else
parent::damage(%this,%obj,%col,%fade,%pos,%normal);

This way Tank and ghost vehicles wont get damaged twice.


Remember, put it in a package.

Because of
Code: [Select]
parent::damage(%this,%obj,%col,%fade,%pos,%normal);
You need to have it in a package first, and instead of just letting that sit there, change it like this:

Code: [Select]
else
parent::damage(%this,%obj,%col,%fade,%pos,%normal);

This way Tank and ghost vehicles wont get damaged twice.


Remember, put it in a package.
No errors, but it still damages the tank when I throw spears at it. Didn't test with other weapons.
Code: [Select]
package Tankdamage
{
function ProjectileData::damage(%this,%obj,%col,%fade,%pos,%normal)
{
   if(%col.dataBlock.getName() $= "TankVehicle") //Only works on certain vehicles
{
if(%this.VehiDamage > 0) //I set a thing in certain weapon's script that say this
//VehiDamage        = 30;
//THis part of the script should check if the weapon has VehiDamage set.
{
    %Vehidamage2 = %this.VehiDamage; //Sets a variable for the projectile's Vehidamage

%damageType = $DamageType::Direct;
        if(%this.DirectDamageType)
      %damageType = %this.DirectDamageType;
%scale = getWord(%obj.getScale(), 2);
    %NewDamage = mClampF(%this.Vehidamage, -100, 100) * %scale;

%col.damage(%obj, %pos, %NewDamage, %damageType);

}
}
else
parent::damage(%this,%obj,%col,%fade,%pos,%normal);
}
};
activatepackage(Tankdamage);

Also, is there a function for when a vehicle enters water?

Bump. I don't think there is a function for vehicles entering water but how would I check if one enters water. I mainly want it to affect the driver but I found out the
Code: [Select]
function Armor::onEnterLiquid(%this,%player,%a,%b)doesn't work if the player is in a vehicle.

I might as well lock this. tons of people are reading it but none are responding.


If you lock this, you will NVER get an answer... :/

I might as well lock this. tons of people are reading it but none are responding.

The easy questions are quick to be jumped on, the tough ones you usually must figure yourself unless some generous coder has crafted a solution already.

At most you can expect guidance with function names and etc. but when you ask of something that's never really been delved into by many you will find a lack of answers. Perhaps it is impossible, perhaps not (if it were confirmed as such there would be an answer saying so, no?)

In any case, locking isn't always the answer. Ask different questions.

How do I check if a brick is overlapping? Like if I try to place a brick and it is overlapping.

How do I check if a brick is overlapping? Like if I try to place a brick and it is overlapping.
You could look at the duplicator code for this answer.

Bump.
Code: [Select]
function servercmdBuyBow(%client)
{
if(%client.Roleplay["Gold"] >= 40)
{
%player = %client.player;
%Bow = new Item()
{
datablock = BowItem;
};
%Bow.setTransform(setWord(%client.player.getTransform(), 2, getWord(%client.player.getTransform(), 2) + 2));
%client.Roleplay["Gold"] -= 40;
}
else
{
messageClient(%client, '', "\c6You need 40 Gold to buy this.");
}
}
It isn't part of the minigame. How do I make it part of the minigame

Can you restrict commands like /spy to only host? Or are those client sided.

I think it is server sided. How would this work?
Code: [Select]
function servercmdSpy(%client, %target)
{
if(!%client.isSuperAdmin)
{
messageclient(%client, '', "\c3\THis is not allowed");
return;
}
else
{
Parent::servercmdSpy(%client, %target);
}
}
It says unknown command servercmdspy yet it does the message but does not spy.

I think it is server sided. How would this work?
Code: [Select]
function servercmdSpy(%client, %target)
{
if(!%client.isSuperAdmin)
{
messageclient(%client, '', "\c3\THis is not allowed");
return;
}
else
{
Parent::servercmdSpy(%client, %target);
}
}
It says unknown command servercmdspy yet it does the message but does not spy.
Don't you have to package that?
Or...

And as far as i know, it should be possible as Rotondo changed some server cmd's in his Zombie gamemode too (Zombie_overwrite.cs).
« Last Edit: January 26, 2010, 06:45:36 AM by lordician »