Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Q weapons list replacement (https://forums.graalonline.com/forums/showthread.php?t=19817)

Mortur 12-28-2001 10:33 PM

Q weapons list replacement
 
I am trying to make a new menuing system for a playerworld that is comming up.. and i have run into a snag, i cannot find any threads on it either, i wouldnt know where to look.

i am trying to create a list of items in a sub-menu similar to how the layout of the original Q list works, images getting cut off on the bottom, but stil showing at least a little bit. i know how to get the rest of it done, but its the image cutting off that is giving me a hard time, can anyone help with maybe either a sample script or some commands that would work?

thank you, i would post what i have so far, except i am too afraid they would get stolen and put on other playerworlds.

Thanks in advance!

Mortur

Androk2k1 12-28-2001 10:35 PM

Andor has same thing their NAts might help

grim_squeaker_x 12-28-2001 10:35 PM

You could be able to use changeimgpart, although there's no way of finding out the height and width of an image, so you'd probably have to make all of them the same size.

Mortur 12-28-2001 10:37 PM

Thats what i was afraid of.. making them all the same size... either that or just do a text scroll.. and showing the image on the side... when the cursor comes on it...

kittygirl765 12-28-2001 10:55 PM

Quote:

Originally posted by Androk2k1
Andor has same thing their NAts might help
*cough* *cough* all of Andor's NATs quit *cough* *cough*

LiquidIce00 12-29-2001 06:24 AM

Here is an example for a custom one .. if you want to make the bags (like sub menus ill xplain after the script)

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; }
}



thats like a custom weapon inv.

if u want the bag its simple .. you would do like

NPC Code:

if (playertouchsme) {
toweapons Tools/Hammer;
}


that would make a bag called Tools with a weapon called Hammer in it .. but when you use stuff like if (hasweapon(Tools/Hammer)) make sure to include the subdir..
ok have fun ;) (btw my weapon system doesnt work with sub dirs .. i should make something like it ..I would but im not going to use it so I would just waste my time .. ;P)

kyle0654 12-31-2001 12:21 AM

Your problem probably isn't that images are getting cut off, but that they're all drawing on the same layer. Try using a lower layer for the background of the menu and higher layers for the weapon images.

(by layers I mean using changeimgvis of course)

Mortur 12-31-2001 02:01 AM

The problem is that i WANT them to get cut off at a certin point... just like the Q menu...

but i dont think it can be done....

not at least without some super major scripting....

i could do it, but is it worth it? i dont know.

I think i will stick with another idea, and have it with text and have the icon of the weapon apear on the side of it.

BocoC 12-31-2001 05:03 AM

You CAN'T make a custom Q menu like the current one. There is no way to get the width and height of the NPC Image. You CAN however make the NPC's cut off. Just loop through each weapon and if it is below or above a certain point, find how much it extends out and use changeimgpart to correct it.

LiquidIce00 12-31-2001 02:27 PM

Quote:

Originally posted by BocoC
You CAN'T make a custom Q menu like the current one. There is no way to get the width and height of the NPC Image. You CAN however make the NPC's cut off. Just loop through each weapon and if it is below or above a certain point, find how much it extends out and use changeimgpart to correct it.
he can make all the img's the same width and height. that be a pain if he has alot of npc's already w/ imgs and needs to change all of them though ..

LordMatt 12-31-2001 04:55 PM

Quote:

Originally posted by kittygirl765


*cough* *cough* all of Andor's NATs quit *cough* *cough*

you were the only nat and nat cheif and you quit for unknown reasons now we're stuck with a person who rarely comes on and listens.

Mortur 12-31-2001 11:04 PM

There is away to do it with a 2 layer menu, and the menu items apear between sandwiched and can only be seen through the hole in the upper one. but i think that would be too buggy, and i dont believe anyone has tried that before, so i am not going to waste my time on making it and find out it lags like crazy.

Thanks for all the help everyone!:D


All times are GMT +2. The time now is 07:52 PM.

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