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 11-12-2001, 08:01 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
weapon list..

I was b0red.. nothing much . u can learn off of it .. (i still rather use the one that comes with Graal)
I would make it go around like instead of just showing 1 it shows a circle of them. . but its not like im going to use this ^_^
NPC Code:

// NPC made by LiquidIce - PM MY RC plz
timeout=.05;
if (playerenters&&!isweapon) {
toweapons -Backpack;
}
if (isweapon) { disableselectweapons; }
if (timeout&&isweapon) {
this.timer=(this.timer+1)%3;
if (keydown(9)&&this.timer=2) {
if (this.inmenu=1) {
hideimg();
this.inmenu=0;
}
else { this.inmenu=1; }
}
if (this.inmenu=1) { disabledefmovement;
if (this.timer=2) {
checkkey();
}
draw();
}
}

function draw() {
//gain weapons count w/o hidden weapons
this.count=0;
for (this.i=0;this.i<weaponscount;this.i++) {
if (!startswith(-,#w(this.i))) { this.count++; }
}
//player has no weapons. shut down
if (this.count=0) { setplayerprop #c,You have no weapons; this.inmenu=0;hideimg(); return;}
//check if the current weapon is the first non hidden
this.notfirst=0;
for (this.i=0;this.i<selectedweapon;this.i++) {
if (!startswith(-,#w(this.i))) { this.notfirst=1 }
}
if (selectedweapon>0&&this.notfirst=1) { showimg 100,@<,screenwidth/2-20,screenheight/2; }
else { hideimg 100; }
showimg 101,#W,screenwidth/2,screenheight/2;
showimg 102,@#w,screenwidth/2-strtofloat(#v(strlen(#w)))*2,screenheight/2-30;

if (selectedweapon<this.count) {
showimg 103,@>,screenwidth/2+40,screenheight/2;
}
else { hideimg 103; }
for (this.i=0;this.i<4;this.i++) { changeimgvis this.i+100,4; }
}

function hideimg() {
for (this.i=0;this.i<4;this.i++) { hideimg this.i+100; }
enabledefmovement;
}

if (playerhurt&&this.inmenu=1) {
this.inmenu=0;
hideimg();
}
function checkkey() {
if (keydown(1)) {
//find index of before non hidden weapon
for (this.i=selectedweapon-1;this.i>-1;this.i--) {
if (!startswith(-,#w(this.i))) { selectedweapon=this.i; return;}
}
play nextpage.wav;
}
if (keydown(3)) { selectedweapon+=1; play nextpage.wav; }
}

__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)

Last edited by LiquidIce00; 11-12-2001 at 08:10 AM..
Reply With Quote
  #2  
Old 11-13-2001, 09:06 PM
jonny12 jonny12 is offline
Registered User
Join Date: Jun 2001
Location: washingtion--USA all the way!
Posts: 100
jonny12 is on a distinguished road
Send a message via AIM to jonny12 Send a message via Yahoo to jonny12
what does it do?
dose not work for me
__________________


Bomy Gang
Reply With Quote
  #3  
Old 11-13-2001, 09:28 PM
TDK_Admin1 TDK_Admin1 is offline
Registered User
Join Date: Nov 2001
Location: Northern Harkoonia
Posts: 33
TDK_Admin1 is on a distinguished road
Dude that is awesome! Could you help me learn that type of stuff like:
for (this.i=0;this.i<weaponscount;this.i++) {
please?
__________________
-Shard IceFire-
Reply With Quote
  #4  
Old 11-14-2001, 12:22 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by jonny12
what does it do?
dose not work for me
should work fine..
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #5  
Old 11-14-2001, 12:28 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by TDK_Admin1
Dude that is awesome! Could you help me learn that type of stuff like:
for (this.i=0;this.i<weaponscount;this.i++) {
please?
that just browses thru all the persons weapons..
since even hidden weapons that start with - are considered weapons,when you make your own weapon list you want to keep those away.

If you do selectedweapon+=1; (to go to the next weapon) it will work fine. but if you subtract one it wont. why? because of the hidden npc's.. If a hidden npc is before the one it will just add 1 to it until it finds a non hidden one..
So i use
NPC Code:

//find index of before non hidden weapon
for (this.i=selectedweapon-1;this.i>-1;this.i--) {
if (!startswith(-,#w(this.i))) { selectedweapon=this.i; return;}
}


which will go from your current weapon down to 0 (the first weapon) and find the closest one to it which is not a hidden weapon.
For example lets say you have
bow, bomb, -system, fireblast
When It is on fireblast and I want to go back, I dont want the -system to become the weapon, because if I set it to -system, Graal will say "thats a hidden weapon" and will go back to the fireblast. Now using the loop It will go from -system to bow looking for the first one that is not hidden, which in the case would be bomb^_^
(confusing i hope it helps hehe)
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #6  
Old 11-14-2001, 08:44 PM
TDK_Admin1 TDK_Admin1 is offline
Registered User
Join Date: Nov 2001
Location: Northern Harkoonia
Posts: 33
TDK_Admin1 is on a distinguished road
Yea I guess it helps a bit. is this.i a built in graal var or is it just the one people most commonly use?
__________________
-Shard IceFire-
Reply With Quote
  #7  
Old 11-15-2001, 03:26 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by TDK_Admin1
Yea I guess it helps a bit. is this.i a built in graal var or is it just the one people most commonly use?
most common..
i, z, a, b ,x , y
those are like the most common I believe
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #8  
Old 11-15-2001, 08:36 AM
TDK_Admin1 TDK_Admin1 is offline
Registered User
Join Date: Nov 2001
Location: Northern Harkoonia
Posts: 33
TDK_Admin1 is on a distinguished road
Hmm...very interesting.
__________________
-Shard IceFire-
Reply With Quote
  #9  
Old 11-15-2001, 10:19 AM
entravial entravial is offline
Registered User
entravial's Avatar
Join Date: Mar 2001
Posts: 825
entravial is on a distinguished road
Send a message via ICQ to entravial Send a message via AIM to entravial Send a message via Yahoo to entravial
~AlphaFlame~

this.i is a this. variable, which means it's basically a variable that only the NPC its located in can use. This. variables can be named anything you want... ex: this.thisisathisvariablelookitisntitlikethecoolest thing... just a really stupid example though :-P

Most people use this.i... probably because i stands for index in most peoples minds... *shrug*.
__________________


If the post says ~AlphaFlame~, that's who's posting. If not, it's Entravial (owner)
Reply With Quote
  #10  
Old 11-15-2001, 10:41 AM
Faheria_LAT1 Faheria_LAT1 is offline
Seraphim Warrior
Faheria_LAT1's Avatar
Join Date: Oct 2001
Location: QUÉBEC!!!!!!1
Posts: 2,040
Faheria_LAT1 is on a distinguished road
Send a message via ICQ to Faheria_LAT1 Send a message via AIM to Faheria_LAT1
Nice scripting, but you could at least be more original on how the weapons scroll and appear on the screen
__________________


"I like movies where the guy shoots stuff, and then it blows up, and then this other guy shoots him, and then the first guy drives through a Coke sign, and it blows up, and the car flips over in slow motion, and then the guy gets out and pops his arm back in place, and then they fight 'cause they're out of bullets, and the guy says something like "This is Walmart, boy...and you just got price-checked!" - Broken Saints

"There is no greater sorrow than to recall in misery when we were happy" - Dante

"If you know yourself but not the enemy, for every victory gained you will also suffer a defeat" - Sun Tzu, The Art Of War

"Kingdoms ...rising without word. Collapsing without warning." - Broken Saints

Account now used by Silver and Mmmmkay
yoshee15 account has run out :[[[
Reply With Quote
  #11  
Old 11-15-2001, 10:45 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by Faheria_LAT1
Nice scripting, but you could at least be more original on how the weapons scroll and appear on the screen
I kno I was just learning
It would be neat if it was like listed alphabetically or something like that .. or listed FF7 style (like a screen then opens up a screen in a screen..and so on) .. or have like the Hat item where its a circle of the weapons (would be trouble with too many weapons though)
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #12  
Old 11-15-2001, 10:57 AM
entravial entravial is offline
Registered User
entravial's Avatar
Join Date: Mar 2001
Posts: 825
entravial is on a distinguished road
Send a message via ICQ to entravial Send a message via AIM to entravial Send a message via Yahoo to entravial
~AlphaFlame~

Quote:
I kno I was just learning
It would be neat if it was like listed alphabetically or something like that .. or listed FF7 style (like a screen then opens up a screen in a screen..and so on) .. or have like the Hat item where its a circle of the weapons (would be trouble with too many weapons though)
Alphabetical:
... for loop... strequals...

FF7 style:
... showimg... for loops... and hidden weapons to determine what goes where...

Circle:
... limit the amount of weapons shown at one time... showimg... yet again, for loop...
__________________


If the post says ~AlphaFlame~, that's who's posting. If not, it's Entravial (owner)
Reply With Quote
  #13  
Old 11-16-2001, 06:17 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
Quote:
Originally posted by entravial
~AlphaFlame~



Alphabetical:
... for loop... strequals...

FF7 style:
... showimg... for loops... and hidden weapons to determine what goes where...

Circle:
... limit the amount of weapons shown at one time... showimg... yet again, for loop...
uhhhh..
alphabetically u would have to create an array with all the letters in order..
and FF7 style is just like a menu then it would be grouped..

for circle u would just use cosine/sine (or that new getangle thing) and add radius depending on weaponscount
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #14  
Old 11-16-2001, 07:07 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Simple but neat. Useless though, unless it servers somesort of purpose like showing other things besides wepons. ect ect.
__________________

subliminal message: 1+1=3
Reply With Quote
  #15  
Old 11-16-2001, 02:24 PM
Slaktmaster Slaktmaster is offline
man with the mastahplan
Slaktmaster's Avatar
Join Date: Apr 2001
Location: Half-way over the river styx
Posts: 4,422
Slaktmaster is an unknown quantity at this point
Send a message via ICQ to Slaktmaster Send a message via AIM to Slaktmaster
Cool, I wish my computer worked so I could finish my weapon list script

Its going to be "special", mainly because I'm not a good scripter.
Reply With Quote
  #16  
Old 11-16-2001, 05:13 PM
ninjaterd ninjaterd is offline
Banned
Join Date: Oct 2001
Location: somewere
Posts: 247
ninjaterd is on a distinguished road
Send a message via AIM to ninjaterd
hes right

Quote:
Originally posted by jonny12
what does it do?
dose not work for me
hes right u know this script just doesnt work.......sorry.....i entered the level and got no weapon or nuffin
Reply With Quote
  #17  
Old 11-16-2001, 05:41 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
that would look twice as awesome with some background gifs for it too ...
Reply With Quote
  #18  
Old 11-16-2001, 05:42 PM
nyghtGT nyghtGT is offline
Banned
nyghtGT's Avatar
Join Date: Jun 2001
Posts: 3,993
nyghtGT is on a distinguished road
Send a message via AIM to nyghtGT
Re: hes right

Quote:
Originally posted by ninjaterd

hes right u know this script just doesnt work.......sorry.....i entered the level and got no weapon or nuffin
your so dumb ... it works for people who actually somewhat know what it does ....
Reply With Quote
  #19  
Old 11-17-2001, 03:28 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
yes it works
it could be useful if you were developing your own type of weapon system .. like Boco was ..
also if you wanted to make a FF style battlesystem you could use this to change weapons or something .. or just use the disableselectweapons command to just disable the weapon list
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
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 03:36 PM.


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