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

Thread: Weapon functions (+ setMoveSpeedScale)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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. #2
    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. #3
    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. #4
    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 22:57.

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

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

  6. #5
    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 17: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. #6
    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. #7
    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 17:58.

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

    filthy_freak_ (21st May 2015)

  11. #8
    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. #9
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Sorry for bump, but im really interest in this. So for now you get damage, meleedamage, firetime and speed working?

    EDIT: You added it here: https://github.com/M-itch/libcod/com...0f04c343e27dff
    I must add all the green and red parts to my own gsc.cpp and gsc_utils.cpp and then compile it?
    Last edited by Ni3ls; 3rd September 2015 at 08:28.

  14. #10
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by Ni3ls View Post
    Sorry for bump, but im really interest in this. So for now you get damage, meleedamage, firetime and speed working?

    EDIT: You added it here: https://github.com/M-itch/libcod/com...0f04c343e27dff
    I must add all the green and red parts to my own gsc.cpp and gsc_utils.cpp and then compile it?
    or just download the modified file...
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  15. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Ni3ls (3rd September 2015)

Posting Permissions

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