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 04-08-2006, 11:23 PM
lordspawn lordspawn is offline
Registered User
Join Date: Aug 2004
Posts: 24
lordspawn is on a distinguished road
Shooting Glitch

Ok, this script is shooting the bullet then switching to a different NPC that you have, were not sure if its the shoot command like has it changed or if there is something else in the script thats bugging it to do this, so if anyone that knows whats happening please post your input

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
setani("idle""");
  
replaceani("idle""idle");
  
replaceani("walk""walk");
  
this.inuse "0";
}
function 
onWeaponfired(){
  if (!
this.inuse==1) {
    
setani("cross_pistol-idle""");
    
replaceani("idle""cross_pistol-idle");
    
replaceani("walk""cross_pistol-walk");
    
this.inuse=1;
  }
  if (
this.inuse==1) {
    
setani("cross_pistol-fire""");
    
this.angle "#v(getangle(vecx(playerdir),vecy(playerdir)))";
    
this.bulletangle "-.2";
    
this.random "random(this.bulletangle,abs(this.bulletangle))";
    
shoot ("playerx,playery,,this.angle+this.random,,,cross_pistol-bullets,");
    
freezeplayer(0.3);
    
sleep(0.7);
    
setani("cross_pistol-idle""");
  }
}
function 
onKeypressed(){
  if (
strequals(#p(1),a)&&this.inuse==1) {
    
setani("idle""");
    
replaceani("idle""idle");
    
replaceani("walk""walk");
    
this.inuse=0;
  }

Reply With Quote
  #2  
Old 04-09-2006, 12:15 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
You can't leave parameters blank.
Put in "", 0, or NULL for a blank parameter.
Reply With Quote
  #3  
Old 04-09-2006, 12:17 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Oh, and I just noticed this:
this.angle = "#v(getangle(vecx(playerdir),vecy(playerdir))) ";

First of all, #v() is never used in GS2. NEVER.
Second, "" tells the script that something is text. That won't make this.angle the angle, it'll make this.angle the text that's there. Take out the #v() and the "". Same with this.random.
Reply With Quote
  #4  
Old 04-09-2006, 12:26 AM
gamer4lifebitach gamer4lifebitach is offline
Scripter
gamer4lifebitach's Avatar
Join Date: Oct 2005
Location: Illionis, USA
Posts: 25
gamer4lifebitach is on a distinguished road
Send a message via AIM to gamer4lifebitach Send a message via MSN to gamer4lifebitach
It still changes weapons.... (and i work with him)

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
setani("idle""");
  
replaceani("idle""idle");
  
replaceani("walk""walk");
  
this.inuse "0";
}
function 
onWeaponfired(){
  if (!
this.inuse==1) {
    
setani("cross_pistol-idle""");
    
replaceani("idle""cross_pistol-idle");
    
replaceani("walk""cross_pistol-walk");
    
this.inuse=1;
  }
  if (
this.inuse==1) {
    
setani("cross_pistol-fire""");
    
this.angle getangle(vecx(playerdir),vecy(playerdir));
    
this.bulletangle = -.2;
    
shoot(playerx,playerx,0,this.angle+random(this.bulletangle,abs(this.bulletangle)),0,0,cross_pistol-bullets,0);
    
freezeplayer(0.3);
    
sleep(0.7);
    
setani("cross_pistol-idle""");
  }
}
function 
onKeypressed(){
  if (
strequals(#p(1),a)&&this.inuse==1) {
    
setani("idle""");
    
replaceani("idle""idle");
    
replaceani("walk""walk");
    
this.inuse=0;
  }

__________________

~Contact Information~
Aim: Grind64RyGuy
Email: [email protected]
Client Status:
Reply With Quote
  #5  
Old 04-09-2006, 12:31 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
I do not believe that this script has anything to do with your weapons changing...

I think that there is another script somewhere that is causing that.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #6  
Old 04-09-2006, 12:34 AM
gamer4lifebitach gamer4lifebitach is offline
Scripter
gamer4lifebitach's Avatar
Join Date: Oct 2005
Location: Illionis, USA
Posts: 25
gamer4lifebitach is on a distinguished road
Send a message via AIM to gamer4lifebitach Send a message via MSN to gamer4lifebitach
but when i remove the shoot command from that script or put // infront it doesnt switch the items anymore :/
__________________

~Contact Information~
Aim: Grind64RyGuy
Email: [email protected]
Client Status:
Reply With Quote
  #7  
Old 04-09-2006, 12:57 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
PHP Code:
  if (strequals(#p(1),a)&&this.inuse==1) { 
    
setani("idle"""); 
    
replaceani("idle""idle"); 
    
replaceani("walk""walk"); 
    
this.inuse=0
  } 
This could possibly be causing it.

Change the ' if (strequals(#p(1),a)&&this.inuse==1) { ' to 'if (params[1] == "a" && this.inuse == 1) {'

A+D will change weapons. It's possible that it's returning strequals(#p(1),a) as always being true?
Reply With Quote
  #8  
Old 04-09-2006, 01:14 AM
gamer4lifebitach gamer4lifebitach is offline
Scripter
gamer4lifebitach's Avatar
Join Date: Oct 2005
Location: Illionis, USA
Posts: 25
gamer4lifebitach is on a distinguished road
Send a message via AIM to gamer4lifebitach Send a message via MSN to gamer4lifebitach
it still dont work...

PHP Code:
//#CLIENTSIDE
function onCreated(){
  
setani("idle""");
  
replaceani("idle""idle");
  
replaceani("walk""walk");
  
this.inuse "0";
}
function 
onWeaponfired(){
  if (!
this.inuse==1) {
    
setani("cross_pistol-idle""");
    
replaceani("idle""cross_pistol-idle");
    
replaceani("walk""cross_pistol-walk");
    
this.inuse=1;
  }
  if (
this.inuse==1) {
    
setani("cross_pistol-fire""");
    
this.angle getangle(vecx(playerdir),vecy(playerdir));
    
this.bulletangle = -.2;
    
shoot(playerx,playerx,0,this.angle+random(this.bulletangle,abs(this.bulletangle)),0,0,cross_pistol-bullets,0);
    
freezeplayer(0.3);
    
sleep(0.7);
    
setani("cross_pistol-idle""");
  }
}
function 
onKeypressed(){
  if (
keydown2(keycode(a),false)&&this.inuse==1) {
    
replaceani("idle""idle");
    
replaceani("walk""walk");
    
this.inuse=0;
  }

__________________

~Contact Information~
Aim: Grind64RyGuy
Email: [email protected]
Client Status:
Reply With Quote
  #9  
Old 04-11-2006, 02:23 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Quote:
Originally Posted by Yen
A+D will change weapons. It's possible that it's returning strequals(#p(1),a) as always being true?
I don't think that's why it's returning true, but it is why it's switching weapons. take a look at what he's checking for:
PHP Code:
function onKeypressed(){ 
  if (
keydown2(keycode(a),false)&&this.inuse==1) { 
He's checking for D and A :P
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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 07:27 PM.


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