Graal Forums  

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

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-03-2003, 06:00 PM
Onijustin_P2P Onijustin_P2P is offline
Registered User
Join Date: Mar 2003
Location: The Netherlands
Posts: 64
Onijustin_P2P is on a distinguished road
Send a message via AIM to Onijustin_P2P Send a message via Yahoo to Onijustin_P2P
Dx Dy

hello,
you may know me as Dragona2002 but this just an new acc

well ok...
question

im working on a script / sniper rifle
but i want to make an shoot bullet effect on the snipex,snipey when i fire the weapon.... i just have problems with Dx and Dy x.x

heres the script (any commands are welcome yeah i know im not the bestest scripter )


NPC Code:

// NPC made by Fîêrçê Ðãr/< Rãzõr Ãçãrî
if (created) {
toweapons sniper;
}
if (isweapon) {
if (weaponfired) {
timoeut=0.1;
set client.sniping;
disabledefmovement;
snipey=playery;
snipex=playerx;
showimg 1223,dn_snipe.gif,snipex,snipey;
timeout=0.1;
}
if (timeout) {
if (client.sniping) {
if (keydown(2)) {
snipey+=0.5;
}
if (keydown(0)) {
snipey-=0.5;
}
if (keydown(1)) {
snipex-=0.5;
}
if (keydown(3)) {
snipex+=0.5;
}
if (keydown(5)) {
shoot playerx+.5,playery,0,,,1,0,fireball_effect,;
putexplosion 1,snipex,snipey;
putexplosion2 3,1,snipex,snipey;
}
}
showimg 1223,dn_snipe.gif,snipex,snipey;
setfocus snipex,snipey;
timeout=0.05;
}
if (keydown(6)) {
timeout=0;
snipey=playery;
snipex=playerx;
unset client.sniping;
hideimg 1223;
enabledefmovement;
resetfocus;
}
if (snipex<playerx&&snipey<playery) {
playerdir=0;
}
if (snipex>playerx&&snipey>playery) {
playerdir=2;
}
if (snipex<playerx&&snipey>playery) {
playerdir=1;
}
if (snipex>playerx&&snipey<playery) {
playerdir=3;
}
}

__________________
you dont get money for being an ****.....
  #2  
Old 04-03-2003, 06:14 PM
osrs osrs is offline
Graalian since 1998
osrs's Avatar
Join Date: Mar 2002
Location: Brazil
Posts: 2,724
osrs is on a distinguished road
Send a message via ICQ to osrs Send a message via AIM to osrs Send a message via MSN to osrs Send a message via Yahoo to osrs
Too much erros x.x'
But it's nice..=)
well,i have a better idea for a gun..

NPC Code:

//#CLIENTSIDE
//NPC made by *osrs (2PAC)

if(playertouchsme){toweapons Osrs Gun;}
if(weaponfired){
setani grab,;
if(playerdir==0){this.x=playerx+0.5;this.y=playery-1;}
if(playerdir==1){this.x=playerx-0.5;this.y=playery+1;}
if(playerdir==2){this.x=playerx+0.5;this.y=playery +1;}
if(playerdir==3){this.x=playerx+0.5;this.y=playery +1;}
shoot this.x,this.y,playerz,getangle(vecx(playerdir),vec y(playerdir)),0,0,"PUT HERE A GANI",;
}



Note:it's not a full script Kai,don't delete please. =)
__________________
"Ability is what you are capable of doing. Motivation determines what you do. Attitude determines how well you do it."
Facebook: facebook.com/raysilvadotnet /
  #3  
Old 04-03-2003, 07:53 PM
Onijustin_P2P Onijustin_P2P is offline
Registered User
Join Date: Mar 2003
Location: The Netherlands
Posts: 64
Onijustin_P2P is on a distinguished road
Send a message via AIM to Onijustin_P2P Send a message via Yahoo to Onijustin_P2P
mine isnt done yet too !
but sum 1 plz answer my question.... kai ? falcor ?
anyone ?
dx dy....
__________________
you dont get money for being an ****.....
  #4  
Old 04-04-2003, 02:19 AM
Dach Dach is offline
call me Chad, it's cooler
Dach's Avatar
Join Date: Aug 2002
Posts: 1,899
Dach is on a distinguished road
dx and dy on what?

oh, and you might want to look up vecx(dir) vecy(dir) and getangle(dx,dy) that'll change 24 lines of your script into 2
__________________
Scripting Documents:Old Script Documentation-Movement Tutorial
  #5  
Old 04-04-2003, 02:35 AM
Knuckles Knuckles is offline
Registered User
Join Date: Sep 2002
Location: New York
Posts: 580
Knuckles is on a distinguished road
Send a message via AIM to Knuckles
dx = delta x
dy = delta y

vecx stands for vector x -- it's an array of 4 numbers (0,-1,0,1)
vecy stands for vector y -- also an array of 4 numbers (-1,0,1,0)

Now lets look at vecx(0).
... It would look inside the array (0,-1,0,1); and would grab the FIRST number, because all array's start at 0, not 1. So, vecx(0) would return '0'.

if it was vecx(1), it would return the 2nd number of the arra; which is -1... and so on and so forth...

Test script
NPC Code:

if (created) {
this.dir = 1; // change this number all you want, from 0-3.
setplayerprop #c,vecx: #v(vecx(this.dir)) -- vecy: #v(vecy(this.dir));
}

__________________
Knuckles
"They say 60% of the time, it works everytime!"
  #6  
Old 04-04-2003, 02:51 AM
PrinceDark PrinceDark is offline
Criminal X
PrinceDark's Avatar
Join Date: Feb 2003
Location: Miami, Florida
Posts: 662
PrinceDark will become famous soon enough
I have a strange feeling that script was stolen, and edited and then because the person that made it doesn't know how to script, they are incapable of recognizing the errors they made. :/

I'll point a few things out that don't seem right.
- timeout is misspelled
- not sure why weaponfired is nested inside of isweapon. doesn't seem nevessary for it to be that way.
- an index higher than 200 (i think) can not be seen by other players.
- not sure if timeout=0 is efficient enough to end a loop. I usually use break; to end my loops.
- I'm sure there's more errors, but the code is quite messy.
  #7  
Old 04-04-2003, 09:54 PM
Onijustin_P2P Onijustin_P2P is offline
Registered User
Join Date: Mar 2003
Location: The Netherlands
Posts: 64
Onijustin_P2P is on a distinguished road
Send a message via AIM to Onijustin_P2P Send a message via Yahoo to Onijustin_P2P
because my other one was banned for credit card fraud
(i dont fraud )
but why cant i get an normal answer on my question ?

u guys know the bar in UN in towncenter right ?
well theres an NPC that passes u beer
from the npc it will pass a beer straight to the player...
you can do that script with the command "move" right ?
well how i make the npc so the player can shoot a gani (dun mind what yet ill make a gani for it soon)
straight to "snipex,snipey" (look in the script to understand snipex snipey x.x)

i hope its going to be clear already


::i dont steal scripts::
an btw this is one of my first scripts.... omi
__________________
you dont get money for being an ****.....
  #8  
Old 04-04-2003, 10:08 PM
Jeff Jeff is offline
Registered User
Join Date: Oct 2002
Location: Nebraska, USA
Posts: 707
Jeff is on a distinguished road
Kai, I believe the general rule is that there is no ban evasion in acquiring a legitimate upgrade after falling prey to a fraudulent upgrader.
__________________
Jeff, the Archduke of Dustari
Member of the LAT on Graal The Adventure
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GO d+ s++:+ !a C++ UL+(UL+++)@ P+ L+(++)>+++ E---- W++@ N- !o ?K w(w--) !O !M@ !V PS- PE+ Y PGP t+ 5 X R tv(tv+) b++(b+)>b++++ DI(DI+) D-- G e->e++++ h! !r y
------END GEEK CODE BLOCK------
  #9  
Old 04-04-2003, 10:41 PM
Onijustin_P2P Onijustin_P2P is offline
Registered User
Join Date: Mar 2003
Location: The Netherlands
Posts: 64
Onijustin_P2P is on a distinguished road
Send a message via AIM to Onijustin_P2P Send a message via Yahoo to Onijustin_P2P
i never frauded i dont have a reason to fraud,
hackers do it for fun ,
but cant hack though , and i dont have fun with those kindda things...
__________________
you dont get money for being an ****.....
  #10  
Old 04-05-2003, 08:27 AM
Onijustin_P2P Onijustin_P2P is offline
Registered User
Join Date: Mar 2003
Location: The Netherlands
Posts: 64
Onijustin_P2P is on a distinguished road
Send a message via AIM to Onijustin_P2P Send a message via Yahoo to Onijustin_P2P
thats right kai -_-
but have any idea ?
the question i asked...
i dont have an answer yet...
__________________
you dont get money for being an ****.....
  #11  
Old 04-05-2003, 10:58 AM
Onijustin_P2P Onijustin_P2P is offline
Registered User
Join Date: Mar 2003
Location: The Netherlands
Posts: 64
Onijustin_P2P is on a distinguished road
Send a message via AIM to Onijustin_P2P Send a message via Yahoo to Onijustin_P2P
example plz
__________________
you dont get money for being an ****.....
Closed Thread


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 03:20 PM.


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