Thread: change the RELATIONSHIP between two CLASS

Results 1 to 6 of 6
  1. #1
    Registered User Dr.Abc's Avatar
    Join Date
    Sep 2018
    Posts
    5

    change the RELATIONSHIP between two CLASS

    Hello everyone!
    Is there a way to change the RELATIONSHIP between two CLASS?
    For example, I wanna set CLASS_NONE and CLASS_MACHINE to be hostile (RL_NM).
    How can i do that ?
    thanks !


  2. #2
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,599

    Re: change the RELATIONSHIP between two CLASS

    Not possible. You would need to implement your own class system, or make custom monsters.
    Love,
    w00tguy

  3. #3
    Registered User Dr.Abc's Avatar
    Join Date
    Sep 2018
    Posts
    5

    Re: change the RELATIONSHIP between two CLASS

    Okay..... In fact,I want to set up a new class that could attack himself for my deathmatch scripts, what should I do?


  4. #4
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,599

    Re: change the RELATIONSHIP between two CLASS

    With the PlayerTakeDamage hook you can override the class system for players. I think you've already done that with this script?
    https://forums.svencoop.com/showthre...gin-PVP-Enable

    To create a new class/team for that script, you can set a custom keyvalue on the player and then write your own isAlly() function.

    I'm pretty sure I don't understand your question, but if you wanted 3 teams where 1 class could attack itself:
    1) TEAM_A (can't attack themselves)
    2) TEAM_B (can't attack themselves)
    3) TEAM_C (can attack themselves)

    Then you could check ally status with:
    Code:
    bool isAlly(int attackerClass, int victimClass) {
        return attackerClass != victimClass or (attackerClass == TEAM_C and attackerClass == victimClass);
    }
    Then call that in the PlayerTakeDamage hook before applying damage.
    Last edited by w00tguy123; 03-03-2019 at 02:40 PM.
    Love,
    w00tguy

  5. #5
    Registered User Dr.Abc's Avatar
    Join Date
    Sep 2018
    Posts
    5

    Re: change the RELATIONSHIP between two CLASS

    Much Thx!
    Sorry about my poor English, i am not a native speaker...much apologize for my vague language.
    i did want 3 teams where 1 class could attack itself, and thanks for your answer.
    In fact, i had trid this method wtih changing player.pev.team and checked it before applying damage. however, i found that if i do so, every weapon could not do any damage except bullet weapons, and the HUD shown that everyone is ally.
    Thanks!


  6. #6
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,599

    Re: change the RELATIONSHIP between two CLASS

    There are sometimes unwanted side-effects when changing the default keyvalues. I used to think pev.iuser1 was unused, but setting to 1 makes third-person weapon models invisible! It's safer to use custom keyvalues for stuff like this.
    Love,
    w00tguy

Posting Permissions

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