Quote:
Originally Posted by Black_knights55
Thanks, that's working.
Now, I did a new projectile called val_shuriken.png and a new gani called temp_shuri.gani. I've replaced "arrow" and "barrow0.png" but I guess I'm doing something wrong because now there's nothing shooting at all.
NPC Code:
//#CLIENTSIDE
function onWeaponFired()
{
setani("shoot",0);
temp.angle = getangle(vecx(player.dir), vecy(player.dir));
shoot(player.x, player.y, player.z, temp.angle, 0, 0, "temp_shuri", "val_shuriken.png");
freezeplayer(0.3);
}
|
Make sure the image in your gani is set to PARAM1.
Let me try to explain shoot a little bit better:
level.shoot(start x, start y, start z, direction of shot, z-angle, strength, gani, gani params);
By editing strength, you can specify strength based on the gravity settings for your server/client, increasing strength increases speed of the shot.
By changing z-angle you can make your shot arch in the air using some trigonometric math.
If you want to change your gravity, you can simply do
gavity=5 (for example), which is a global variable. If you change it on the clientside, it will only affect that person's gravity, but if you change it serverside, it will affect the whole server. If you change your gravity high enough, shots will fly over walls, etc.
Quote:
Originally Posted by Black_knights55
|
You need to change your shuriken sprite's image to PARAM1 (on the left side of the gani editor), right now it is equal to the name of the image, but if you look in the lower right side of the gani editor it says "def param1", that means wherever PARAM1 is placed, that image will be there. By using PARAM1, you also make the image accessible by script, which is exactly what you need to do for the shoot function. However, if you don't plan to change the image at all, you can simply leave the param1 part of the shoot command blank (like "") and simply specify a gani to use.