Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help Make self press a key from the script
#1
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
Reply

#2
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!
Reply

#3
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 )
Reply

#4
(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 : )
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Bad syntax . Script compile error. -,- Gingaman 3 3,793 12-21-2014, 22:01
Last Post: Yamato
  Is there a way to write a script that waits for in-game text commands? ex: !kick akillj 1 2,336 11-30-2013, 14:34
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.