Hi, I want to programmatically and instantly restore a player’s health and shields (including overshield) after they’re knocked. The Health Powerup device only seems to restore the player’s health and shields but NOT the overshield. Any other way in Verse to instantly restore the overshield rather than wait a while to recharge? I can’t alter the overshield island settings because I want them to work in the default way during a fight. Maybe there’s some way in Verse to change the island’s overshield settings? Open to other ideas as well. Seems like an oversight that it isn’t possible with the Health Powerup device.
There doesn’t seem to be any way yet to control the overshield outside of the island settings, and that doesn’t seem to be controllable via verse yet either. Sounds like a feature request maybe.
There are some workarounds to this:
You could try changing the player’s class to a new one with the same settings, and on the class selector set “Restore Health and Shields on Switch” on True, but I’m not sure that’s gonna work:
If this doesn’t work, editing the overshield value of the new class could help, since you’re telling the game to edit that property and it may be resetted. You could just add 1 to the overshield value, so it would be 51 instead of 50.
But I’m pretty sure that the best way you can do this, is to give the player a class with instant overshield reload and remove that class like a second later. For instant overshield reload, you can set the class designer like this:
Thanks a bunch! If I wanted to change the player’s class then wait a second and change it back, how would that verse code look? I found the ChangeClass method but it only accepts 1 parameter, the player. (??)
Something like this?
@editable var ClassSelector: class_and_team_selector_device = class_and_team_selector_device{}
... after stuff happens ...
for (Player: AllPlayers):
ClassSelector.ChangeClass(Player) # how do i tell it which class to change to?
Sleep(1.0)
ClassSelector.ChangeClass(Player) # how do i tell it which class to change back to?
I’d expect there to be another int parameter that accepts a class number. Maybe I’m misunderstanding something.
You can choose the class to change to, by setting the class selector inside the editor, by linking it to the @editable
var you’ve made.
Also, in order to select the player (intended as the person who is playing and not the type of data inside Verse) I suggest you to use directly the agent
, because in other devices it could be necessary. But since player
inherits from agent
, it works fine in this case, because the class selector only works with players and not other entities.
This is what the code would look like:
@editable var ClassSelector1: class_and_team_selector_device = class_and_team_selector_device{}#This one changes the class to the one with instant overshield reload
@editable var ClassSelector2: class_and_team_selector_device = class_and_team_selector_device{}#This one resets the class
... after stuff happens ...
for (Player: AllPlayers):
if(Agent:=agent[Player]:
ClassSelector1.ChangeClass(Agent)
ClassSelector2.ChangeClass(Agent)
Got it, thank you!
I tried using that but there is a ) missing in the if statement?
Yeah sorry about that, typo. It won’t let me go back and edit it, I guess.
oh yeah, my bad. it’s fixed now:
@editable var ClassSelector1: class_and_team_selector_device = class_and_team_selector_device{}#This one changes the class to the one with instant overshield reload
@editable var ClassSelector2: class_and_team_selector_device = class_and_team_selector_device{}#This one resets the class
... after stuff happens ...
for (Player: AllPlayers):
if(Agent:=agent[Player]):
ClassSelector1.ChangeClass(Agent)
ClassSelector2.ChangeClass(Agent)
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.