Quake3World.com Forums
     Programming Discussion
        Menu weapon selection difficulties


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: Menu weapon selection difficulties

Grunt
Grunt

Joined: 25 Nov 2009
Posts: 64
PostPosted: 06-06-2010 02:38 PM           Profile Send private message  E-mail  Edit post Reply with quote


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.




Top
                 

Mentor
Mentor

Joined: 12 Mar 2005
Posts: 3958
PostPosted: 06-07-2010 02:14 AM           Profile Send private message  E-mail  Edit post Reply with quote


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.




Top
                 

Grunt
Grunt

Joined: 25 Nov 2009
Posts: 64
PostPosted: 06-11-2010 01:59 PM           Profile Send private message  E-mail  Edit post Reply with quote


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.




Top
                 

Grunt
Grunt

Joined: 25 Nov 2009
Posts: 64
PostPosted: 06-15-2010 07:08 PM           Profile Send private message  E-mail  Edit post Reply with quote


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...




Top
                 

Mentor
Mentor

Joined: 12 Mar 2005
Posts: 3958
PostPosted: 06-16-2010 12:10 AM           Profile Send private message  E-mail  Edit post Reply with quote


If that works for you, go for it!




Top
                 

Grunt
Grunt

Joined: 25 Nov 2009
Posts: 64
PostPosted: 06-16-2010 08:52 PM           Profile Send private message  E-mail  Edit post Reply with quote


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)




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group