Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 34

Thread: Weapon functions (+ setMoveSpeedScale)

  1. #11
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Also speaking of weapon functions - how about a proper isHoldingNade(); function?

  2. #12
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  3. #13
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Quote Originally Posted by IzNoGoD View Post
    Requires editing weaponfile?

  4. #14
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Here are the addresses required to get setg_speed working on 1.0
    Code:
    //libcod.cpp
    #if COD_VERSION == COD2_1_0
    	cracking_hook_call(0x080F50AB, (int)hook_player_g_speed);
    #elif COD_VERSION == COD2_1_3
    	cracking_hook_call(0x080F7803, (int)hook_player_g_speed);
    
    //gsc_player.cpp
    #if COD_VERSION == COD2_1_0
    	calc_client_speed_t calc_client_speed = (calc_client_speed_t)0x0811FB7A;
    #else
    	calc_client_speed_t calc_client_speed = (calc_client_speed_t)0x0812200A;
    #endif
    Last edited by filthy_freak_; 20th May 2015 at 23:57.

  5. The Following 2 Users Say Thank You to filthy_freak_ For This Useful Post:

    kung foo man (21st May 2015),Mitch (21st May 2015)

  6. #15
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by filthy_freak_ View Post
    Here are the addresses required to get setg_speed working on 1.0
    I added them last night and included 1.2. I was working on changing g_gravity per player .

    https://github.com/M-itch/libcod/com...dac4ef9608efb7

    Edit: this should block melee and fire for x time (in ms).
    PHP Code:
    void gsc_player_setweaponfiremeleedelay(int id) {
        
    int delay;
        if ( ! 
    stackGetParams("i", &delay)) {
            
    printf("scriptengine> ERROR: gsc_player_setweaponfiremeleedelay(): param \"delay\"[1] has to be an int!\n");
            
    stackPushUndefined();
            return;
        }

        if(
    delay 0) {
            
    printf("scriptengine> ERROR: gsc_player_setweaponfiremeleedelay(): param \"delay\"[1] must be equal or above zero!\n");
            
    stackPushUndefined();
            return;
        }

        
    intweapondelay = (int *)(PLAYERSTATE(id) + 0x34);
        *
    weapondelay delay;

    Last edited by Mitch; 21st May 2015 at 18:37. Reason: code was missing 'void'

  7. The Following User Says Thank You to Mitch For This Useful Post:

    filthy_freak_ (21st May 2015)

  8. #16
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Quote Originally Posted by Mitch View Post
    Edit: this should block melee and fire for x time (in ms).
    Doesn't work for me after adding above code to gsc_player.cpp & adding command to gsc.cpp.

    self setweaponfiremeleedelay(delayinms); doesn't seem to have an effect.

  9. #17
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by filthy_freak_ View Post
    Doesn't work for me after adding above code to gsc_player.cpp & adding command to gsc.cpp.

    self setweaponfiremeleedelay(delayinms); doesn't seem to have an effect.
    It does work for me, but you first need to bash once and then melee is blocked. But I should be able to fix that.

    PHP Code:
    while(isAlive(self))
    {
        
    self setweaponfiremeleedelay(1000); // keep forcing 1s delay

        
    if(self MeleeButtonPressed() && self UseButtonPressed())
        {
            break;
        }

        
    wait(0.05);

    Last edited by Mitch; 21st May 2015 at 18:58.

  10. The Following User Says Thank You to Mitch For This Useful Post:

    filthy_freak_ (21st May 2015)

  11. #18
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Quote Originally Posted by Mitch View Post
    It does work for me, but you first need to bash once and then melee is blocked. But I should be able to fix that.

    PHP Code:
    while(isAlive(self))
    {
        
    self setweaponfiremeleedelay(1000); // keep forcing 1s delay

        
    if(self MeleeButtonPressed() && self UseButtonPressed())
        {
            break;
        }

        
    wait(0.05);

    Yep it was an error on my side not forcing the delay. Works fine except for the first bash like you described.

  12. The Following User Says Thank You to filthy_freak_ For This Useful Post:

    Mitch (21st May 2015)

  13. #19
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    Quote Originally Posted by filthy_freak_ View Post
    Yep it was an error on my side not forcing the delay. Works fine except for the first bash like you described.
    I fixed the first bash problem. In addition to blocking firing, it also blocks aiming and reloading your weapon and it delays switching your weapon.

    https://github.com/M-itch/libcod/com...a4f6d86ac2ce74

  14. #20
    Private First Class
    Join Date
    Oct 2013
    Posts
    219
    Thanks
    56
    Thanked 105 Times in 66 Posts
    Quote Originally Posted by Mitch View Post
    I fixed the first bash problem. In addition to blocking firing, it also blocks aiming and reloading your weapon and it delays switching your weapon.

    https://github.com/M-itch/libcod/com...a4f6d86ac2ce74
    Nice, previous bug is resolved. Found another though - if setweaponfiremeleedelay gets called on you while you are doing a weapon animation (Shooting, bashing) it will repeat the animation.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •