Buff Or Nerf Weapons Damage Power-Up Script
-
| | | | --- | --- | | | using { /Fortnite.com/Devices } | | | using { /Verse.org/Simulation } | | | using { /Fortnite.com/Characters } | | | | | | <########################################################################################################################## | | | ###########################################---- CREATED BY EGGOH_FN ----################################################# | | | ###########################################---- DISCORD eggoh_fn ----################################################# | | | | | | * Version = 1.02 | | | | | | * This code manages the applying and clearing of powerups based on if a player is holding a specific item or not, | | | it can be used for any powerup but was designed with the damage amplifier As a main use case. | | | * This device uses an array of structs to allow for multiple different items to be checked for at the same time, | | | each weapon has its own settings to nerf or buff a weapons damage and a conditional button. | | | * This device requires only one instance of the damage amplifier to be placed in the level to work, | | | and can check for as many different items as needed, just add them to the array in the details panel. | | | * Make sure to set the powerup to infinite duration and 0 respawn time for best results, | | | also make sure to connect the PowerUps clear Function to the clear trigger, | | | this will ensure the powerup is cleared when switching away from the weapon or dropping it. | | | * If you want to use this for a different powerup other than the damage amplifier, | | | simply change the type of the powerup in the weapon struct and set up the desired powerup settings. | | | | | | ########################################################################################################################### | | | | | | DAMAGE AMPLIFIER SETUP-SETTINGS: | | | * DAMAGE MULTIPLIER -> THIS WILL BE OVERRIDEN BY THE VALUE YOU SET FOR EACH WEAPON. | | | * INFINITE EFFECT DURATION -> MAKE SURE THIS IS SET TO ON/TRUE | | | * RESPAWN -> MAKE SURE THIS IS SET TO ON/TRUE | | | * TIME TO RESPAWN -> MAKE SURE THIS IS SET TO 0.0s | | | * APPLY TO -> MAKE SURE THIS IS SET TO "PLAYER" | | | | | | * USER OPTIONS - FUNCTIONS | | | * CLEAR -> MAKE SURE THIS IS CONNECTED TO THE CLEAR TRIGGER | | | | | | ###########################################################################################################################> | | | | | | # ToolTips for editor variables | | | Name_ToolTip<public><localizes>:message := "Name of the weapon or item being checked for, this is only used for orginization and print statements to identify which weapon is being held." | | | Damage_Multiplier_ToolTip<public><localizes>:message := "Damage Multiplier: setting to 0.0 will nerf damage to 0, setting to 1.0 will not effect damage dealt, setting to 2.0 will double damage, 4.0 Being the highest accepted Multiplier value." | | | Conditional_Button_ToolTip<public><localizes>:message := "The conditional button used to check if the player is holding the pre-configured item." | | | Check_Delay_ToolTip<public><localizes>:message := "Check_Delay: Delay before rechecking if player is holding item, lower values may cause performance issues, and higher values may cause delay in applying or clearing powerup." | | | Damage_Amp_ToolTip<public><localizes>:message := "Damage Amplifier: The powerup to apply when holding the item, make sure to set this PowerUp with infinite duration and 0 respawn time for best results." | | | Clear_Trigger_ToolTip<public><localizes>:message := "Clear Trigger: This is use to clear the powerup when the player is no longer holding any of the item. make sure to connect the PowerUps clear Function to this trigger" | | | Weapons_ToolTip<public><localizes>:message := "Weapons: Array of weapons to check for, each with their own conditional button to check if player is holding the item." | | | | | | # This struct holds the settings for each weapon to check for, this allows for different weapons to have different damage multipliers and Conditional_buttons to check | | | _Weapon := class<concrete>: | | | @editable: | | | ToolTip := Name_ToolTip # The tool tip for this editable. | | | Name : string = "Weapon To Check For.." # Name used for orginization and print statements | | | @editable_slider(float): | | | ToolTip := Damage_Multiplier_ToolTip # The tool tip for this editable. | | | MinValue := option{0.0} # The minimum value for this editable. | | | MaxValue := option{4.0} # The maximum value for this editable. | | | SliderDelta := option{0.01} # The amount the slider value increases or decreases per delta. | | | Damage_Multiplier : float = 1.2 # Amount to multiply damage by when applying powerup, | | | @editable: | | | ToolTip := Conditional_Button_ToolTip # The tool tip for this editable. | | | Conditional_Button : conditional_button_device = conditional_button_device{} # conditional Button used to check if player is holding item | | | var PlayerState : [agent]logic = map{} # Tracks if player is in powerup state or not | | | | | | # Manages PowerUp switching based on item being held or not | | | Damage_Amplifier_PowerUp_Manager := class(creative_device): | | | @editable_slider(float): | | | ToolTip := Check_Delay_ToolTip # The tool tip for this editable. | | | MinValue := option{0.01} # The minimum value for this editable. | | | MaxValue := option{1.0} # The maximum value for this editable. | | | SliderDelta := option{0.01} # The amount the slider value increases or decreases per delta. | | | Check_Delay : float = 0.1 # Delay before rechecking if player is holding item, lower values may cause performance issues, and higher values may cause delay | | | @editable: | | | ToolTip := Damage_Amp_ToolTip # The tool tip for this editable. | | | Damage_Amp : damage_amplifier_powerup_device = damage_amplifier_powerup_device{} # Powerup to apply when holding item | | | @editable: | | | ToolTip := Clear_Trigger_ToolTip # The tool tip for this editable. | | | Clear_Trigger : trigger_device = trigger_device{} # Trigger to clear powerup when not holding item | | | @editable: | | | ToolTip := Weapons_ToolTip # The tool tip for this editable. | | | Weapons : []_Weapon = array{} # Array of weapons to check for, each with their own powerup and button to check | | | var ActiveWeapons : [agent]int = map{} # Tracks how many items the player is currently holding, only clears when player is not holding any of the configured items | | | | | | # Runs when the device is started in a running game | | | OnBegin<override>()<suspends> : void = | | | Print("Damage Amplifier Manager Started") | | | loop: # Infinite loop to continuously check player states | | | Sleep(Check_Delay) # Wait for specified delay before checking again | | | for (Player : GetPlayspace().GetPlayers()): # Loop through each player in the playspace | | | if (Agent := agent[Player]): # Get agent from player | | | if. not ActiveWeapons[Agent] then if. set ActiveWeapons[Agent] = 0 # Initialize active map for player if not present | | | for (Weaponx : Weapons): # Loop through each weapon configured in the device | | | CurrentState := if. State := Weaponx.PlayerState[Agent] then State else false # Get currentState, default to false if not set | | | if (Weaponx.Conditional_Button.IsHoldingItem[Agent]): # Check if player is holding the item | | | if (CurrentState = false): # proceed only if CurrentState is false to prevent reapplying powerup | | | if. set Weaponx.PlayerState[Agent] = true # imediatly update player state to holding to prevent any issues with the short delay between checks | | | if. set ActiveWeapons[Agent] += 1 # Update active map to indicate player is holding item | | | Damage_Amp.SetMagnitude(Weaponx.Damage_Multiplier) # Set the damage multiplier based on the weapons settings | | | Damage_Amp.Pickup(Agent) # Apply powerup to player | | | Print(Weaponx.Name + " is being held.. Damage Amplifier Set To: {Damage_Amp.GetMagnitude()} and Activated") | | | | | | else if (CurrentState = true): # proceed only if CurrentState is true to prevent unnecessary clearing | | | if. set Weaponx.PlayerState[Agent] = false # Imediately update player state to not holding to prevent any issues with the short delay between checks | | | if. set ActiveWeapons[Agent] -= 1 # Update active map to indicate player is not holding item | | | if (ActiveWeapons[Agent] = 0): # Only clear powerup if player is not holding any of the configured items | | | Clear_Trigger.Trigger(Agent) # Clear powerup from player | | | Print(Weaponx.Name + " is no longer being held.. Damage Amplifier Cleared") |
You're reading a preview
The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.
Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.