Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Helpo Changeo (https://forums.graalonline.com/forums/showthread.php?t=18575)

Knight_Vincent 12-09-2001 09:45 AM

Helpo Changeo
 
Ok,

I have a npc that you become and can shoot with by using keydown, but when its out ammo the thing want stop shooting and i do have the if (playerbombs<0) and playerbomb-=1 in there but how would i disable the D jkey if the player bombs = 0??

-Knight_Vincent

AlexH 12-09-2001 09:50 AM

just use disabledefweapons and then use your keydown

Knight_Vincent 12-09-2001 09:56 AM

Like This?

if (playerbombs==0) {
if (keydown(4))disableweapons; :confused:

-Knight_Vincent

AlexH 12-09-2001 10:03 AM

no you would disable the keys when the player entered the level/fired the NPC (depending on which way youve made the game) then do the keydown stuff

Knight_Vincent 12-09-2001 10:05 AM

Um,

But how do i disable a key is what i mean.

-Knight_Vincent

AlexH 12-09-2001 10:09 AM

well supposing you want it to do it when you fire the NPC do it like this

NPC Code:

if (weaponfired) {
disabledefmovement;
}
if (keydown(4)) {
whatever it does;
}



just put in the keydown 4 bit a thing to check the player still has ammo or whatever it uses

Knight_Vincent 12-09-2001 10:18 AM

Ok,

I want it so if i run outa ammo keydown 4 is dissabled for 15 secounds while it recharges...

-Knight_Vincent

Sennema 12-09-2001 11:07 AM

NPC Code:

if(playerbombs>0&&keydown(4)){
commands go here;
}
if(playerbombs==0){
timeout=15;
if(timeout){
playerbombs=99; //or whatever number
}
if(keydown(4)&&playerbombs==0){
play nextpage.wav;
}



or something to that effect. You can replace the "play nexpage.wav" to anything you want to take up time while it recharges.

Knight_Vincent 12-09-2001 11:28 AM

Hmmm,

Well that works to regain the ammo and lose the ammo but it still does not disable keydown 4 for 15 secs

-Knight_Vincent

Sennema 12-09-2001 11:43 AM

how about ...
NPC Code:

if(keydown(4)&&playerbombs==0){
setani idle,; // or whatever gani/ sprite your using.
}



You can't really disable it, only make it so it doesn't do anything when pressed.

Knight_Vincent 12-09-2001 12:05 PM

Ok,

But im not useing a gani... I haved tryed,

if (keydown(4)&&playerbombs==0)
setplayerprop #c, ...Recharging...;
timeout=15;

if (timeout)
playerbombs=99;
setplayerprop #c, ...Recharged...;

if (keydown(4)&&playerbombs<0)
function shoot() {
play effect1.wav;
shots[bllt]=ship[0]+addx;
shots[bllt+1]=ship[1]+addy;
shots[bllt+2]=addx;
shots[bllt+3]=addy;
if (bllt<maxshots*4) {bllt+=4}else{ bllt=0;
}
}

but all it does is make a lagy coppie of the ship and still lets you shoot wile it reloads :(. Im stumped :(.

-Knight_Vincent

Sennema 12-09-2001 12:08 PM

Quote:

Originally posted by Knight_Vincent
Ok,

But im not useing a gani... I haved tryed,

if (keydown(4)&&playerbombs==0)
setplayerprop #c, ...Recharging...;
timeout=15;

if (timeout)
playerbombs=99;
setplayerprop #c, ...Recharged...;

if (keydown(4)&&playerbombs<0)
function shoot() {
play effect1.wav;
shots[bllt]=ship[0]+addx;
shots[bllt+1]=ship[1]+addy;
shots[bllt+2]=addx;
shots[bllt+3]=addy;
if (bllt<maxshots*4) {bllt+=4}else{ bllt=0;
}
}

Ok, try this:
NPC Code:

if(playerbombs==0){
timeout=15;
}
if (keydown(4)&&playerbombs==0){
setplayerprop #c, ...Recharging...;
}
if (timeout){
playerbombs=99;
setplayerprop #c, ...Recharged...;
}
if (keydown(4)&&playerbombs>0){
function shoot() {
play effect1.wav;
shots[bllt]=ship[0]+addx;
shots[bllt+1]=ship[1]+addy;
shots[bllt+2]=addx;
shots[bllt+3]=addy;
if (bllt<maxshots*4) {bllt+=4}else{ bllt=0;
}
}


There, that should work

Knight_Vincent 12-09-2001 12:20 PM

Hmm,

Well at least its not cloning the ship now but... the bombs go from 99 to 98 back to 99... they wont drop any further. :(

-Knight_Vincent


All times are GMT +2. The time now is 12:33 PM.

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