Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Projectiles (https://forums.graalonline.com/forums/showthread.php?t=83134)

RozenMaiden 12-13-2008 02:19 AM

Projectiles
 
Hi,

so how would you implement custom projectiles? that have a smooth movement, aren't laggy (well atleast not laggier than the standard projectiles or not much laggier) and have custom speed?

Chompy 12-13-2008 04:05 PM

Basicly you can start with making a serverside class that handles movement (either by using move() or x,y altering using cos and sin) and acts like a projectile.

And to cast it, simply do something like..

PHP Code:

function onCastProjectile(levelxyanglespeed) {
  
with(findlevel(level).putnpc2(xy"")) {
    
this.angle angle;
    
this.speed speed// tiles per 0.1 sec
    
this.join("custom_projectile");
  }


But beware to use destroy(); inside the class when it hits a player or a wall (Use custom checks for that) so it's properly destroyed

This is just an idea of how you can do it. If others have an other suggestion of how to do it, they can post that.

RozenMaiden 12-13-2008 04:07 PM

hm i tried around with particles and added a modifier to decrease their alpha. but the image of the particle went pure-white instead of becoming transparent?

Chompy 12-13-2008 04:16 PM

Quote:

Originally Posted by RozenMaiden (Post 1449051)
hm i tried around with particles and added a modifier to decrease their alpha. but the image of the particle went pure-white instead of becoming transparent?

Huh? What does that have to do with custom projectiles? :p

But anyway, what is your this.alpha value at, and what is this.red, this.green and this.red (RGB) at?
Also, you could try setting this.mode to 2

cbk1994 12-13-2008 06:15 PM

When creating custom projectiles, I strongly recommend using move() rather than altering the x & y; it will be much easier on the server, also.

PHP Code:

function onCreated() {
  
onMovementFinished();
}
function 
onMovementFinished() {
  
temp.movex sin(this.angle) * SPEED_HERE;
  
temp.movey cos(this.angle) * SPEED_HERE;
  
move(movexmovey.18);



RozenMaiden 12-13-2008 06:28 PM

so how would i add trajectory trails? the automatic particle emission is way too slow for that

cbk1994 12-14-2008 01:29 AM

Quote:

Originally Posted by RozenMaiden (Post 1449086)
so how would i add trajectory trails? the automatic particle emission is way too slow for that

Edit the GANI of the projectile, and add a GANI script.

RozenMaiden 12-14-2008 02:15 AM

a gani script with what?

Chompy 12-14-2008 02:35 AM

Quote:

Originally Posted by RozenMaiden (Post 1449169)
a gani script with what?

The script for the particle effect. The particle effect which cause a trail :o

cbk1994 12-14-2008 07:14 AM

This might help.


All times are GMT +2. The time now is 11:40 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.