SetPlayerProperty

From ZDoom Wiki
Jump to navigation Jump to search

191:SetPlayerProperty (who, set, which)


  • who: Set to 1 to affect all players, 0 for just the one who activated the special.
  • set: Set to 1 to turn on the property, or 0 to turn it off. PROP_INVULNERABILITY has a special use for this field.
  • which: Which property to change

Sets a property for a player.

Note: Using this special to grant powerup effects to players has been deprecated. Consider using the GiveInventory function for this purpose instead.


  • 0 — PROP_FROZEN — The player cannot move, but can still fire and perform other actions. (In order to instantly freeze the player in place, use in conjunction with Thing_Stop to set the player's current momentum to zero.)
  • 1 — PROP_NOTARGET — Monsters ignore the player, unless they have already seen him or the player harms them.
  • 2 — PROP_INSTANTWEAPONSWITCH — The weapons do not delay between changing them.
  • 3 — PROP_FLY — The player is (not) subjected to gravity. The behavior is about the same as having Heretic's/Hexen's Wings of Wrath.
  • 4 — PROP_TOTALLYFROZEN — Same as PROP_FROZEN, but does not allow the player to look around or shoot. (In fact, the only control they can still use is the “+use” key)
  • 5 — PROP_INVULNERABILITY (deprecated)  — Invulnerability sphere. Using a "set" value of 1 makes the player(s) invulnerable and applies the inverted greyscale invulnerable palette. Using a "set" value of 2 makes the player(s) invulnerable but does not apply the invulnerability palette. SetActorProperty with APROP_Invulnerable or APROP_DamageFactor is a valid substitution.
  • 6 — PROP_STRENGTH (deprecated) — Berserk pack
  • 7 — PROP_INVISIBILITY (deprecated) — Partial Invisibility sphere
  • 8 — PROP_RADIATIONSUIT (deprecated) — Radiation suit
  • 9 — PROP_ALLMAP (deprecated) — Computer area map
  • 10 — PROP_INFRARED (deprecated) — Light Amplification Goggles
  • 11 — PROP_WEAPONLEVEL2 (deprecated) — Tome of Power
  • 12 — PROP_FLIGHT (deprecated) — Wings of Wrath
  • 13 — PROP_UNUSED1 — Does nothing. Do not use.
  • 14 — PROP_UNUSED2 — Does nothing. Do not use.
  • 15 — PROP_SPEED (deprecated) — Speed boots
  • 16 — PROP_BUDDHA — Buddha Mode (1 indestructible hit point)

Setting player properties directly (ZScript only)

Certain player properties can be set directly in ZScript via the player's cheats variable found in their PlayerInfo. To set a property, use

player.cheats |= CF_PROPERTY;

and to unset a property, use

player.cheats &= ~CF_PROPERTY;

Multiple properties can be combined using the | operand e.g.

player.cheats |= (CF_PROPERTY1 | CF_PROPERTY2 | CF_PROPERTY3);
player.cheats &= ~(CF_PROPERTY1 | CF_PROPERTY2 | CF_PROPERTY3);

Below are a list of available properties:

  • CF_BUDDHA - Enables standard buddha behavior (cannot drop below 1 health)
  • CF_BUDDHA2 - Enables absolute buddha (impossible to drop below 1 health)
  • CF_GODMODE - Enables standard god mode
  • CF_GODMODE2 - Enables absolute god mode (impossible to take damage from anything)
  • CF_NOCLIP - Enables standard noclipping
  • CF_NOCLIP2 - Enables free flight noclipping
  • CF_NOTARGET - Disables monsters' ability to see the player (note: does not apply if the monster was already targeting the player)
  • CF_FLY - Enables flight movement
  • CF_CHASECAM - Sets the player into third person
  • CF_FROZEN - Player cannot move but can perform other actions
  • CF_TOTALLYFROZEN - Player cannot do anything except the use action. Also prevents view angle extrapolating from mouse look
  • CF_FRIGHTENING - Monsters flee from the player
  • CF_INSTANTWEAPONSWITCH - Weapons swap instantly instead of raising and lowering
  • CF_INTERPVIEW - Interpolate the player's view angles this tic. Also prevents view angle extrapolating from mouse look

Examples

This function is almost like an ACS pause game function, and can be toggled on and off.

Function void PlayerFreeze (bool IsOn)
{
	if(IsOn)
	{
		Thing_Stop(TID_Player);
		SetPlayerProperty(TRUE, ON, PROP_TOTALLYFROZEN);
		if(CheckActorInventory(TID_Player, "PowerTimeFreezer") == 0)
			GiveActorInventory(TID_Player, "PowerGiver_ACSTimeFreeze", 1);
	}
	else
	{
		SetPlayerProperty(TRUE, OFF, PROP_TOTALLYFROZEN);
		TakeActorInventory(TID_Player, "PowerTimeFreezer", 0x7fffffff);
	}
}

External links