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 02-23-2009, 02:55 AM
GULTHEX GULTHEX is offline
Registered User
Join Date: Jul 2008
Posts: 148
GULTHEX can only hope to improve
Cool theres somthing wrong with my gun script

PHP Code:
//#CLIENTSIDE

if (weaponfired){
clientr.m16=1;}
{if(
clientr.m16=1);

function 
onKeyPressedcodekey ) {
  if ( 
key == "g" ) {
    
setshootparams PARAMEQUALS;
  
//shoot x,y,z,angle,zangle,power,gani,ganiparams;
  
shoot this.x,this.y,playerz,(playerdir 1) * pi 2,,,shuriken,;
  
setani dg_m16-fire,;
  
replaceani idle,dg_m16-idle;
  
replaceani walk,walk;
  
freezeplayer 0.0383;
  
sleep 0.1;

  
//up
if (playerdir=0)
  
this.x=playerx-1;
  
this.y=playery-2;

//left
if (playerdir=1)
  
this.x=playerx-2;
  
this.y=playery;

//down
if (playerdir=2)
  
this.x=playerx+1;
  
this.y=playery+2;

//right
if (playerdir=3)
  
this.x=playerx+2;
  
this.y=playery;


if (
actionprojectile) {
  if(
strequals(#p(index),PARAMEQUALS)) {
  
}}}}} 
ok ill explan whats wrong with it


its like this if i turn it on then shoot it shoots where i stand

when i move to a difrent spot it shoots from the same spot that i shot from
when i fire it again
until i shoot again

ok ill show you what i mean

heres a pic


it goes from this

]to this






so its from


the first pic


to the second pic


up to down
Attached Thumbnails
Click image for larger version

Name:	New Bitmap Image (2).PNG
Views:	372
Size:	70.5 KB
ID:	47510   Click image for larger version

Name:	New Bitmap Image 1.PNG
Views:	383
Size:	72.1 KB
ID:	47511  
Reply With Quote
  #2  
Old 02-23-2009, 06:22 PM
hotrian hotrian is offline
Who?
Join Date: May 2003
Location: Eatonville, Washington, 98328
Posts: 56
hotrian is on a distinguished road
Send a message via AIM to hotrian Send a message via MSN to hotrian
bored enough to post..

Quote:
Originally Posted by GULTHEX View Post
PHP Code:
//#CLIENTSIDE

if (weaponfired){
clientr.m16=1;}
{if(
clientr.m16=1);

function 
onKeyPressedcodekey ) {
  if ( 
key == "g" ) {
    
setshootparams PARAMEQUALS;
  
//shoot x,y,z,angle,zangle,power,gani,ganiparams;
  
shoot this.x,this.y,playerz,(playerdir 1) * pi 2,,,shuriken,;
  
setani dg_m16-fire,;
  
replaceani idle,dg_m16-idle;
  
replaceani walk,walk;
  
freezeplayer 0.0383;
  
sleep 0.1;

  
//up
if (playerdir=0)
  
this.x=playerx-1;
  
this.y=playery-2;

//left
if (playerdir=1)
  
this.x=playerx-2;
  
this.y=playery;

//down
if (playerdir=2)
  
this.x=playerx+1;
  
this.y=playery+2;

//right
if (playerdir=3)
  
this.x=playerx+2;
  
this.y=playery;


if (
actionprojectile) {
  if(
strequals(#p(index),PARAMEQUALS)) {
  
}}}}} 
What?

PHP Code:

if (weaponfired){
clientr.m16=1;}
{if(
clientr.m16=1); 
It's been a while, but I don't think this math is correct.
PHP Code:
 (playerdir 1) * pi 
Without brackets, only the line directly after an if statement is actually checking the statement; The second line is always running with your methods. Also, You're horribly mixing GS1 with GS2..

And why are you setting these after you have already "shot" the bullet? More than that, this.x and this.y are reserved vars; Use something else like this.dx and this.dy
PHP Code:
if (playerdir=1)
  
this.x=playerx-2;
  
this.y=playery
What are these closing?

PHP Code:
}}}}} 
'scuse me if I'm horribly wrong :3
__________________
Sometimes I wonder if I think too big.
Quote:
Originally Posted by Admins
I've moved the fox map to "levelstoobig/" because a terrain gmap of 1024x1024 levels is clearly too huge (the kingdoms main map is 40x40 and is already quite big). It was taking a lot of memory and was slowing down the computer.
Reply With Quote
  #3  
Old 02-24-2009, 12:23 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 is like, you're third thread for the exact same script.

You need to use this for your angle:
PHP Code:
temp.angle = (pi 2) * (player.dir 1); 
Look carefully at your code, then look up something called "order of operations"; it will explain why "your" angle didn't work, though it is nearly the same.
__________________
Reply With Quote
  #4  
Old 02-24-2009, 03:08 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Quote:
Originally Posted by cbk1994 View Post
This is like, you're third thread for the exact same script.

You need to use this for your angle:
PHP Code:
temp.angle = (pi 2) * (player.dir 1); 
Look carefully at your code, then look up something called "order of operations"; it will explain why "your" angle didn't work, though it is nearly the same.
There are many things wrong with this script, but ironically, it is not this.

To clarify, match your brackets properly, and use player.x + 2*vecx(player.dir) + vecy(player.dir) and player.y + 2*vecy(player.dir) instead of this.x and this.y respectively.
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #5  
Old 02-24-2009, 02:47 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
I can see you're assigning values to playerdir rather than comparing them. Instead of using playerdir = 0 or playerdir = 1, use playerdir == 1.
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 12:48 AM.


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