ShaDoOoW
Joined: 20 Aug 2005 Posts: 584
|
Posted: Fri Aug 08, 2008 19:48 Post subject: Custom NWScript function using NWNX plugins |
|
|
Well maybe there is someone else than me, who can use it:
CopyVars function, copy any float/int/string variable from oSource to oObject, I used this for spawning NPC on random waypoint and with that waypoint's variables.
Need nwnx_functions (linux version) ofc.
Code: | void CopyVars(object oSource, object oObject)
{
struct scriptvar s = GetFirstLocalVariable(oSource);
while(GetIsVariableValid(s))
{
switch(s.Type)
{
case VARIABLE_TYPE_INT:
SetLocalInt(oObject,s.Name,StringToInt(s.Value));
break;
case VARIABLE_TYPE_STRING:
SetLocalString(oObject,s.Name,s.Value);
break;
case VARIABLE_TYPE_FLOAT:
SetLocalFloat(oObject,s.Name,StringToFloat(s.Value));
break;
}
s = GetNextLocalVariable(oSource);
}
} |
Btw, whats the value for object is? Tag? Result from ObjectToString? _________________ Community Patch / NWNX Patch / NWNX Files / NWNX Connect |
|