Thursday 6 September 2007

Set Local Variable on the PC

void main( )
{
object oSelf = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC);
SetLocalInt(oSelf, "Value1", 1);
SetLocalFloat(oSelf, "Value2", 3.40);
SetLocalString(oSelf, "Quest1", "Quest completed!");
}


NWN2 Local Variables...
* NWN2 Local Variables are preferred over NWN2 global variables because they are assigned to specific objects and in that sense protected.
* Can be accessed by any object.
* Come in three types: integer, float, and string.
* Used to store information with a specific object.
* Used to get information from a specific object.


Source: NWN2 Scripting Setting Local Variables

No comments: