ItsMods

Full Version: Make self press a key from the script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, sorry for my second post in this section in the last few days, I'm not trying to spam i swear. Big Grin

I want to make a player press the +forward key when the waittill is completed. for example:

Code:
example()
{
    self notifyOnplayerCommand( "example", "+example" );
    self waittill("example");

        +forward; ???????

}

could anyone tell me how i could make this code work? Blush
Not possible in Mw2 afaik, at least not through gsc scripting. There's a slight chance it might work through .menu scripting if you're using a copy of what 4d1 was until it shut down.

However, best you can do is to is use a workaround in this case. Use the moveto thingy you asked about in your last thread, but get the anglestoforward for the origin. Look up @Yamato 's tutorials about bullettrace!
No, you cant do that in MW2, to move forward I think you could use something similar to what I used in my AI zombies code to detect walls and ground. You might modify a bit those numbers I put in bold for a better functioning, try them as they are and if it doesnt work well change them a bit.

Code:
        forwardangles = self.origin + ( 0, 0, 25 ) + anglestoforward( self.angles ) * 25;
        frontal = bullettrace( self.origin + (0 , 0, 50 ), forwardangles, false, self );
        final = bullettrace( forwardangles, forwardangles - ( 0, 0, 200 ), false, self);
        if ( frontal["fraction"] == 1 && frontal["surfacetype"] == "default" )
            self SetOrigin( final["position"] );

EDIT: bold didnt work, I mean the last numbers in those ( 0, 0, X )
(07-06-2014, 14:04)Yamato Wrote: [ -> ]No, you cant do that in MW2, to move forward I think you could use something similar to what I used in my AI zombies code to detect walls and ground. You might modify a bit those numbers I put in bold for a better functioning, try them as they are and if it doesnt work well change them a bit.

Code:
        forwardangles = self.origin + ( 0, 0, 25 ) + anglestoforward( self.angles ) * 25;
        frontal = bullettrace( self.origin + (0 , 0, 50 ), forwardangles, false, self );
        final = bullettrace( forwardangles, forwardangles - ( 0, 0, 200 ), false, self);
        if ( frontal["fraction"] == 1 && frontal["surfacetype"] == "default" )
            self SetOrigin( final["position"] );

EDIT: bold didnt work, I mean the last numbers in those ( 0, 0, X )

Thanks for the help man : )