
 |
| Author |
Topic: Trigger Help!!! |
| hyper1234 |
General Member Since: Mar 17, 2009 Posts: 129 Last: Mar 17, 2010 [view latest posts] |
|
|
|
|
| DemonSeed |
General Member Since: Apr 30, 2009 Posts: 969 Last: Mar 19, 2010 [view latest posts] |
|
|
 |
|
|
| hyper1234 |
General Member Since: Mar 17, 2009 Posts: 129 Last: Mar 17, 2010 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Sunday, Jul. 5, 2009 05:13 pm |
 |
Thanks a lot mate. It worked but there was a problem. See...ive got this shop script, and what i want to happen is, u press the trigger and it opens up a custom menu, within that menu it has the gun and the amount mof money/points needed to purchase it. I can make the menu, i can exec the commands etc. thats easy stuff. But, lets say i made a menu called flicker.menu ok. In my map, what folder would i have to create, is it like modding, ui_mp and the scriptmenus and then put it there? or is it something else. When ive got it placed in the right folder lets say what i just said, would this be the command.
Quote: init()
{
trigger = getEnt( "triggername", "targetname" );
trigger thread trigger_think();
}
trigger_think()
{
for( ;; )
{
self waittill( "trigger", player );
if( isPlayer( player ) )
{
while( isAlive( player ) && player isTouching( self ) )
{
if( player.pers["team"] == "allies" )
player openMenu( game["flicker_menu"] );
else if( player.pers["team"] == "axis" )
player openMenu( game["flicker_menu"] );
}
wait 0.05;
}
}
}
Please message back asap please. Thanks for the help.
ONE more thing...when i pressed it, i got a huge lag for like 3 seconds, then the menu opened, i chose the american weapon and then i respawned with it, i went back t press the button again and it wouldnt open the menu.
Hopefully you could help me with all of this, appreciate it if you can only help me alittle. Thanks again |
 |
|
|
| clanhelio |
General Member Since: Aug 30, 2008 Posts: 113 Last: Feb 28, 2010 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Sunday, Jul. 5, 2009 06:10 pm |
 |
Code: while( isAlive( player ) && player isTouching( self ) )
{
if( player.pers["team"] == "allies" )
player openMenu( game["flicker_menu"] );
else if( player.pers["team"] == "axis" )
player openMenu( game["flicker_menu"] );
}
Why are you telling it to open the menu while you're alive and touching the trigger? It's going to repeatedly tell the game for you to open the flicker menu over and over and over. |
 |
|
|
| hyper1234 |
General Member Since: Mar 17, 2009 Posts: 129 Last: Mar 17, 2010 [view latest posts] |
|
|
|
|
| clanhelio |
General Member Since: Aug 30, 2008 Posts: 113 Last: Feb 28, 2010 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Monday, Jul. 6, 2009 04:00 pm |
 |
Um, this should do the trick ,you press the button and a menu opens. Not sure what the checking if the player was alive and touching the trigger was about, but I took that out.
Code: init()
{
trigger = getEnt( "triggername", "targetname" );
trigger thread trigger_think();
}
trigger_think()
{
for( ;; )
{
self waittill( "trigger", player );
if( player.pers["team"] == "allies" )
player openMenu( game["menu_weapon_allies"] );
else if( player.pers["team"] == "axis" )
player openMenu( game["menu_weapon_axis"] );
}
}
edited on Jul. 6, 2009 04:01 pm by clanhelio |
 |
|
|
| hyper1234 |
General Member Since: Mar 17, 2009 Posts: 129 Last: Mar 17, 2010 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Tuesday, Jul. 7, 2009 03:19 am |
 |
thanks for the reply but,like ive said, i want to add a custom menu so, what is the command i would hsave to do...this?
Code: init()
{
trigger = getEnt( "triggername", "targetname" );
trigger thread trigger_think();
}
trigger_think()
{
for( ;; )
{
self waittill( "trigger", player );
if( player.pers["team"] == "allies" )
player openMenu( game["flicker"] );
else if( player.pers["team"] == "axis" )
player openMenu( game["flicker"] );
}
}
If this is correct, where do i put the menu script in my iwd file so that the command executes the correct menu?
Thanks again ![[thumbs_up]](images/BBCode/smilies/thumbs_up.gif) |
 |
|
|
| clanhelio |
General Member Since: Aug 30, 2008 Posts: 113 Last: Feb 28, 2010 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Tuesday, Jul. 7, 2009 02:54 pm |
 |
This should work, but I don't understand your second question...
The .menu files? ui_mp/scriptmenus/
Code: init()
{
game["flicker_menu"] = "flicker";
precacheMenu(game["flicker_menu"]);
trigger = getEnt( "triggername", "targetname" );
trigger thread trigger_think();
}
trigger_think()
{
for( ;; )
{
self waittill( "trigger", player );
player openMenu( game["flicker_menu"] );
}
}
edited on Jul. 7, 2009 02:55 pm by clanhelio |
 |
|
|
| hyper1234 |
General Member Since: Mar 17, 2009 Posts: 129 Last: Mar 17, 2010 [view latest posts] |
|
|
|
|
| clanhelio |
General Member Since: Aug 30, 2008 Posts: 113 Last: Feb 28, 2010 [view latest posts] |
|
|
|
|
|
|
|