This is probably pretty simple but I can’t figure it out. I have a 1v1 map with max 2 players and I want to have 2 buttons that change the all players max shield. One button changes the shield to max 85 and the other button changes the max shield to 100. I couldnt get it to work with the health powerup device (it wasn’t changing the players shield at all). I would like to be able to change all players max health/shield without changing their teams. Like I mentioned earlier this is probably a really easy fix but I cant quite figure it out.
Just do this with Verse. I can make a quick tutorial to do this as it’s not hard at all
You may be able to use Class Designer devices and set one for default, one for health and one for shields and hook your buttons up to 2 Class Selector Volumes for switching between.
This achieves full health and shield instantly, but I am not sure if it will work how you want, it can give full health and no shield, but in regards to one giving full shield without affecting the health I am not sure.
Verse could be a better solution if you find an appropriate tutorial
Yep 24 more subs and GraemeBB can sort you out.
I keep typoing on your name Graeme, sorry
Here’s an example where I change a player’s health/shield through Verse, hope this helps:
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
health_settings_device := class(creative_device):
@editable
HealthSettings: []health_setting = array{}
@editable
EliminationManager: elimination_manager_device = elimination_manager_device{}
@editable
ResetHealthOnElim: logic = true
var CurrentSettingsPerPlayer: [player]health_setting = map{}
OnBegin<override>()<suspends>:void=
Sleep(0.0)
DeviceSetup()
DeviceSetup(): void =
EliminationManager.EliminationEvent.Subscribe(SetHealthAndShield)
for (HealthSetting : HealthSettings):
HealthSetting.Init(Self)
GetAllPlayers(): []player =
AllPlayers := GetPlayspace().GetPlayers()
return AllPlayers
SetHealthAndShield(MaybeAgent: ?agent): void =
if:
Agent := MaybeAgent?
Player := player[Agent]
HealthSetting := CurrentSettingsPerPlayer[Player]
FortCharacter := Agent.GetFortCharacter[]
then:
FortCharacter.SetHealth(HealthSetting.Properties.MaxHealth)
FortCharacter.SetShield(HealthSetting.Properties.MaxShield)
health_setting := class<concrete>:
@editable
Button: button_device = button_device{}
@editable
AffectsAllPlayers: logic = true
@editable
Properties: health_setting_properties = health_setting_properties{}
var VerseDevice: health_settings_device = health_settings_device{}
Init(MainDevice: health_settings_device): void =
set VerseDevice = MainDevice
Button.InteractedWithEvent.Subscribe(ButtonPressed)
ButtonPressed(Agent: agent): void =
AllPlayers := VerseDevice.GetAllPlayers()
if (AffectsAllPlayers?):
for (Player : AllPlayers, FortCharacter := Player.GetFortCharacter[]):
FortCharacter.AdjustHealthAndShield()
if {set VerseDevice.CurrentSettingsPerPlayer[Player] = Self}
else:
if (Player := player[Agent], FortCharacter := Agent.GetFortCharacter[]):
FortCharacter.AdjustHealthAndShield()
if {set VerseDevice.CurrentSettingsPerPlayer[Player] = Self}
(FortCharacter: fort_character).AdjustHealthAndShield(): void =
FortCharacter.SetMaxHealth(Properties.MaxHealth)
FortCharacter.SetMaxShield(Properties.MaxShield)
FortCharacter.SetHealth(Properties.StartingHealth)
FortCharacter.SetShield(Properties.StartingShield)
health_setting_properties := struct<concrete>:
@editable
MaxHealth: float = 100.0
@editable
MaxShield: float = 100.0
@editable
StartingHealth: float = 100.0
@editable
StartingShield: float = 100.0
I am new-ish to UEFN and have had very little experience with Verse. Is this code ready to go based on how I wanted the health + shield to work or is it just a template that I need to make changes to? If not, would you be able to make those changes to the code. I have two buttons and I want one to set all players to 100 HP + 85 shield and the other to set all the players to 100 HP + 100 shield and be able to toggle between them. I know its a lot to ask so all good if not!
it actually might work for a lot of what you’re looking for, it was more an example and a nearly finished feature but feel free to use it if you’d like.
I just pasted the code in and created the verse device for it. I’ve linked the buttons to the device and put in my health values however it doesn’t seem to be changing it at all. Is there something else I have to change in the code?
EDIT: It appears to be working now. However the granted health on elim only works when one of the buttons is selected. ie. If the player loads in on the default 100 health + 100 shield (as per the island settings) no health will be granted on elimination if they have taken damage unless they select one of the buttons that changes their health. The island settings have health granted on elimination set to 200 but it doesnt seem to be taking affect so I am thinking something else is over-riding it.
ANOTHER EDIT: Just realised that I am testing against a sentry so I’m not sure if the island settings grant siphon on elim against Sentry’s. I will test this with a friend later
ah yes, in that code you have to have selected an option for it to give back the health/shield on elim, and sentries only work if you include them as a target with the elimination manager. Sorry, this was a quick example script written up for a different situation so it was relatively untested. It should set people’s health with the buttons though like you were asking.
So everything works properly now however I have noticed that the health of the player who has been eliminated, is reset back to 200 (as per island settings). The player who killed the other player will stay on the health that they selected. Is there a way to override the island settings and give the player that died the last selected health before they died? Not sure if that makes sense.
So I’ve tested other maps and I believe they are using the class selector and class designer to change players max health and shield. I could be wrong but I think thats how they are doing it. I wanted to give that a go but there is no option to apply class to all players. Only the instigating player can be assigned the class. I’m not sure if I’m missing a setting or if it’s just not possible with the device.
Yes that’s commonly how that’s done. There is no built-in function to change the class of all players in the island, but you would use Verse or another device to get instigation for everyone. A common device you can use is a Player Counter:
- Connect a button to the Player Counter’s “Transmit For All Counted Players”
- Connect “When Player Counted Transmit On” to the Class Selector
Make sure you change “Transmit For Player Counted/Removed” to “Signal Only”
Hey Thomas!
This Script worked perfect for me on my map. Thank you so much.
Would it be possible for you to adapt the code so that I can use a trigger instead of the button?
Thank you
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
health_settings_device := class(creative_device):
@editable
HealthSettings: []health_setting = array{}
@editable
EliminationManager: elimination_manager_device = elimination_manager_device{}
@editable
ResetHealthOnElim: logic = true
var CurrentSettingsPerPlayer: [player]health_setting = map{}
OnBegin<override>()<suspends>:void=
Sleep(0.0)
DeviceSetup()
DeviceSetup(): void =
EliminationManager.EliminationEvent.Subscribe(SetHealthAndShield)
for (HealthSetting : HealthSettings):
HealthSetting.Init(Self)
GetAllPlayers(): []player =
AllPlayers := GetPlayspace().GetPlayers()
return AllPlayers
SetHealthAndShield(MaybeAgent: ?agent): void =
if:
Agent := MaybeAgent?
Player := player[Agent]
HealthSetting := CurrentSettingsPerPlayer[Player]
FortCharacter := Agent.GetFortCharacter[]
then:
FortCharacter.SetHealth(HealthSetting.Properties.MaxHealth)
FortCharacter.SetShield(HealthSetting.Properties.MaxShield)
health_setting := class<concrete>:
@editable
Trigger: trigger_device = trigger_device{}
@editable
AffectsAllPlayers: logic = true
@editable
Properties: health_setting_properties = health_setting_properties{}
var VerseDevice: health_settings_device = health_settings_device{}
Init(MainDevice: health_settings_device): void =
set VerseDevice = MainDevice
Trigger.TriggeredEvent.Subscribe(TriggerTriggered)
TriggerTriggered(MaybeAgent: ?agent): void =
if (Agent := MaybeAgent?):
AllPlayers := VerseDevice.GetAllPlayers()
if (AffectsAllPlayers?):
for (Player : AllPlayers, FortCharacter := Player.GetFortCharacter[]):
FortCharacter.AdjustHealthAndShield()
if {set VerseDevice.CurrentSettingsPerPlayer[Player] = Self}
else:
if (Player := player[Agent], FortCharacter := Agent.GetFortCharacter[]):
FortCharacter.AdjustHealthAndShield()
if {set VerseDevice.CurrentSettingsPerPlayer[Player] = Self}
(FortCharacter: fort_character).AdjustHealthAndShield(): void =
FortCharacter.SetMaxHealth(Properties.MaxHealth)
FortCharacter.SetMaxShield(Properties.MaxShield)
FortCharacter.SetHealth(Properties.StartingHealth)
FortCharacter.SetShield(Properties.StartingShield)
health_setting_properties := struct<concrete>:
@editable
MaxHealth: float = 100.0
@editable
MaxShield: float = 100.0
@editable
StartingHealth: float = 100.0
@editable
StartingShield: float = 100.0
Great. Thanks for the quick reply. I don’t dare ask, but can you adapt the code so that the settings remain after elimination?
The guy that made the code made it in a really weird way for me to change it. Could you give me what the code is supposed to do exactly so I can rewrite it?
I would like to be able to set how much power all players should have (e.g. 100 stamina and 80 shield). I would like to trigger the whole thing with a trigger because I am shooting it. Class equipment is not an option as there is quite a delay in the allocation. The health awarded should remain after elimination
Well, Health and shield is possible to change upon shooting a trigger using Verse, but changing stamina is only possible by changing a players team/class
i mean health and shield. the translater wrote stamina
I can re-write this for you tomorrow using Triggers