Author Topic: Leveling Up  (Read 947 times)

Hello. I'm trying to make a weapon that you can level up. According to the number of kills, well I have no idea how to start.
Someone could help?

Example:

Your weapon causes 15 damage.

1 Kill = + 15 Damage
2 Kills = +30 Damage
3 Kills = + 45 Damage

Code: [Select]
function wepProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(!isobject(%col)){
Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
return;
}
if(%col.getclassname() $= "Player" || %col.getclassname() $= "AIPlayer"){
Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
%i=0;
while(%i<%obj.client.player.killwep){
Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
%i++;
}
return;
}

//Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
}


And then you just need a way to add to killwep as you get kills.
This would multiply the damage by your kill count.

Code: [Select]
function wepProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(!isobject(%col)){
Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
return;
}
if(%col.getclassname() $= "Player" || %col.getclassname() $= "AIPlayer"){
Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
%i=0;
while(%i<%obj.client.player.killwep){
Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
%i++;
}
return;
}

//Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal);
}


And then you just need a way to add to killwep as you get kills.
This would multiply the damage by your kill count.
Oh, thanks Rky!

Also.. Is there a way to change the projectile according to the damage it does?

Like:

15 Damage = Default bullet
30 Damage = Tank bullet

Also.. Is there a way to change the projectile according to the damage it does?

Like:

15 Damage = Default bullet
30 Damage = Tank bullet

Yes, I would think so, but I gtg, I'll try to help later if no one else does.

The leveling up script is not working. :<

What I should do?

Did you try it out by itself?  If you did, you need to read.

Did you try it out by itself?  If you did, you need to read.
=P. That's the problem.. Ugh.

You need to add a way of tracking kills.
Code: [Select]
package Test_health
{
function Armor::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
%client=%obj.client;
%killer=%sourceobject.client;
if(%client==%killer){
Parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
return;
}

if(%obj.getdamagelevel() + %damage > %obj.getdatablock().maxdamage){
%sourceobject.killwep++;
}


Parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
}
};
activatepackage("Test_health");

It would be better to use ProjectileData::damage rather than ProjectileData::onCollision for this as then you can directly edit the damage amount.

i would use varaibles for this, and different weapons :D

Thanks. I will fix the script right now.