Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inventory GUI

#1
Hi. I've been trying to mod Xonotic a bit, and the weapons and such seem pretty easy with the variables available, but I've had to go into modifying qc files for other things. The Inside3D tutorials seem to work with a little modification (and compensating for relocation and renaming of a lot of things).

However, I've run into the problem. I believe I need a gui interface for an "Inventory menu" I'm trying to same, to select your starting weapons, packs, armor/health level, etc. I would need sliders, tabs, etc. what's available in the regular Xonotic settings, including a config file. The problem lies in that most of the gui interface files I've looked at seem very specific and absolute. I can't seem to borrow code from them, and I'm not sure how to integrate the non-specific elements in a gui. There is one tutorial about replacing the in-game gui interface, but nothing about adding a menu, sliders, checkboxes, etc. Can someone give me some pointers on how to go about adding a new gui "inventory" menu?

Furthermore, can the inventory stuff I mentioned be integrated into a mutator, because I'm changing the code where it is atm?

And also, I've been searching for info on what armor really does, and I can't find anything about it. It doesn't exactly seem to behave exactly like health. What exactly does it help with, other than help prevent dying? How exactly?

Thanks for any assistance and info.
Reply

#2
Hi and welcome to the forums. Your mod doesn't feature an axe as a weapon, does it?

Armor compensates damage points just as health does. Damage points you receive will be split between armor and health in a certain percentage. I'm not absolutely certain about the exact percentage of the allocation of damage points to health/armor, but my guts tell me it's something about 1/3 health and 2/3 armor. So if you receive 30 dmg points you'll get 10 points deducted from your health and 20 from your armor if you have any. Of course if you don't have enough armor, the remaining damage points will get deducted from your health :o)

Can't assist you with your other questions, I'm afraid.
My Xonstats Profile
Latest track on soundcloud: Farewell - to a better Place (piano improvisation)
New to Xonotic? Check out the Newbie Corner!

Reply

#3
EDIT: I'm not really addressing your question through your perspective. Xonotic is quite different from Quake in QC code, so I would say that the best thing to get inspiration from to mod xonotic would be Xonotic itself. While Inside3D's tutorials can be nice and let you learn the language, I'm not sure how useful they can be in practical terms to modding Xonotic. Especially in terms of menu code.



I don't know much about the Xonotic UI, but if you plan on making an interface ingrained in the gameplay like an inventory menu would be, I think you'll have a hard time:

The menu code that you are probably looking at (qcsrc/menu) is good for viewing and setting configuration variables (cvars) as well as sending console commands, but something like an inventory that heavily relies on the current state of the game should not be done in menu qc. The reason for this is that there are three isolated pieces of the engine that run their own QC code: the client side (csqc), the server (svqc) and the menu (menu qc). Typically a player runs the client and menu side and the server runs the server side. (Irrelevant note: in singleplayer and other games created directly from the client, all three run concurrently.) The problem is that they are mostly independant (they don't share variables directly) and there is a certain degree of interaction between the client and server through networked entities, but the menu only communicates with the client and server through setting cvars and sending console commands.

"Interactive" menus in menu qc do exist, but there is no convenient interface that you can readily use for that. The most interactive piece of menu that I can think of is the sandbox (xonotic/dialog_sandboxtools.c I believe), feel free to have a look at that. If I'm not mistaken, it's only one-way menu -> server communication through console commands. In second place would be the team select dialog which is a fairly simple example of server <-> menu communication: the buttons send team switch commands and the server sets the _teams_available cvar, also through console commands (stuffcmd, see server/cl_client.qc, ClientConnect). Making a whole inventory system like that would get fairly messy.

It would make much more sense to implement your UI in CSQC (the client side), which is (among other things) in charge of the HUD. The problem with that is that there's no convenient UI toolkit like the menu code has. There's not a ton of interactivity in CSQC now, and I don't know if there is any that uses the mouse apart from the map voting screen (client/mapvoting.qc). The code is much messier there than in the menu, unfortunately.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Q3Map2Wizard - a map compiler GUI for Xonotic Maddin 9 20,416 11-23-2012, 12:59 AM
Last Post: Cyber Killer

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-