Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-13-2008, 02:19 AM
RozenMaiden RozenMaiden is offline
Registered User
Join Date: Dec 2008
Posts: 27
RozenMaiden is on a distinguished road
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?
Reply With Quote
  #2  
Old 12-13-2008, 04:05 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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.
__________________
Reply With Quote
  #3  
Old 12-13-2008, 04:07 PM
RozenMaiden RozenMaiden is offline
Registered User
Join Date: Dec 2008
Posts: 27
RozenMaiden is on a distinguished road
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?
Reply With Quote
  #4  
Old 12-13-2008, 04:16 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by RozenMaiden View Post
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?

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
__________________
Reply With Quote
  #5  
Old 12-13-2008, 06:15 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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);

__________________
Reply With Quote
  #6  
Old 12-13-2008, 06:28 PM
RozenMaiden RozenMaiden is offline
Registered User
Join Date: Dec 2008
Posts: 27
RozenMaiden is on a distinguished road
so how would i add trajectory trails? the automatic particle emission is way too slow for that
Reply With Quote
  #7  
Old 12-14-2008, 01:29 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by RozenMaiden View Post
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.
__________________
Reply With Quote
  #8  
Old 12-14-2008, 02:15 AM
RozenMaiden RozenMaiden is offline
Registered User
Join Date: Dec 2008
Posts: 27
RozenMaiden is on a distinguished road
a gani script with what?
Reply With Quote
  #9  
Old 12-14-2008, 02:35 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by RozenMaiden View Post
a gani script with what?
The script for the particle effect. The particle effect which cause a trail :o
__________________
Reply With Quote
  #10  
Old 12-14-2008, 07:14 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
This might help.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:20 PM.


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