OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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?
-
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. ;)
-
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.
-
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.
-
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...
-
I don't use it. It means you can't test the mission as any other unit.