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 
 
area plugin question

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support
View previous topic :: View next topic  
Author Message
Epitaffio



Joined: 13 Jul 2010
Posts: 29
Location: Italy

PostPosted: Wed Aug 11, 2010 19:26    Post subject: area plugin question Reply with quote

I'm trying this plugin, i can easily copy an area but i'm having some issue with the other two function, SetAreaName and DestroyArea.


I wish to use only 1 script to create and teleport the pc to the new area and to teleport back and destroy the area.

The script is launched by a placeable that store a local string to know how action to do (create/teleport or teleport/destroy).

Here is it the script:

Code:


#include "nwnx_in_area" // the nss included in the svn

void main(){

    //Preparing the variables
    object oPC = GetLastUsedBy();
    string x_area = GetLocalString(OBJECT_SELF, "x_area");
    object oArea;

    if(x_area == "home"){ //Creation + Teleport

        SendMessageToPC(oPC, "Creo l'area");
        oArea = CreateArea("prova_area");
        SetAreaName(oArea, "PROVA"); //It seem not to work

        SendMessageToPC(oPC, "Area Creata, tra 3 secondi si verra' trasportati");

        //Here i wish to store the object oArea on the pc, to destroy the area itself when the pc exit, but i don't know hot to store object on pc ^^" (maybe conversion ObjectToString, but how to convert it back?)

        //Waypoint in the area
        location lLoc =  GetLocation(GetWaypointByTag("prova_area_way"));
        DelayCommand(3.0f, AssignCommand(oPC, JumpToLocation(lLoc)) );


    }else if(x_area == "area"){ //Teleport + Destroy
        SendMessageToPC(oPC, "Tra 3 secondi tornerai indietro");

        //Waypoint in the starting area
        location lLoc =  GetLocation(GetWaypointByTag("prova_area_home"));
        DelayCommand(3.0f, AssignCommand(oPC, JumpToLocation(lLoc)) );

        // GetLocalObject(GetModule(), "NWNX!AREAS!GET_LAST_AREA_ID")) is just a try because i don't know the id object

        DelayCommand(10.0f, DestroyArea( GetLocalObject(GetModule(), "NWNX!AREAS!GET_LAST_AREA_ID")) );
        DelayCommand(10.0f, SendMessageToPC(oPC, "Area Distrutta"));

    }

}




As can be read in the comments, SetAreaName seem not to work and i've issue to save the area id to work with it Sad


Any hint or example are really appreciated!
Back to top
View user's profile Send private message
Nabla



Joined: 19 Aug 2010
Posts: 4

PostPosted: Sun Aug 22, 2010 15:05    Post subject: Reply with quote

For storing object it is like storing string. SetLocalObject

Using GetLocalObject(GetModule(), "NWNX!AREAS!GET_LAST_AREA_ID")

in a script is a bad idea, because it return only the last area created.
It is make for use in object LoadArea(string sResRef) script only.

I have make some test with the remove function, and the version as some bug. I will post update on the linux developement forum when I have more tested my version.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux technical support 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