steven4547466 / AdvancedSubclassing

Adds very advanced subclassing to SCP: SL
Other
5 stars 6 forks source link

Spawn effects are kept between role #20

Closed coco9515 closed 4 years ago

coco9515 commented 4 years ago

Describe the bug Spawn effects are kept between roles.

To Reproduce Steps to reproduce the behavior:

  1. Create a classe with effects easily identifiable (like the half stamina one)
  2. Spawn as this class, see the effects works as intended
  3. Spawn as another role (not necessarily a class), and see the effect affecting you NOT as intended

Expected behavior Not having spawn effects transfered.

Screenshots N/A

Config File

# Name of the Class
name: NTF UTR

# Which roles can have this class
affects_roles:
- NtfCadet

string_options:
  # The message the user sees when they get the class.
  GotClassMessage: Tu es un <color=cyan>UTR</color>, tu doit obéir à tes supérieurs et suivre à la lettre le réglement de la fondation !
  # The message players see when they attempt to use an ability that's on cooldown.
  AbilityCooldownMessage: Ta capacité {ability} est en rechargement pour {seconds} secondes !
  # A badge for the player.
  Badge: UTR
  # The color of the badge.
  BadgeColor: cyan
  # A message that will be announced by CASSIE when this subclass spawns.
  CassieMessage: 
  # The message people see when they run out of ability uses for any ability.
  OutOfAbilityUses: Tu n'as plus la capacité d'utiliser {ability} !

boolean_options:
  # Enables the class.
  Enabled: true
  # Disregards the value beneath it and uses the server default for friendly fire.
  DisregardHasFF: true
  # Enables friendly fire for this subclass, useful for traitorous subclasses, when a player with this option shoots a person on their team, everyone may shoot them regardless of DisregardTakesFF and TakesFriendlyFire.
  HasFriendlyFire: true
  # Disregards the value beneath it and uses the server default for friendly fire.
  DisregardTakesFF: true
  # Whether players on the same team of this subclass may shoot the player and may not be shot back.
  TakesFriendlyFire: true
  # If set to true, the subclass can only be given to a spawn wave. Defaults to false.
  OnlyAffectsSpawnWave: false
  # If set to true, the subclass can be given to both individuals and spawn waves. Defaults to false.
  AffectsSpawnWave : false
  # If set to false, the subclass will not be given to players after escaping. Defaults to true.
  GivenOnEscape : false

integer_options:
  # Max health of the class.
  MaxHealth: 500
  # The health the class spawns with.
  HealthOnSpawn: 500
  # Armor is a value that decreases over the course of the game, unless given the ability that stops it from doing so.
  # The max amount of armor the class has.
  MaxArmor: -1
  # The armor the class has on spawn.
  ArmorOnSpawn: -1
  # The max number of people that can have this class at any given moment - disregarding spawn waves.
  MaxAlive : 1
  # The max number of times this class can spawn during a period of time.
  MaxPerSpawnWave: 1
  # The max number of times this class can spawn per round. If this class is affecting a spawn wave, it is counted as 1. Defaults to an no max.
  MaxSpawnPerRound : 2
  # Any integer values from abilities go here as the <Ability>MaxUses

float_options:
  # The chance to get this class, not calculated with other classes for the same role.
  ChanceToGet: 100
  # The player's model scale across the selected axis.
  ScaleX : 1.1
  ScaleY : 1.1
  ScaleZ : 1.1
  # The player's spawn offset relative to the selected axis.
  SpawnOffsetX : 0
  SpawnOffsetY : 0
  SpawnOffsetZ : 0
  # The damage multiplier this player has. A value of 2 will double their damage.
  OnHitDamageMultiplier : 1
  OnSpawnDisabledChance: 100
  OnSpawnExhaustedChance: 100
  OnSpawnHemorrhageChance: 100
  OnSpawnPanicChance: 100

# You may have a list of RoomTypes where this class is teleported to at the start of the round. Use Unknown for the default spawn location.
spawn_locations:
- Unknown

# "None" instead of any object means nothing would be added, but it still clears the player's inventory.
# It may be empty, if that's the case the value is "spawn_items: {}" then it would spawn with the default items from the role.
spawn_items:
  0:
    KeycardNTFLieutenant: 100
  1:
    GunE11SR: 100
  2:
    Radio: 100
  3:
    Flashlight: 100
  4:
    GunUSP: 100
  5:
    GrenadeFrag: 20

# You can edit the default values of how must ammo a player has. Use -1 for default.
spawn_ammo:
  Nato556: 320
  Nato762: 200
  Nato9: 400

# Not all abilities are good, but they all add new things to the game.
# It may be empty, if that's the case, the value should be "abilities: []".
abilities:
- BypassTeslaGates
- Disable096Trigger
- CantBeSacraficed
- CantHeal

# You can set custom cooldowns for abilities that have cooldowns.
# This list should contain all abilites that could have cooldowns that the class has, even if you set them to 0.
# It may be empty, if that's the case, the value should be "ability_cooldowns: {}".
ability_cooldowns:
  BypassTeslaGates: 0

# With this list, you can give a subclass a list of other subclasses they can friendly fire upon.
# This value is a list of strings (which are other subclass names). It may be empty, if that's the case, the value should be "advanced_ff_rules: []".
advanced_ff_rules: []

# This is a list of roles that are unable to damage the subclass regardless of team.
# If you want it to be empty, you can use "roles_that_cant_damage: []".
roles_that_cant_damage:
- Scp106
- Scp049

# This is the Team that players with this class can end the game with. "RIP" means the default team.
ends_round_with: RIP

# This adds the ability to give players with certain subclasses the ability to inflict any effects upon damage a player.
# If there is anything in the list, you have to add those to the float_options : "OnHit<EFFECT_NAME>Chance" which is the chance for the effect to be applied.
# And there's "OnHit<EFFECT_NAME>Duration" this is optional and is the duration of the effect.
on_hit_effects: []

# This adds the ability to give players with certain subclasses any effects on spawn.
# If there is anything in the list, you have to add those to the float_options : "OnSpawn<EFFECT_NAME>Chance" which is the chance for the effect to be applied.
# And there's "OnSpawn<EFFECT_NAME>Duration" this is optional and is the duration of the effect.
on_spawn_effects:
- Disabled 
- Exhausted
- Hemorrhage
- Panic

# This adds the ability to give players with certain subclasses any effects when they are damaged based on the damage type.
# If there is anything in the list, you have to add those to the float_options : "OnDamaged<EFFECT_NAME>Chance" which is the chance for the effect to be applied.
# And there's "OnDamaged<EFFECT_NAME>Duration" this is optional and is the duration of the effect.
#on_damaged_effects:

# It defines what role the class will spawn as. "None" is the default meaning they spawn as the role they were going to.
spawns_as: NtfLieutenant

# These define what role the class becomes upon escaping. There are options for cuffed and not cuffed.
# If this is set to "None", or is not provided, it will use the default. This does not work on classes that cannot escape.
escapes_as:
  cuffed: None
  not_cuffed: None

Console Logs No spawn effect are on the class and the console agree but I still have those effects.

> [09:54:27] [DEBUG] [Subclass-1.2.0-pre004] Evaluating possible subclasses for player with name Wiirlak
> [09:54:27] [DEBUG] [Subclass-1.2.0-pre004] Evaluating possible subclass NTF Blind? for player with name Wiirlak. Number generated: 6.21469691685154, must be less than 10 to get class
> [09:54:27] [DEBUG] [Subclass-1.2.0-pre004] Wiirlak attempting to be given subclass NTF Blind?
> [09:54:27] [DEBUG] [Subclass-1.2.0-pre004] Subclass NTF Blind? has no on spawn effects
> [09:54:27] [DEBUG] [Subclass-1.2.0-pre004] Checking round end
> [09:54:27] [DEBUG] [Subclass-1.2.0-pre004] Number of unique teams alive: 1. Contains ALL? False
> [09:54:27] [DEBUG] [Subclass-1.2.0-pre004] Number of unique teams alive: 1. Contains ALL? False
> [09:54:27] [DEBUG] [Subclass-1.2.0-pre004] Player with name Wiirlak got subclass NTF Blind?
> [09:54:27] [DEBUG] [Subclass-1.2.0-pre004] Checking round end

Versioning

Additional context N/A

steven4547466 commented 4 years ago

I cannot reproduce this issue. Stamina not resetting is a base game issue, but since it regenerates after you spawn you can tell the effect is not actually there.

Check out this video to see what I mean. After I switch classes, the vignetting (the red circle around my vision) dissipates, and my stamina begins to regenerate. Stamina not resetting is not an issue with the plugin, but on that comes from the base game. If you can capture footage of the functionality you described, I'll look into it, but it seems to be working as intended.

coco9515 commented 4 years ago

I know that bug in SL. But after watching the video and doing another class, I think I realise that the bug only happen if you stay in the same role.

I used this class :

# Name of the Class
name: Classe D Aveugle

# Which roles can have this class
affects_roles:
- ClassD

string_options:
  # The message the user sees when they get the class.
  GotClassMessage: Tu es une classe malvoyante.
  # The message players see when they attempt to use an ability that's on cooldown.
  AbilityCooldownMessage: Ta capacité {ability} est en rechargement pour {seconds} secondes !
  # A badge for the player.
  Badge: 
  # The color of the badge.
  BadgeColor: 
  # A message that will be announced by CASSIE when this subclass spawns.
  CassieMessage: 
  # The message people see when they run out of ability uses for any ability.
  OutOfAbilityUses: Tu n'as plus la capacité d'utiliser {ability} !

boolean_options:
  # Enables the class.
  Enabled: true
  # Disregards the value beneath it and uses the server default for friendly fire.
  DisregardHasFF: true
  # Enables friendly fire for this subclass, useful for traitorous subclasses, when a player with this option shoots a person on their team, everyone may shoot them regardless of DisregardTakesFF and TakesFriendlyFire.
  HasFriendlyFire: true
  # Disregards the value beneath it and uses the server default for friendly fire.
  DisregardTakesFF: true
  # Whether players on the same team of this subclass may shoot the player and may not be shot back.
  TakesFriendlyFire: true
  # If set to true, the subclass can only be given to a spawn wave. Defaults to false.
  OnlyAffectsSpawnWave: false
  # If set to true, the subclass can be given to both individuals and spawn waves. Defaults to false.
  AffectsSpawnWave : false
  # If set to false, the subclass will not be given to players after escaping. Defaults to true.
  GivenOnEscape : false

integer_options:
  # Max health of the class.
  MaxHealth: 100
  # The health the class spawns with.
  HealthOnSpawn: 100
  # Armor is a value that decreases over the course of the game, unless given the ability that stops it from doing so.
  # The max amount of armor the class has.
  MaxArmor: -1
  # The armor the class has on spawn.
  ArmorOnSpawn: -1
  # The max number of people that can have this class at any given moment - disregarding spawn waves.
  MaxAlive : 1
  # The max number of times this class can spawn per round. If this class is affecting a spawn wave, it is counted as 1. Defaults to an no max.
  MaxSpawnPerRound : 1
  # Any integer values from abilities go here as the <Ability>MaxUses

float_options:
  # The chance to get this class, not calculated with other classes for the same role.
  ChanceToGet: 3
  # The player's model scale across the selected axis.
  #ScaleX : 1
  #ScaleY : 1
  #ScaleZ : 1
  # The player's spawn offset relative to the selected axis.
  SpawnOffsetX : 0
  SpawnOffsetY : 0
  SpawnOffsetZ : 0
  # The damage multiplier this player has. A value of 2 will double their damage.
  OnHitDamageMultiplier : 1
  # Any float values from abilities go here
  OnSpawnBlindedChance: 100

# You may have a list of RoomTypes where this class is teleported to at the start of the round. Use Unknown for the default spawn location.
spawn_locations:
- Unknown

# "None" instead of any object means nothing would be added, but it still clears the player's inventory.
# It may be empty, if that's the case the value is "spawn_items: {}" then it would spawn with the default items from the role.
spawn_items:
  0:
    Coin: 40
  1:
    Painkillers: 10

# You can edit the default values of how must ammo a player has. Use -1 for default.
spawn_ammo:
  Nato556: -1
  Nato762: -1
  Nato9: -1

# Not all abilities are good, but they all add new things to the game.
# It may be empty, if that's the case, the value should be "abilities: []".
abilities: []

# You can set custom cooldowns for abilities that have cooldowns.
# This list should contain all abilites that could have cooldowns that the class has, even if you set them to 0.
# It may be empty, if that's the case, the value should be "ability_cooldowns: {}".
ability_cooldowns: {}

# With this list, you can give a subclass a list of other subclasses they can friendly fire upon.
# This value is a list of strings (which are other subclass names). It may be empty, if that's the case, the value should be "advanced_ff_rules: []".
advanced_ff_rules: []

# This is a list of roles that are unable to damage the subclass regardless of team.
# If you want it to be empty, you can use "roles_that_cant_damage: []".
roles_that_cant_damage: []

# This is the Team that players with this class can end the game with. "RIP" means the default team.
ends_round_with: RIP

# This adds the ability to give players with certain subclasses the ability to inflict any effects upon damage a player.
# If there is anything in the list, you have to add those to the float_options : "OnHit<EFFECT_NAME>Chance" which is the chance for the effect to be applied.
# And there's "OnHit<EFFECT_NAME>Duration" this is optional and is the duration of the effect.
on_hit_effects: []

# This adds the ability to give players with certain subclasses any effects on spawn.
# If there is anything in the list, you have to add those to the float_options : "OnSpawn<EFFECT_NAME>Chance" which is the chance for the effect to be applied.
# And there's "OnSpawn<EFFECT_NAME>Duration" this is optional and is the duration of the effect.
on_spawn_effects:
- Blinded

# This adds the ability to give players with certain subclasses any effects when they are damaged based on the damage type.
# If there is anything in the list, you have to add those to the float_options : "OnDamaged<EFFECT_NAME>Chance" which is the chance for the effect to be applied.
# And there's "OnDamaged<EFFECT_NAME>Duration" this is optional and is the duration of the effect.
#on_damaged_effects:

# It defines what role the class will spawn as. "None" is the default meaning they spawn as the role they were going to.
spawns_as: None

# These define what role the class becomes upon escaping. There are options for cuffed and not cuffed.
# If this is set to "None", or is not provided, it will use the default. This does not work on classes that cannot escape.
escapes_as:
  cuffed: NtfCadet
  not_cuffed: ChaosInsurgency

With the blinded effect, and changed to another class and got both effects :

# Name of the Class
name: Classe D Obèse

# Which roles can have this class
affects_roles:
- ClassD

string_options:
  # The message the user sees when they get the class.
  GotClassMessage: Tu es une classe obèse.
  # The message players see when they attempt to use an ability that's on cooldown.
  AbilityCooldownMessage: Ta capacité {ability} est en rechargement pour {seconds} secondes !
  # A badge for the player.
  Badge: 
  # The color of the badge.
  BadgeColor: 
  # A message that will be announced by CASSIE when this subclass spawns.
  CassieMessage: 
  # The message people see when they run out of ability uses for any ability.
  OutOfAbilityUses: Tu n'as plus la capacité d'utiliser {ability} !

boolean_options:
  # Enables the class.
  Enabled: true
  # Disregards the value beneath it and uses the server default for friendly fire.
  DisregardHasFF: true
  # Enables friendly fire for this subclass, useful for traitorous subclasses, when a player with this option shoots a person on their team, everyone may shoot them regardless of DisregardTakesFF and TakesFriendlyFire.
  HasFriendlyFire: true
  # Disregards the value beneath it and uses the server default for friendly fire.
  DisregardTakesFF: true
  # Whether players on the same team of this subclass may shoot the player and may not be shot back.
  TakesFriendlyFire: true
  # If set to true, the subclass can only be given to a spawn wave. Defaults to false.
  OnlyAffectsSpawnWave: false
  # If set to true, the subclass can be given to both individuals and spawn waves. Defaults to false.
  AffectsSpawnWave : false
  # If set to false, the subclass will not be given to players after escaping. Defaults to true.
  GivenOnEscape : false

integer_options:
  # Max health of the class.
  MaxHealth: 130
  # The health the class spawns with.
  HealthOnSpawn: 130
  # Armor is a value that decreases over the course of the game, unless given the ability that stops it from doing so.
  # The max amount of armor the class has.
  MaxArmor: -1
  # The armor the class has on spawn.
  ArmorOnSpawn: -1
  # The max number of people that can have this class at any given moment - disregarding spawn waves.
  MaxAlive : 3
  # The max number of times this class can spawn per round. If this class is affecting a spawn wave, it is counted as 1. Defaults to an no max.
  MaxSpawnPerRound : 3
  # Any integer values from abilities go here as the <Ability>MaxUses

float_options:
  # The chance to get this class, not calculated with other classes for the same role.
  ChanceToGet: 5
  # The player's model scale across the selected axis.
  ScaleX : 1.2
  ScaleY : 0.9
  ScaleZ : 1.2
  # The player's spawn offset relative to the selected axis.
  SpawnOffsetX : 0
  SpawnOffsetY : 0
  SpawnOffsetZ : 0
  # The damage multiplier this player has. A value of 2 will double their damage.
  OnHitDamageMultiplier : 1
  # Any float values from abilities go here
  OnSpawnExhaustedChance: 100

# You may have a list of RoomTypes where this class is teleported to at the start of the round. Use Unknown for the default spawn location.
spawn_locations:
- Unknown

# "None" instead of any object means nothing would be added, but it still clears the player's inventory.
# It may be empty, if that's the case the value is "spawn_items: {}" then it would spawn with the default items from the role.
spawn_items:
  0:
    Coin: 40
  1:
    Painkillers: 10

# You can edit the default values of how must ammo a player has. Use -1 for default.
spawn_ammo:
  Nato556: -1
  Nato762: -1
  Nato9: -1

# Not all abilities are good, but they all add new things to the game.
# It may be empty, if that's the case, the value should be "abilities: []".
abilities: []

# You can set custom cooldowns for abilities that have cooldowns.
# This list should contain all abilites that could have cooldowns that the class has, even if you set them to 0.
# It may be empty, if that's the case, the value should be "ability_cooldowns: {}".
ability_cooldowns: {}

# With this list, you can give a subclass a list of other subclasses they can friendly fire upon.
# This value is a list of strings (which are other subclass names). It may be empty, if that's the case, the value should be "advanced_ff_rules: []".
advanced_ff_rules: []

# This is a list of roles that are unable to damage the subclass regardless of team.
# If you want it to be empty, you can use "roles_that_cant_damage: []".
roles_that_cant_damage: []

# This is the Team that players with this class can end the game with. "RIP" means the default team.
ends_round_with: RIP

# This adds the ability to give players with certain subclasses the ability to inflict any effects upon damage a player.
# If there is anything in the list, you have to add those to the float_options : "OnHit<EFFECT_NAME>Chance" which is the chance for the effect to be applied.
# And there's "OnHit<EFFECT_NAME>Duration" this is optional and is the duration of the effect.
on_hit_effects: []

# This adds the ability to give players with certain subclasses any effects on spawn.
# If there is anything in the list, you have to add those to the float_options : "OnSpawn<EFFECT_NAME>Chance" which is the chance for the effect to be applied.
# And there's "OnSpawn<EFFECT_NAME>Duration" this is optional and is the duration of the effect.
on_spawn_effects:
- Exhausted

# This adds the ability to give players with certain subclasses any effects when they are damaged based on the damage type.
# If there is anything in the list, you have to add those to the float_options : "OnDamaged<EFFECT_NAME>Chance" which is the chance for the effect to be applied.
# And there's "OnDamaged<EFFECT_NAME>Duration" this is optional and is the duration of the effect.
#on_damaged_effects:

# It defines what role the class will spawn as. "None" is the default meaning they spawn as the role they were going to.
spawns_as: None

# These define what role the class becomes upon escaping. There are options for cuffed and not cuffed.
# If this is set to "None", or is not provided, it will use the default. This does not work on classes that cannot escape.
escapes_as:
  cuffed: NtfCadet
  not_cuffed: ChaosInsurgency
steven4547466 commented 4 years ago

I'll look into it further when I get home and see if I can recreate the issue.

steven4547466 commented 4 years ago

Fixed in 1.2.0-pre006

coco9515 commented 3 years ago

The bug is back :/ You can try it with the class above Aveugle (the blinded one).