View Full Version : change the RELATIONSHIP between two CLASS

27-02-2019, 07:53 PM
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 !:p

27-02-2019, 09:07 PM
Not possible. You would need to implement your own class system, or make custom monsters.

03-03-2019, 09:40 AM
Okay..... In fact,I want to set up a new class that could attack himself for my deathmatch scripts, what should I do?

03-03-2019, 02:07 PM
With the PlayerTakeDamage hook you can override the class system for players. I think you've already done that with this script?

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:

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.

04-03-2019, 06:57 AM
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.:p

04-03-2019, 09:46 PM
There are sometimes unwanted side-effects when changing the default keyvalues (https://baso88.github.io/SC_AngelScript/docs/entvars_t.htm). 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.