Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Guns Not Shooting (https://forums.graalonline.com/forums/showthread.php?t=76595)

Knightmare1 09-01-2007 05:40 AM

Guns Not Shooting
 
2 Attachment(s)
i have 2 scripts and the both wont shoot, im confused.... ive tried everything!

Knightmare1 09-01-2007 05:44 AM

in the second script? it works until u try to reload........

Googi 09-01-2007 07:08 AM

Okay, first, don't post your script in attachments. Copy and paste it into your post enclosed in php tags.

Second, try and see if you can find which part of your script (if any) isn't executing when it's supposed to by having the different parts set player.chat to something or place a bomb somewhere or produce some other visible effect if they otherwise wouldn't.

DustyPorViva 09-01-2007 07:13 AM

You can't post scripts in php tags anymore, a large percentage of the time the forums will give you a "bad request error" because it thinks you're posting malicious code. I've posted to have this fixed, but still nothing.

Googi 09-01-2007 07:20 AM

Quote:

Originally Posted by DustyPorViva (Post 1345036)
You can't post scripts in php tags anymore, a large percentage of the time the forums will give you a "bad request error" because it thinks you're posting malicious code. I've posted to have this fixed, but still nothing.

What about code tags? At the very least, if all else fails put it in a pastebin and post the link.

DustyPorViva 09-01-2007 07:23 AM

As long as it's in the post it'll screw up, no matter the tag. As for the bin, I don't think it's that widely known, at least, I didn't know about it.

Knightmare1 09-01-2007 07:24 AM

Quote:

Originally Posted by Googi (Post 1345035)
Okay, first, don't post your script in attachments. Copy and paste it into your post enclosed in php tags.

Second, try and see if you can find which part of your script (if any) isn't executing when it's supposed to by having the different parts set player.chat to something or place a bomb somewhere or produce some other visible effect if they otherwise wouldn't.

its all working, and here:
PHP Code:

//Nightmare’s Faulty Gun
//#CLIENTSIDE
function onCreated() {
DeactivateGun();

this.ganilist = {
"idle",//nightmare_m16_idle
"sword",//nightmare_m16_fire
"walk"//nightmare_m16_walk
};

this.shootdelay 0.1;
this.attackpower 10;

client.strafe_direction = -1;

setTimer(0.05);
}


// Gun Code
function onTimeout() {
if(
keydown2(160true)) {
if(
client.strafe_direction == -1) {
client.strafe_direction player.dir;
}

player.dir client.strafe_direction;
} else {
client.strafe_direction = -1;
}

setTimer(0.05);
}

function 
onKeyPressed() {
if(
player.freezetime
if(
this.active) {
if(
keydown(5)) {
freezeplayer(this.shootdelay);
setani(nightmare_m16_fireNULL);
this.angle=getangle(vecx(playerdir),vecy(playerdir));
this.bulletangle = -.2;
setshootparams(player.accountthis.attackpower 3);
shoot(player.x+.3player.y+.3player.zthis.angle+random
(this.bulletangleabs(this.bulletangle)), 00" bullet1",”” );
}
if(
keydown(6)) {
DeactivateGun();
}
}
}


function 
onWeaponFired() {
if(!
this.active) {
ActivateGun();
} else {
DeactivateGun();
}
}

function 
ActivateGun() {
setplayerprop ,nightmare_m16rifle.gif;
replaceani("idle"“nightmare_m16_idle”);
replaceani("sword"“nightmare_m16_attack”);
replaceani("walk",” nightmare_m16_walk”);

setani(“nightmare_m16_idle”);

this.active true;
}

function 
DeactivateGun() {
replaceani("idle""idle");
replaceani("sword""sword");
replaceani("walk""walk");

setani("idle"NULL);

this.active false;


this one makes most sence (if any) and can exacute perfectly

Kyranki 09-01-2007 07:26 AM

Poor scripting styling makes for awful reading of your code.

Googi 09-01-2007 07:43 AM

Quote:

Originally Posted by Knightmare1 (Post 1345044)
hey my scripting style aint got nothing on you -.-

Notice how all the other scripts on the forum indent each line based on how many ifs/withs/fors/whiles/etc it's within? Learn to do that.

Knightmare1 09-01-2007 07:44 AM

o.O wow

Twinny 09-01-2007 08:17 AM

If you can't be bothered to style, on RC type "/style weapon test" replacing 'test' with your weapon name. Change 'weapon' to dbnpc if it's a dbnpc and so forth. Makes it easier for the rest of us ^^

Kyranki 09-01-2007 08:35 AM

Quote:

Originally Posted by Knightmare1 (Post 1345044)
hey my scripting style aint got nothing on you -.-

That didn't make any sense. o_O

Knightmare1 09-03-2007 01:41 AM

hm... maybe i need to use the onActionProjectile(); but i have no clue where to put it now o.O
ive never used before

Inverness 09-03-2007 02:08 AM

I don't read scripts unless they're styled properly, thats just how it is.


All times are GMT +2. The time now is 11:36 AM.

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