logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Custom NWScript function using NWNX plugins

 
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Fri Aug 08, 2008 19:48    Post subject: Custom NWScript function using NWNX plugins Reply with quote

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
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Sat Aug 09, 2008 3:14    Post subject: Reply with quote

IntToObject(StringToInt(s.Value))
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group