Quake3World.com
https://www.quake3world.com/forum/

Menu weapon selection difficulties
https://www.quake3world.com/forum/viewtopic.php?f=16&t=43834
Page 1 of 1

Author:  bludshot [ 06-06-2010 02:38 PM ]
Post subject:  Menu weapon selection difficulties

I'm working on a weapon selection functionality for my in-game menus and I'm hitting a road block (at least with my understanding of things).

I have a sub menu for selecting which pistol your player will be equipped with. The sub menu just shows pictures of pistols and you click on the one you want. So the action on each pistol picture is:

action { uiScript "gearSetItem" ; close ingame_select_gear_pistol; open ingame_select_gear }

Then in ui_main.c in UI_RunMenuScript() I added a new else if near the bottom,

else if (Q_stricmp(name, "gearSetItem") == 0) {
//blud: need to write this :o
}

The problem I am having is that right there in that else if, how do I know which pistol they clicked on? Is there a way to some how pass along a parameter?

The only thing I can think of is if clicking that pistol also set the value of a cvar like cg_pistol 2, and then in the else if I could check the value of cg_pistol to know which pistol they picked... *but* my problem there is I don't know how to have the itemDef set the value of cg_pistol simply by clicking on it, is this possible?

Seems like being able to somehow pass a parameter would be superior to that though.

Now the only "solution" I have is to write a new else if for every single weapon and item in the game like uiScript "gearSetItemGlock", but I know that's sloppy and ridiculous! rofl.

I've been reading http://www.linux.ucla.edu/~phaethon/q3t ... amenu.html and http://rfactory.org/scripting.html like crazy but I can't find the answers or figure this out.

Author:  ^misantropia^ [ 06-07-2010 02:14 AM ]
Post subject:  Re: Menu weapon selection difficulties

I'm a bit strapped for time so no complete answer right now but take a look at the 'choose player model' code, that should get you going.

Author:  bludshot [ 06-11-2010 01:59 PM ]
Post subject:  Re: Menu weapon selection difficulties

Well, I don't actually have Team Arena right now, I lent my cd away a couple years ago. Making arrangements to get my cd back and then I can install TA and take a look at the model selection heh.

Author:  bludshot [ 06-15-2010 07:08 PM ]
Post subject:  Re: Menu weapon selection difficulties

Ah ok, I took a look at it. It uses a listbox and feeder. I can't really use that for the way I'm doing my weapon selection. I have different slots for weapons and items, so I would need a feeder for each one - plus I do it on multiple menus that pop up....

I'm not saying that it couldn't be done somehow that way, but, I'm trying to achieve something similar to how Urban Terror does it, and they don't use feeders.

They do itemDefs that show a picture of the gun that have:

ownerdrawParam ITEM_SPAS12
action { uiScript "gearSetItem"

So somehow this "ownerdrawParam" value is known by the gearSetItem uiScript code. I don't know how they do that, it seems like ownerdrawParam is some whole new thing they added (which I wouldn't know how to add).

So the only thing I know how to do is to go with my ugly solution of writing a new else if uiScript for every single weapon and item in the game, like: uiScript "gearSetItemGlock", uiScript "gearSetItemVest", etc...

Author:  ^misantropia^ [ 06-16-2010 12:10 AM ]
Post subject:  Re: Menu weapon selection difficulties

If that works for you, go for it!

Author:  bludshot [ 06-16-2010 08:52 PM ]
Post subject:  Re: Menu weapon selection difficulties

Well it doesn't work for me as well as some mystery better way that I don't know about would, so I'm all ears :p (but otherwise yeah I guess this will do)

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/