there is no specific command for getting the users button in MP, so i would guess menu files would be the right way. I just dont know where to start, what command can i use? and what are the basics for making a menu file to work with your gsc?
any help much appreciated
finding any button the player pressed
Moderator: Core Staff
-
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Re: finding any button the player pressed
EDIT: To start with a side-note, I think that you can only add menu-files into a mod, not into a custom map (somebody please correct me If I'm wrong on this) since they have to be compiled into the mod. And in your case you're making a custom map I believe. Either way I'll try and do an explanation.
Okay, so whilst I'm not sure if this is the actual correct way to monitor a key press, this is my theoretical method of how it will work. (You should be able to find some menu files in ui_mp/scriptmenus in the mod tools to see the example layout and such).
Basically you create a menu that is not visible, and doesn't stop any of the player's inputs (mouse/movement etc). So for the player, even though this menu is open, their game still looks and plays exactly the same. However in the `invisible menu` there is an option for pressing mouse1, and hence when they attack (by pressing mouse1) it will trigger this menu option. See the code below.
This is an example of something I had in a previous mod (for Black Ops, note - so everything may not be the same for CoD4). You would want to have execKey "mouse1" and then scriptMenuRespone "define_this_in_your_script". And then depending on the situation, if you still want to monitor them pressing the attack key you wouldn't close the menu, if you don't need to after, then you can close the menu as seen above.
Depending on when you want to monitor the key press, you place a line similar to this somewhere in your script.
And finally, once the key press has been monitored, you make the player do whatever you want like so:
Hopefully this kind of explains some stuff to you. Note that if the person didn't use mouse1 as their way of attacking it would not work (but I assume nearly everybody uses mouse1), so just keep this in mind.
Okay, so whilst I'm not sure if this is the actual correct way to monitor a key press, this is my theoretical method of how it will work. (You should be able to find some menu files in ui_mp/scriptmenus in the mod tools to see the example layout and such).
Basically you create a menu that is not visible, and doesn't stop any of the player's inputs (mouse/movement etc). So for the player, even though this menu is open, their game still looks and plays exactly the same. However in the `invisible menu` there is an option for pressing mouse1, and hence when they attack (by pressing mouse1) it will trigger this menu option. See the code below.
Code: Select all
itemDef
{
name "window"
group ingamebox
type ITEM_TYPE_TEXT
visible 1
rect 16 20 0 0
origin ORIGIN_QUICKMESSAGEWINDOW
forecolor 1 1 1 1
textfont UI_FONT_NORMAL
textscale .24
textaligny 8
text "^21. Drop a Mine"
decoration
}
execKey "1" { scriptMenuResponse "special1"; close hunters_mod_menu; }
Depending on when you want to monitor the key press, you place a line similar to this somewhere in your script.
Code: Select all
game[ "huntersmenu" ] = "hunters_mod_menu"; // these two lines at beginning of gsc
precacheMenu( game[ "huntersmenu" ] );
...
self openMenu( game["huntersmenu"] ); // this line wherever you want, eg. onPlayerSpawned if you want to monitor the key press as soon as a player spawns.
Code: Select all
onMenuResponse()
{
self endon( "death" );
self endon( "disconnect" );
while( true )
{
self waittill( "menuresponse", menu, response );
if( response == "special1" )
{
if(self.team == "axis")
self thread scare();
else
self thread dropmine();
}
}
}
-
Re: finding any button the player pressed
so there is no way to make a menu file without using a mod?
-
- CJ G0D!
- Posts: 1575
- Joined: June 3rd, 2009, 9:02 pm
- Location: Cardiff University, UK
Re: finding any button the player pressed
I honestly cannot say because I don't know - when I used menu files in my mod I had to reference the menu file in the csv file and then compile it into the mod.ff.
Do maps have a csv file they reference from? If so, and if you can compile a menu file into the map.ff, then I guess it would be possible, you'll have to investigate yourself.
Do maps have a csv file they reference from? If so, and if you can compile a menu file into the map.ff, then I guess it would be possible, you'll have to investigate yourself.
-
-
- CJ Wannabe
- Posts: 8
- Joined: April 23rd, 2013, 7:14 am
Re: finding any button the player pressed
Yes you can add menu files to a map.
After you have created the file save it in "\Call of Duty 4 - Modern Warfare\raw\ui_mp\scriptmenus" then add this to your csv:
After you have created the file save it in "\Call of Duty 4 - Modern Warfare\raw\ui_mp\scriptmenus" then add this to your csv:
Code: Select all
menufile,ui_mp/scriptmenus/menuname.menu
Who is online
Users browsing this forum: No registered users and 33 guests