Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-21-2017, 04:57 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,731
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
Bow design decision.

This time I'm not looking for script help, just a question in regards to design. On G2K1 they use a custom bow NPC. Anyways to check and see if the arrows hits an NPC you have to check if the arrow passes by the NPC's coordinates. To me that seems like an odd design choice. Why not invoke a trigger when the projectile is onwall (I assuming NPCs with setshape return blocking when I say this). Or why make the bow so complicated at all? Isn't there shoot() and onActionProjectile()?
__________________
Save Classic!
Reply With Quote
  #2  
Old 08-26-2017, 07:30 PM
MysticalDragon MysticalDragon is offline
Global Administration
MysticalDragon's Avatar
Join Date: Oct 2002
Location: Lynn Ma
Posts: 883
MysticalDragon is just really niceMysticalDragon is just really nice
Send a message via AIM to MysticalDragon Send a message via MSN to MysticalDragon
That's more then likely because when the custom bow on Gk1 was made the shoot function was pretty horrible, it was always better to make your own. Now or when it was improved it feels more responsive although its still very limited to what you should be able to do with projectiles. But for a simple bow shoot would probably be better anyways since its native to the client.

PHP Code:
onActionSProjectile         <- if a projectile hits on serverside
onActionProjectile             
<- if a projectile hits on clientside  Used the same as above
onPlayerShoots
(objobj) ;  <-If the player shot a projectile

example
:
function 
onActionSProjectile(temp.pltemp.dmg) {
  
temp.source isObject(temp.pl) ? makevar(temp.pl) : findplayer(temp.pl);//Player or Npc
  
doDamage(temp.sourcetemp.dmg); <-Call your Damage function
}

shoot(floatfloatfloatfloatfloatfloatstrstr) - shoots a projectile with x,y,z,angle,zangle,strength,ani,aniparams)

//Projectile Attributes
setshootparams(params);

example:
   
//This is to adjust the projectile to shoot at the right location
   
temp.arrowani "idle";
   
temp.arrowpos = {
     
"0.25,0.5",  //Dir 0
     
1.0,            //Dir 1
     
"-0.5,-1"     //Dir 2
    
,"-1.5,0"      //Dir 3
   
};
   
//setshootparams are like attributes saved within the projectile
   
setshootparams(
     
player,
     
temp.damage
   
);
   
shoot(
     
player.temp.arrowpos[player.dir][0],player.temp.arrowpos[player.dir][1], player.z,
     
getangle(vecx(player.dir), vecy(player.dir)), pi 321,
     
temp.arrowaniNULL
   
);
  
//x position of projectile = player.x - temp.arrowpos[player.dir][0]
  //y position of projectile = player.y - temp.arrowpos[player.dir][1]
  //player.z = current z Position of projectile
  //temp.arrowani = the arrow gani that's being fired
  //NULL = Gani Params (If your gani has any special attributes) e.g changing the arrow image depending on what bow your using. 
  //pi*/*32 = Strength of projectile
  //1 = speed of Projectile 
__________________
~Delteria Support
~Playerworld Support
~PWA Chief
http://support.toonslab.com
[email protected]




Last edited by MysticalDragon; 08-26-2017 at 08:04 PM..
Reply With Quote
  #3  
Old 05-17-2019, 03:06 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,731
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
while searching this forum for something else I noticed I didn't say thank you for this.

Thanks.
__________________
Save Classic!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 06:11 PM.


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