Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Custom Qmenu (https://forums.graalonline.com/forums/showthread.php?t=68385)

Angel_Light 08-27-2006 07:19 PM

Custom Qmenu
 
I have made a custom qmenu and I need to know how to display all the player weapons, on Niromia every weapon img is 32 by 32 (pixels). So how do I display all the weapons with images.

xXziroXx 08-28-2006 05:17 PM

Make a loop go through all the players weapons, and display an image for each of them?

contiga 08-28-2006 07:43 PM

Quote:

Originally Posted by excaliber7388
Excelent :) I also plan to script one, I hope you don't mind me using this as a base :)

Ofcourse you can use that as base! Just change player.weapons to an array with weapons you actually want to draw. Something that could make a selection of weapons that you'd like to draw / not to draw:

PHP Code:

temp.wlist.clear();
temp.disabled = { "-", "+"};
for ( 
i: player.weapons) {
  for ( 
j: temp.disabled) {
    if ( !
i.name.starts( j))
      
temp.wlist.add( { i.name, i.image});
  }
}

for ( 
i = 0; i < temp.wlist.size(); i ++) {
  
with ( findImg( 200 + i)) {
    
image = temp.wlist[ i][ 1];
    
x = start x + ( space_between_items_horizontal + 32 * ( i % ammount_of_items_horizontal));
    
y = start y + ( space_between_items_vertical + 32 * int( i / ammount_of_items_horizontal));
    
layer = 4;
  }
} 

Good luck with it! If you have any questions, feel free to ask.

Angel_Light 08-29-2006 01:33 AM

Thank-you you two!

excaliber7388 08-29-2006 02:31 AM

Quote:

Originally Posted by contiga
For drawing players weapons use:
PHP Code:

for ( i = 0; i < player.weapons.size(); i ++) {
  
with ( findImg( 200 + i)) {
    
image = player.weapons[ i].image;
    
x = start x + ( space_between_items_horizontal + 32 * ( i % ammount_of_items_horizontal));
    
y = start y + ( space_between_items_vertical + 32 * int( i / ammount_of_items_horizontal));
    
layer = 4;
  }
} 

Change:
space_between_items_horizontal
space_between_items_vertical
ammount_of_items_horizontal
Into what you want that thing to be.

Excelent :) I also plan to script one, I hope you don't mind me using this as a base :)

contiga 08-29-2006 09:53 AM

Oh see my first post, I edited it instead of creating new one x-x

Rapidwolve 08-29-2006 03:05 PM

Quote:

Originally Posted by contiga
Oh see my first post, I edited it instead of creating new one x-x

Lol I was wondering wtf?

contiga 09-01-2006 08:39 PM

Oops, I just see I made a fault;
PHP Code:

this.wlist.clear();
temp.disabled = { "-", "+"};
for ( 
i: player.weapons) {
  for ( 
j: temp.disabled) {
    if ( !
i.name.starts( j))
      
this.wlist.add( { i.name, i.image});
  }
}

for ( 
i = 0; i < this.wlist.size(); i ++) {
  
with ( findImg( 200 + i)) {
    
image = thiso.wlist[ i][ 1];
    
x = start x + ( space_between_items_horizontal + 32 * ( i % ammount_of_items_horizontal));
    
y = start y + ( space_between_items_vertical + 32 * int( i / ammount_of_items_horizontal));
    
layer = 4;
  }
} 

What was wrong? I did temp.wlist, which isn't realy wrong, to make a list.. but it couldn't load within the with ( findImg( 200 + i)) { // stuff } part. This is an update, that should work.


All times are GMT +2. The time now is 09:55 PM.

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