Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 43 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Opening menu after weapon selection
Ni3ls
General Member
Since: Nov 7, 2008
Posts: 256
Last: Sep 9, 2017
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Saturday, Jan. 15, 2011 07:58 pm
Hi,

I would like to make a mod that after you've chosen your weapon immediately opens a second menu containing a list of possible xmodels. So you can choose as allies a british, russian or american player(x)model. And axis would be different german (x)models.
So I looked into _menus and precached my own menu. its called modelselect
Code:
init()
{
	game["menu_ingame"] = "ingame";
	game["menu_modelselect"] = "modelselect";
	game["menu_team"] = "team_" + game["allies"] + game["axis"];
	game["menu_weapon_allies"] = "weapon_" + game["allies"];
	game["menu_weapon_axis"] = "weapon_" + game["axis"];

	precacheMenu(game["menu_ingame"]);
	precacheMenu(game["menu_modelselect"]);
	precacheMenu(game["menu_team"]);
	precacheMenu(game["menu_weapon_allies"]);
	precacheMenu(game["menu_weapon_axis"]);


If you scroll down in _menus you will see this.
Code:
		else if(menu == game["menu_weapon_allies"] || menu == game["menu_weapon_axis"])
		{
			self closeMenu();
			self closeInGameMenu();
			self [[level.weapon]](response);
		}

It seems to me that i must open the menu right here.

Code:
		else if(menu == game["menu_weapon_allies"] || menu == game["menu_weapon_axis"])
		{
			self closeMenu();
			self closeInGameMenu();
			self openMenu(game["menu_modelselect"]);
			self closeMenu();
			self closeInGameMenu();
			self [[level.weapon]](response);
		}

Am I doing it right? And how can I make that modelselect menu? I know how it works in quickmessage, because I made a Hide&seek mod.

Code:
		itemDef
		{
			name			"window"
			group			ingamebox
			visible			1
			rect			16 20 0 0
			origin			ORIGIN_QUICKMESSAGEWINDOW
			forecolor		1 1 1 1
			textfont		UI_FONT_NORMAL
			textscale		.24
			textaligny		8
			text			"1. HalfTrack"
			decoration
		}
		execKey "1" { scriptMenuResponse "halftrack"; close modelsection1 }

And in _quickmessage
Code:
modelSection1(response)
{
	
   if(self.pers["team"]=="axis") 
   return;
   self iprintlnBold("Choosing a");
   self iprintlnBold(response);

   switch(response)		
	{

        case "halftrack":
         self detachall();
         self disableweapon();
         self setmodel("xmodel/vehicle_halftrack_mg_desert");
         break;


But I don't have any idea how that will work in these kind of menu's
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Saturday, Jan. 15, 2011 08:57 pm
That looks like it would work.

As for the menu? Just use a weapon menu as a base and work from that, that's what I do.
Share |
Ni3ls
General Member
Since: Nov 7, 2008
Posts: 256
Last: Sep 9, 2017
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Sunday, Jan. 16, 2011 09:15 am
Code:
#include "ui_mp/menudef.h"

#define ORIGIN_TITLE				48 64
#define ORIGIN_CHOICE1				80 84

{
	menuDef
	{
		name			"modelselect"
		rect			0 0 640 480
		focuscolor		GLOBAL_FOCUSED_COLOR
		style			WINDOW_STYLE_EMPTY
		blurWorld		5.0
		onEsc 
		{
			close modelselect;
		}

		// Gradient
		itemDef
		{
			style			WINDOW_STYLE_SHADER
			//rect			-107 0 554 480
			rect			0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
			background		"gradient"
			visible			1
			decoration
		}

		#include "ui/bars.menu"

		itemDef
		{
			type			ITEM_TYPE_TEXT
			visible			1
			origin			ORIGIN_TITLE
			forecolor		1 1 1 1
			text			"Modelselect"
			textfont		UI_FONT_NORMAL
			textscale		GLOBAL_HEADER_SIZE
			decoration
		}

// MENU CHOICES
		execKey "1" { scriptMenuResponse "noheadgerman"; close modelselect; }


		itemDef 
		{
			name			"button_noheadgerman"
			visible			1
			rect			0 0 128 24
			origin			ORIGIN_CHOICE1
			forecolor		GLOBAL_UNFOCUSED_COLOR
			type			ITEM_TYPE_BUTTON
			text			"1. Headless German"
			textfont		UI_FONT_NORMAL
			textscale		GLOBAL_TEXT_SIZE
			textstyle		ITEM_TEXTSTYLE_SHADOWED
			textaligny		20
			dvartest		"ui_allow_noheadgerman"
			showDvar		{ "1" }
			action
			{
				play "mouse_click";
				scriptMenuResponse "noheadgerman";
				close modelselect;
			}
			onFocus
			{
				play "mouse_over";
			}
		}

And than in _menus
Code:
onMenuResponse()
{
	for(;;)
	{
		self waittill("menuresponse", menu, response);
		//iprintln("^6", response);

		if(response == "noheadgerman")
		{
        	self detachall();
      		self setmodel("xmodel/playerbody_german_africa01")
		}

		if(response == "back")
		{
			self closeMenu();
			self closeInGameMenu();


Like that? And how can i do that if axis choose weapon the modelselect for axis opens and for allies the one for allies models?
Modelselect1 is for Axis and Modelselect2 is for Allies.
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Jan. 16, 2011 10:28 am
self.pers["team"] gives you the player's team.
Share |
Ni3ls
General Member
Since: Nov 7, 2008
Posts: 256
Last: Sep 9, 2017
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Sunday, Jan. 16, 2011 10:40 am
I know,but I don't know where i can put that...
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Jan. 16, 2011 05:37 pm
haha thats so weird because i remember when i made this mod called HnS when i was a noob at scripting and robinson guided me threw the whole thing basicly, (hide and seek) and this code you have here.
Code:
modelSection1(response)
{
	
   if(self.pers["team"]=="axis") 
   return;
   self iprintlnBold("Choosing a");
   self iprintlnBold(response);

   switch(response)		
	{


is the exact same thing i had! like looking at mine now and not 1 difference besides modelSection1(response) and i remembered i never made it server side on my server and people took my mod and never gave either 1 of us credit! was funny days lolol. and how did you even get that far in your script if you dont even know how to use self.per["team"]? because it looks like you used it fine over here... if(self.pers["team"]=="axis")
return;


yeah weird right?
Share |
Ni3ls
General Member
Since: Nov 7, 2008
Posts: 256
Last: Sep 9, 2017
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Sunday, Jan. 16, 2011 08:27 pm
So you think i stole your mod? How about robinson stole mine maybe? I made hns before 1 other server had that mod... It was called verstoppertje. That was only for my home server 5 years ago. Than I translated it into hide and seek. First I had 1 menu, but other people had suggestions for models, so I used their ideas. This was not difficult to script.

And ontopic: If you see i said: I know,but I don't know where i can put that...
Ofcourse I know that self.pers team poo-poo...
But I never made a menu like this, only quickmessage. Can you please help me? And helping means not saying that i steal poo-poo, becuase I don't!
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Sunday, Jan. 16, 2011 11:01 pm
no i just said they look the same never said u stole anything... and yeah thats funny about robinson... this is finger painting in kindergarten to him lol. good luck with your mod! [thumbs_up]
Share |
clanhelio
General Member
Since: Aug 30, 2008
Posts: 223
Last: Mar 24, 2011
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Sunday, Jan. 16, 2011 11:56 pm
nwestenberg writes...
Quote:
I know,but I don't know where i can put that...

This website isn't here for us to do the work for you. It's right there in front of you, figure it out.
Share |
Ni3ls
General Member
Since: Nov 7, 2008
Posts: 256
Last: Sep 9, 2017
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Monday, Jan. 17, 2011 04:58 am
lol...
I though something like this than
Code:
		else if(menu == game["menu_weapon_allies"] || menu == game["menu_weapon_axis"])
		{
			self closeMenu();
			self closeInGameMenu();
		
			if(self.pers["team"] == "allies")
			{
				self openMenu(game["menu_modelselect2"]);
				self closeMenu();
				self closeInGameMenu();
			else
			{
				self openMenu(game["menu_modelselect1"]);
				self closeMenu();
				self closeInGameMenu();
			}
			self [[level.weapon]](response);
		}

Modelselect1 with axismodels and modelselect2 with alliesmodels.

But see me previous post of the example of menu how it should be. Will it work with that?
Code:
		if(response == "noheadgerman")
		{
        	self detachall();
      		self setmodel("xmodel/playerbody_german_africa01")
		}
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»