Hello,
I am trying to set-up a training area for new people coming into the mod for the first time, But I would
like it to be only accessed once. Is there a simple way of doing this?
Thank you
Mayhoof
Hello,
I am trying to set-up a training area for new people coming into the mod for the first time, But I would
like it to be only accessed once. Is there a simple way of doing this?
Thank you
Mayhoof
If this is the starting area, then just make sure that there are no area transitions that lead back to the area. Otherwise, the first time the creature enters the area, put a local integer on them (or their creature skin). You can use the On_Enter event for the area for this. When PC tries to enter again (via door, area transition, etc.), you have the script that handles the transition check for this integer. If they have it, you don’t let them transition.
Or put the only area transition script in a dialogue of a trainer creature that takes you there or explains why you can’t go.
It may be worth mentioning that area’s OnEnter handler fires when PC jumps into it in DebugMode. This can be also used to prevent the player from breaking the module by jumping to areas further down the plot.
Hello, Thanks for the replies and they sound great except one thing I don’t know how to script, so I guess I should have reworded it to read need help on obtaining a script, if anyone knows of one please let me know.
Thanks Mayhoof
We need some more details on how you want players to access the area, since different methods need slightly different scripts.
If you want to do any serious modding you should learn some basic scripting. NWScript is essentially C without pointers or arrays. So either look for a scripting tutorial or pick up a teach yourself C book/video and work through the lessons for the first 2 or 3 weeks.
For tutorials look at this thread. It is full of links to them. Take your time looking through the lists.
TR
Hello,
Thanks for all your responses, I will definitely look into the tutorials and the c books. But has far as the scenario that this will play out in is as follows;
MY basic idea was after they enter the start, they will be able to to to someone/thing, one question the the creature will ask is “If they now about this crafting system and if not do they want to go to a training area?” If they want to go to the training area then the can go through a door, but I do not want them to be able to go through the door again after the leave the training area. I know on most PW’s if the server resets everyone ends back in the start area or should say use to:)
If someone can help me at this time, it would be appreciated highly!!!
Thanks Mayhoof
@Wendigo211 already gave a good solution. Set a flag on the PC when they enter the training area. Check for the flag when the PC clicks the door - stop the transition if the flag is set. The default transition script is nw_g0_transition - you just need to give the door a custom version, or change nw_g0_transition to look for the door’s tag.
A ready-made solution is in my Travel Builder scripts - a version of nw_g0_transition that has an OnTransitionClick pseudo-event for user exits.
That requires very little scripting knowledge (you probably can’t mod NWN successfully unless you venture into at least the shallows of scripting).
Thanks for the info,
and I will look into your travel script, and I agree the idea is great that Wendigo211 stated but one major problem is to set a flag, int, var, etc; i would need to know how to set those items to the PC and door.
I have been looking into the basic scripting tuts on NWN Vault college, that to will take time to go through and digest the information.
Thanks Mayhoof
SetLocalInt and GetLocalInt are your friends here (see Lexicon).
Hello again
Thanks for the starting spot, but running into a problem with the scripts:
Below are the scripts I am using and placing them on the open slot on the doors;
//GetLocalInt
// Will return the int stored in “B”
void main()
{
int B = GetLocalInt(OBJECT_SELF,"left");
SendMessageToPC(GetFirstPC(), IntToString(B));
}
…
//SetLocalInt
void main()
{
object oTestsub = OBJECT_SELF;
string sKey = "left";
int B = 2;
// sets the value of 2 tied to the key "foo" on the caller.
// this value can be later retrieved using GetLocalInt.
SetLocalInt(OBJECT_SELF,"left",2);
SendMessageToPC(GetFirstPC(), IntToString(B));
}
…
The problem is that the exit door in sets the int at 2 which is fine, but when i transition to the entry door in another area the int shows 0 (not 2); not sure why it’s not working, could you take a look:)
Thanks Mayhoof
They are two different doors.
The issue is caused by OBJECT_SELF. OBJECT_SELF always refers to the object that is calling the script. In this case two different doors. What you want to do is put the local integer on GetLastOpenedBy(), which will be the object that opened the door (the PC in this case).
However, for your purposes you might want to use the area transition click event. The on open event will fire when the door is opened, you probably want the script to fire when the player clicks on the transition pane that appears when the door has been opened. For this event you want GetClickingObject().
So your entry script should look like:
void main()
{
object oPC=GetClickingObject();
int B=GetLocalInt(oPC, "left");
SendMessageToPC(oPC, IntToString(B));
}
Your exit script should look like:
void main()
{
object oPC=GetClickingObject();
int B=2;
SetLocalInt(oPC, "left", B);
SendMessageToPC(oPC, IntToString(B));
}
Thank you all for the great help and support
up-dated the script and placed on transition click event, and the transition didn’t work , put back on the on open and evrything worked fine with the exception it does not fire the numbers off on the first touch?
I will keep playing with same and again thanks so very much for the help :)
Mayhoof