Author |
Topic: Going prone in water? |
paulb39 |
General Member Since: Jan 3, 2006 Posts: 492 Last: Oct 16, 2011 [view latest posts] |
|
|
|
Mystic |
|
General Member Since: Apr 10, 2004 Posts: 6147 Last: Apr 15, 2018 [view latest posts] |
|
|
|
|
Category: CoD4 MP Mapping Posted: Wednesday, Sep. 15, 2010 12:06 am |
|
I think CoD4 has a function allowProne();
So you could set up a trigger in the area you want (under the water) and then grab it via a script, maybe something like;
Code: player_noprone()
{
pronetrig=getent("prone_trigger","targetname");
for( ;; )
{
pronetrig waittill ("trigger", player);
if( isPlayer( player ) && player isTouching( pronetrig ) && isAlive( player ))
{
level.player allowProne(false);
}
Been a while since i done anything on cod so i havn't tested this but it should get you going. |
|
|
|
Tristan4592 |
General Member Since: Apr 26, 2007 Posts: 235 Last: Nov 11, 2010 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Wednesday, Sep. 15, 2010 12:07 am |
|
using this: Code: level.player AllowProne( false );
and a trigger, make a simple script which calls the above statement whenever the player is touching the trigger, and when they're not touching it, set it back to true so they can go prone again.
I'll make a simple test map and see if I can't get this working myself, as scripting theory is rarely the same as reality.
If I can get it to work, I'll post my full script.
|
|
|
|
Mystic |
|
General Member Since: Apr 10, 2004 Posts: 6147 Last: Apr 15, 2018 [view latest posts] |
|
|
|
|
Category: CoD4 MP Mapping Posted: Wednesday, Sep. 15, 2010 12:14 am |
|
Actually, now i think about it that will only work for single player, you may be able to do it by setting a dvar..
Code:
#include maps\mp\_utility;
main()
{
game["menu_client"] = "nopronecmd";
thread playerProne();
}
playerProne()
{
trig = getEnt( "prone", "targetname" );
while(1)
{
trig waittill( "trigger", player );
if( isPlayer( player ) && player isTouching( trig ) && isAlive( player ) )
{
if( player GetStance() != "prone" )
{
player execClientCommand( "+prone" );
}
}
}
}
ExecClientCommand( cmd )
{
self setClientDvar( "nopronecmd", cmd );
self OpenMenu( game["menu_client"] );
self closeMenu( game["menu_client"] );
}
You will also need a new new menu called 'nopronecmd'
Code:
#include "ui/menudef.h"
{
menuDef
{
name "nopronecmd"
rect 0 0 1 1
visible 0
fullscreen 0
onOpen
{
exec "vstr nopronecmd";
close nopronecmd;
}
}
}
edited on Sep. 14, 2010 08:15 pm by Rasta |
|
|
|
paulb39 |
General Member Since: Jan 3, 2006 Posts: 492 Last: Oct 16, 2011 [view latest posts] |
|
|
Category: CoD4 MP Mapping Posted: Wednesday, Sep. 15, 2010 02:30 am |
|
Rasta writes...Quote: Actually, now i think about it that will only work for single player, you may be able to do it by setting a dvar..
Code:
#include maps\mp\_utility;
main()
{
game["menu_client"] = "nopronecmd";
thread playerProne();
}
playerProne()
{
trig = getEnt( "prone", "targetname" );
while(1)
{
trig waittill( "trigger", player );
if( isPlayer( player ) && player isTouching( trig ) && isAlive( player ) )
{
if( player GetStance() != "prone" )
{
player execClientCommand( "+prone" );
}
}
}
}
ExecClientCommand( cmd )
{
self setClientDvar( "nopronecmd", cmd );
self OpenMenu( game["menu_client"] );
self closeMenu( game["menu_client"] );
}
You will also need a new new menu called 'nopronecmd'
Code:
#include "ui/menudef.h"
{
menuDef
{
name "nopronecmd"
rect 0 0 1 1
visible 0
fullscreen 0
onOpen
{
exec "vstr nopronecmd";
close nopronecmd;
}
}
}
edited on Sep. 14, 2010 08:15 pm by Rasta
Thanks, tho could you walk me through it? I'm horrible with scripts. I'm guessing the first bit of code goes in its own gsc, tho how do I call it from the main gsc? I make the trigger targetname prone, right? I have no idea how to make a new menu (where does it go? And what extension does it have .menu?), and how do I call the script in the zone file? |
|
|
|
paulb39 |
General Member Since: Jan 3, 2006 Posts: 492 Last: Oct 16, 2011 [view latest posts] |
|
|
Category: CoD4 MP Mapping Posted: Friday, Sep. 17, 2010 12:05 am |
|
Script compile error
http://i22.photobucket.com/albums/b329/paulb39/shot00000.jpg
Zone File
include,mptypes_desert
include,mptypes_woodland
rawfile,maps/mp/_noprone.gsc
xmodel,com_barrel_piece
xmodel,com_barrel_piece2
fx,props/barrel_ignite
fx,props/barrel_fire_top
rawfile,ui/nopronecmd.menu
Any ideas? |
|
|
|
paulb39 |
General Member Since: Jan 3, 2006 Posts: 492 Last: Oct 16, 2011 [view latest posts] |
|
|
|
Mystic |
|
General Member Since: Apr 10, 2004 Posts: 6147 Last: Apr 15, 2018 [view latest posts] |
|
|
|
|
|
paulb39 |
General Member Since: Jan 3, 2006 Posts: 492 Last: Oct 16, 2011 [view latest posts] |
|
|
|
_INSANE_ |
|
General Member Since: Nov 7, 2008 Posts: 352 Last: Jul 10, 2011 [view latest posts] |
|
|
|
|