"." - A NPC variable.
They exist in the NPC and disappear when the server restarts or the
NPC is reloaded. Can be accessed from inside the NPC or by calling
'getvariableofnpc'. Function objects can also have .variables which
are accessible from inside the function, however 'getvariableofnpc'
does NOT work on function objects.
*getvariableofnpc(<variable>,"<npc name>")
Returns a reference to a NPC variable (. prefix) from the target NPC.
This can only be used to get . variables.
Examples:
//This will return the value of .var, note that this can't be used, since the value isn't caught.
getvariableofnpc(.var,"TargetNPC");
//This will set the .v variable to the value of the TargetNPC's .var variable.
set .v, getvariableofnpc(.var,"TargetNPC");
//This will set the .var variable of TargetNPC to 1.
set getvariableofnpc(.var,"TargetNPC"), 1;
Note: even though function objects can have .variables,
getvariableofnpc will not work on them.
@1: Yes, it should be possible using this method.
@2: You need to use getvariableofnpc for each instance of needing to use the variable from another NPC.
@3: As Skorm mentions, as long as the NPC is a duplicate of another NPC, the scope variables will be the same as another.
@4: When using deletearray command, the documentation is right, but also wrong. It should read:
*deletearray <array name>{[<first value>],<how much to delete>};
This is because, when a start & end value is omitted, it defaults to: deletearray <arrayname>[0],<script_max_array_size>;
So it should be completely erasing your array from existence.
Hope that helps D: and anyone else who feels I am wrong on a certain matter, please don't hesitate to correct me !!