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

Members Online

»
0 Active | 58 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 subscribe
Author Topic: HUD Text
r00t_
General Member
Since: Dec 15, 2010
Posts: 51
Last: May 16, 2011
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, May. 9, 2011 01:45 am

copyright Selbie's botzombie server.

Are these HUD elements made from a .menu file or a .gsc file?

I've never been keen about .menu files so I'm hoping it's .gsc[thumbs_up]
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: Monday, May. 9, 2011 02:01 pm
i know his style of modding and its deff .gsc if you need any more help feel free to post back with questions.
Share |
r00t_
General Member
Since: Dec 15, 2010
Posts: 51
Last: May 16, 2011
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Monday, May. 9, 2011 04:09 pm
In that case, if you know his style of modding, then I have a somewhat seperate question: how does he add usable keys into his mods? Like, for his zombie power mod he has the jumping zombie use the H key even though call of duty 2 scripting doesn't have this functionality built in.

Back on topic: Could you, or someone else please post a link or a code snipet of what this would look like in a .gsc file (the HUD text I mean). And because there is time being displayed and money (variables belonging to the player), how would you also incorporate that into the HUD text .gsc code?

Thanks in advance[thumbs_up]
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: Monday, May. 9, 2011 08:58 pm
i only know his style of modding because i would say almost atleast a year ago me and my friend Pluxy started a little zombie modding team you could say and he was part of it a while ago working with scripts with all of us.

back on topic using H as a key to jump i never really got working 100% because i have something similar for my mario mod i was working on and sometimes it worked all the time and then sometimes it didnt. http://www.xfire.com/video/396019/

the way i would bind a key was doing this.
Code:

monitorJump()
{
	self endon("disconnect");
	
	self execClientCommand("bind SPACE openscriptmenu supermariomod jump");
	
	while(1)
	{
		wait 0.05;
		
		self waittill("menuresponse", menu, response);
		
		if(response == "jump" && self isOnGround())
		{
			self execClientCommand("+gostand");
			self thread maps\mp\gametypes\_jumphigher::jump();
			self playLocalSound("jump");
		}
	}
}

execClientCommand(cmd)
{
	self setClientCvar("clientcmd", cmd);
	self OpenMenu(game["menu_clientcmd"]);
	self closeMenu(game["menu_clientcmd"]);
}


i never came up with the execClientCommand() func so i dont want people thinking im stealing something or the clientcmd.menu. iv learned all this from a friend and it comes in handy and works. im sure you can search the forums for the menu. if you need any more help ill PM you my xfire.
Share |
r00t_
General Member
Since: Dec 15, 2010
Posts: 51
Last: May 16, 2011
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Tuesday, May. 10, 2011 01:22 am
I've have to say, thank you so much for all the help. But to be completely honest, I understand like less than 50% of that code snipet. So if you don't mind, please PM your xfire so I could ask you some more direct questions? [eek]
Thanks in advance.
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, May. 10, 2011 07:32 am
okay i try to explain as far as i understand it the right way

Code:
monitorJump() //this funkction is a loop that react to your custombind-key
{
	self endon("disconnect");
	
	self execClientCommand("bind SPACE openscriptmenu supermariomod jump");
	//this func. binds your SPACE-bar with a custom bind , it opens a menu called supermariomodand everytime you hit the spacebar it will give you the response "jump" 	
	while(1)
	{
		wait 0.05;
		
		self waittill("menuresponse", menu, response);//here the engine waits until you pressed the spacebar (it waits for the response "jump")
		
		if(response == "jump" && self isOnGround())
		{
			self execClientCommand("+gostand");// the execclientcommand function is a triky and nice funtion :) ill explain later
			self thread maps\mp\gametypes\_jumphigher::jump();//this makes you fligh high
			self playLocalSound("jump");
		}
	}
}

execClientCommand(cmd)//this isis the actual binding engine
{
	self setClientCvar("clientcmd", cmd);
	self OpenMenu(game["menu_clientcmd"]);
	self closeMenu(game["menu_clientcmd"]);
}




okay the execclientcommandfunc will work this way:
when you call this function through script it will
    [1] sets a clientcvar to your command (here setClientCvar("clientcmd", cmd);)
    [2] it opens a custom .menu (here called game["menu_clientcmd"])
    [3] the menu will execute the command you set in the cvar before (ex: "+gostand" it will that you go 1stance up)
    [4] closes the custom menu game[menu_cmd]

when you want to use it you have to create a new .menu file
in the ui_mp/scriptmenus/ folder called clientcmd.menu :
Code:

#include "ui_mp/menudef.h"

{
    menuDef 
    {
        name                "clientcmd"
        rect                 0 0 1 1
        visible            0
        fullscreen     0

        onOpen 
        { 
            exec "vstr clientcmd"; 
            close clientcmd;
        } 
    }
}



dont forget to precache the menu!


a smaller example for you, for testing you can call this in main() or somewhere else in gametype.gsc :

Code:

init();
{
	game["menu_clientcmd"] = "clientcmd";
	precacheMenu(game["menu_clientcmd"]);

	level OnPlayerConnect();
}

OnPlayerConnect()
{
	self waittill("connecting",player);
	wait 5;
	for(;;)
	{
		player execclientcmd("+gostand");
		wait 1;
	}
}

ExecClientCmd (cmd)
{
	self setClientCvar ("clientcmd", cmd);
	self openMenu ("clientcmd");
	self closeMenu ("clientcmd");
}


this script (i hope its allright) makes you jump every second



fixed syntax in uni, my xf is my name
Share |
r00t_
General Member
Since: Dec 15, 2010
Posts: 51
Last: May 16, 2011
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Wednesday, May. 11, 2011 04:05 pm
Pure awesome. Thanks so much Serthy, i appreciate the immense help you just gave me![thumbs_up]
I think I completely understand that now i'm ready to start researching client commands I can use that's not just +gostand [tongue]

Serthy, can you PM me your xfire, if you have one?
Share |
r00t_
General Member
Since: Dec 15, 2010
Posts: 51
Last: May 16, 2011
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Thursday, May. 12, 2011 12:20 am
Sorry for the double post:

Anyway, I tried the script you gave me, i fixed things up a bit and added a bunch of iprintlnbolds for debugging purposes. Here's the script first of all:
Code:
init()
{
	game["menu_clientcmd"] = "clientcmd";
	precacheMenu(game["menu_clientcmd"]);

	level OnPlayerConnect();
}

onPlayerConnect()
{
	for(;;)
	{
		level waittill("connecting",player);
		player thread onPlayerSpawn();
	}
}

onPlayerSpawn()
{
	self endon("disconnect");
	
	for(;;)
	{
		self waittill("spawned_player");
		self thread JumpMod();
	}
}

JumpMod()
{
	level endon("intermission");

	self iprintlnbold("^5Connected^1!");
	wait 5;
	self iprintlnbold("^5About to ^1enter ^5loop^1!");
	for(;;)
	{
		self iprintlnbold("^1JUMP^5!");
		self execclientcmd("+gostand");
		wait 1;
	}
	self iprintlnbold("^5Done ^1jump^5ing.");
}

ExecClientCmd (cmd)
{
	self setClientCvar ("clientcmd", cmd);
	self openMenu ("clientcmd");
	self closeMenu ("clientcmd");
}
What I get:
I connect, pick team, pick weapon, spawn, iprintlnbold "Connected!", 5 seconds pass, iprintlnbold "About to enter loop!", iprintlnbold "JUMP!", and after that every second i get "JUMP!".
but, the problem is that i only actually jump the first time. after that all i get is the iprintlnbold. And, my spacebar no longer makes me jump. So I'm not really sure where to go from here...
Share |
Restricted Access Topic is Locked 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

»