OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Dagon on 06 Sep 2005, 05:43:58

Title: Using "PLAYER" in scripts/triggers
Post by: Dagon on 06 Sep 2005, 05:43:58
Is using "PLAYER" in a script or trigger a 'safe' practice, or should I instead name the player's instance (how's PC sound? Player character. har.) and refer to it by the instancename instead of PLAYER?
Title: Re:Using "PLAYER" in scripts/triggers
Post by: CrashnBurn on 06 Sep 2005, 07:51:45
Not sure about multiplayer but no problem for single player. In fact, even if you name the player, you can still use "player" in triggers and scripts.  ;)
Title: Re:Using "PLAYER" in scripts/triggers
Post by: THobson on 06 Sep 2005, 07:52:40
I am sure opinions will vary on this.  

I use the name of the character in all the cutscenes, but I use 'player' in all the scripts.  That way when I am testing a mission I can play as a temporary unit that might have more/different equipment than the player character and the scripts will still work because this temporary unit is now the player.  The one gap in my knowledge on this is Muti-Player.  I have written no scripts for MP missions so I cannot say how player is treated there.
Title: Re:Using "PLAYER" in scripts/triggers
Post by: nominesine on 06 Sep 2005, 08:24:22
In MP player its a variable that exists on all clients. If a global script issues a command affecting player, it will affect all human players in a MP-game.

In a local script it will only affect the player on the client running the script.

Title: Re:Using "PLAYER" in scripts/triggers
Post by: Sui on 07 Sep 2005, 01:42:29
As far as I know it's good practice... I use it all the time ;)

The only exception is in intro or outros, the code:

name player

Doesn't work, you have to name the unit and use:

name unit

instead...
Title: Re:Using "PLAYER" in scripts/triggers
Post by: macguba on 07 Sep 2005, 10:01:51
I don't use it.  It means you can't test the mission as any other unit.