SetCrewExtraData

Category: Player
Since engine version: 4.9.6.0 CR

Description

With this function additional data can be saved in a crew member's file the in player. This can be used to preserve values across scenarios, for example for RPGs or highscores. If successful, the saved value is returned.

Syntax

any SetCrewExtraData (object pCrew, string strDataName, any Data);

Parameters

pCrew:
Object for which extra data is to be saved. Can be 0 in local calls.
strDataName:
Name for the data
Data:
Data to be saved.

Remarks

No objects or strings may be saved.
Because all scripts use the same storage in the crew member, the name for the data should be prefixed with the scenario or object name or your developer id.

Example

#include CLNK

local fInvisible;
    
protected func Recruitment(a,b,c,d,e,f,g,h,i,j)
  {
  var rVal = _inherited(a,b,c,d,e,f,g,h,i,j);
  if (GetCrewExtraData(0, "C4ID_Invisible")) SetVisibility(VIS_Owner);
  return(rVal);
  }
    
protected func ControlSpecial()
  {
  if (fInvisible = !fInvisible)
    SetVisibility();
  else
    SetVisibility(VIS_Owner);
  SetCrewExtraData(0, "C4ID_Invisible", fInvisible);
  }
A script for a special clonk: the clonk can make himself invisible through the Special 1 key. The set invisibility is maintained even beyond game end and is reapplied when this clonk is used in a new round.
See also: GetCrewExtraData, SetPlrExtraData
Sven2, Februar 2006