Page 1 of 1
Make player immune to damage during scripted events
Posted: Thu Jun 16, 2022 1:28 pm
by AshHouswares
How can I make the player immune to damage during a scripted event? The player freezes while the event is happening but is still being harmed by monsters while its happening. Doesnt seem fair design. Is their a good fix maybe a player property or something?
Re: Make player immune to damage during scripted events
Posted: Thu Jun 16, 2022 2:11 pm
by Jarewill
The simplest way to do it would be to use
GiveInventory and
TakeInventory to add and remove the
PowerInvulnerable to/from the player.
You could also create a custom powerup inheriting from PowerInvulnerable to prevent the player from losing invulnerability if they had it before the cutscene started.
Re: Make player immune to damage during scripted events
Posted: Thu Jun 16, 2022 2:26 pm
by Enjay
There is also [wiki]SetPlayerProperty[/wiki], though the invulnerability property there has been deprecated (but it still works) and, even better, [wiki]SetActorProperty[/wiki] which is now the supported way to do it.
Re: Make player immune to damage during scripted events
Posted: Thu Jun 16, 2022 2:29 pm
by Jarewill
Ah, I skimmed through the wiki page for SetActorProperty in search for a way to set invulnerability, but I guess I must have missed it.
As Enjay said, using SetActorProperty to set APROP_Invulnerable is the best way to do it in this case.