Graal Forums

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

Onijustin_P2P 04-03-2003 06:00 PM

Dx Dy
 
hello,
you may know me as Dragona2002 but this just an new acc ;)

well ok...
question :D

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 :p)


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;
}
}


osrs 04-03-2003 06:14 PM

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. =)

Onijustin_P2P 04-03-2003 07:53 PM

mine isnt done yet too !
but sum 1 plz answer my question.... kai ? falcor ?
anyone ?
dx dy....

Dach 04-04-2003 02:19 AM

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 :p

Knuckles 04-04-2003 02:35 AM

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));
}


PrinceDark 04-04-2003 02:51 AM

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.

Onijustin_P2P 04-04-2003 09:54 PM

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 :rolleyes:


::i dont steal scripts::
an btw this is one of my first scripts.... omi

Jeff 04-04-2003 10:08 PM

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.

Onijustin_P2P 04-04-2003 10:41 PM

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...

Onijustin_P2P 04-05-2003 08:27 AM

thats right kai -_-
but have any idea ?
the question i asked...
i dont have an answer yet...

Onijustin_P2P 04-05-2003 10:58 AM

example plz :D


All times are GMT +2. The time now is 02:18 PM.

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