UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: buttkicker845 on January 02, 2016, 03:12:16 am

Title: problems opening menu file
Post by: buttkicker845 on January 02, 2016, 03:12:16 am
im trying to open a menu file once each player is spawned that will allow them to pick specific weapons to be spawned with. but the menu file will not open.
this is what i have
Code Snippet
Plaintext
onPlayerSpawn()
{
self endon("disconnect");
self waittill( "spawned_player" );
self SetClientDvars( "cg_deadChatWithDead", "1",
"cg_deadChatWithTeam", "1",
"cg_deadHearTeamLiving", "1",
"cg_deadHearAllLiving", "1",
"compass", "0",
"hud_showStance", "1",
"cg_thirdPerson", "0",
"cg_fov", "65",
"friendlyfire_enabled", "0",
"scr_player_healthregentime" ,"99999",
"g_friendlyfireDist", "0",
"g_friendlyNameDist" , "0");
self set_weapons();
self thread onPlayerRespawn();
}
set_weapons()
{

if(!isDefined(self.spawnedOnTeam) || !self.spawnedOnTeam)
{
                self openMenuNoMouse("test_menu");//open the weapon choice menu
weapon = undefined;
startWeapon = undefined;

self takeAllWeapons();
if(!isDefined(self.team))
{
self.team = "allies";
self giveWeapon( "m1garand" );
self giveWeapon( "fraggrenade" );
startWeapon = "m1garand";
rand = randomInt(2);
if(rand == 0)
{
weapon = "bar";
}
else
{
weapon = "thompson";
}
}
else
{
if(self.team == "allies")
{
self giveWeapon( "m1garand" );
self giveWeapon( "fraggrenade" );
startWeapon = "m1garand";
rand = randomInt(2);
if(rand == 0)
{
weapon = "bar";
}
else
{
weapon = "thompson";
}
}
else
{
self giveWeapon( "kar98k" );
self giveWeapon( "stielhandgranate" );
startWeapon = "kar98k";
rand = randomInt(3);
if(rand == 0)
{
weapon = "mp40";
}
else if( rand == 1)
{
weapon = "stg44";
}
else
{
weapon = "fg42_scoped";
}
}
}
//sets the secondary weapon for the current player
self giveWeapon( weapon );
// Switches the player's weapon once he spawns in
self switchToWeapon( startWeapon );
}
self giveWeapon("m8_white_smoke");
self giveweapon("rocket_barrage");
self setactionslot(4,"weapon","rocket_barrage");
self giveMaxAmmo( "rocket_barrage" );
}
the rest of the function runs perfectly fine but the menu file never opens. and i dont get any errors about not prechaching the menu file or not including it in a fastfile
does anyone know why it not opening?
Title: Re: problems opening menu file
Post by: JBird632 on January 02, 2016, 03:19:19 am
Do you have a menu file in raw\ui\scriptmenus called test_menu.menu ?
Also do you have a csv file that contains the line:
Code Snippet
Plaintext
menufile,ui\scriptmenus\test_menu.menu
And finally do you have the file precached before _zombiemode.gsc is called using the line:
Code Snippet
Plaintext
precachemenu("test_menu");
Title: Re: problems opening menu file
Post by: buttkicker845 on January 02, 2016, 03:32:56 am
Do you have a menu file in raw\ui\scriptmenus called test_menu.menu ?
Also do you have a csv file that contains the line:
Code Snippet
Plaintext
menufile,ui\scriptmenus\test_menu.menu
And finally do you have the file precached before _zombiemode.gsc is called using the line:
Code Snippet
Plaintext
precachemenu("test_menu");
yes to all. i didnt have the menufile in my raw only in my mod folder but after adding it to my raw still nothing
Title: Re: problems opening menu file
Post by: JBird632 on January 02, 2016, 05:40:38 am
Well your script looks fine logically, but it would definitely help if you showed how and where you were calling the onPlayerSpawn() function, since I have a suspicion your player isn't actually defined.

Also make sure that your self.spawnedOnTeam really isn't defined or that you set it to false.
Title: Re: problems opening menu file
Post by: buttkicker845 on January 02, 2016, 03:23:52 pm
Code Snippet
Plaintext
main()
{
createAiBias();
maps\squad_control::squad_control_init();
level thread onPlayerConnect();
level.alliesLives = 10;
level.axisLives = 10;
}
onPlayerConnect()
{
setDvar("cheats" , "1");
while(1)
{
level waittill( "connecting", player );
player SetClientDvars( "cg_deadChatWithDead", "1",
"cg_deadChatWithTeam", "1",
"cg_deadHearTeamLiving", "1",
"cg_deadHearAllLiving", "1",
"compass", "0",
"hud_showStance", "0",
"cg_thirdPerson", "0",
"cg_fov", "65",
"friendlyfire_enabled", "0",
"scr_player_healthregentime" ,"99999",
"g_friendlyfireDist", "0",
"g_friendlyNameDist" , "0",
"monkeytoy" , "0");//final version will be 1
player thread onPlayerSpawn();

}
}
the main method is called right after maps\_load::main() and im positive that self.spawnedOnTeam either isnt defined or is false since the rest of the method runs fine. it just doesnt open the menu file