Vuldrick Garrison's Persistent Start Location and Racial Type Start Point System. Last Build: 12/01/04 This very flexible system will allow a module designer to incorporate the use of Bioware Databases in order to maintain persistent start locations for their PCs. This way, the PC always starts off where they left off in the game. This is particularly useful for Persistent Worlds. As an extra, I have included a simple system that allows PCs to spawn to waypoints . . . designated by racial type. This allows the module designer to make multiple spawn in zones for the various player races (homelands). There are more elegant ways to do this, but I went for ease of function here.
Posted by bighairyandy at 2012-02-10 14:50:26 Voted 10.00 on 02/10/12
Flawless and easy to implement. Thanks for this system.
Posted by Inayity at 2008-07-19 22:40:49 Voted 10.00 on 07/19/08
Sweet! Thank you for the hard work!
Posted by Ondaderthad at 2008-03-29 23:19:47 Voted 10.00 on 03/29/08
Very good system
Saving on exit of area makes more sense to avoid cheating. (ie. log off when the monsters are too tough then loggin back in)
Saving location both on enter a new area and on exit of the old area would only make the database access twice when using normal transitions.
Saving on exit of area covers both the normal area transitions and when the player leaves the server. (it fires before the on_client_leaves event)
I also have the switch to not save the location in the first staging area and have an on-enter trigger around the starting point to send PC to their saved location after a server reset.
Works fine.
_________________________ The Best PW system is getting even better. PLATEMAIL Tech Preview
Posted by Vuldrick at 2006-09-04 07:51:14 Voted 10.00 on 08/06/06
Almost forgot, we also save when PCs enter an area. You might just try that too . . . cause you are guaranteed that the PC exists in the server when they enter any given area. Also, if you save when they enter any area, they must at least enter a new area to get a new save location . . . so they can not exploit in that case too.
Again, it is a simple matter of hooking the location saving code into the onenter area event.
Let me know if you need more help. _________________________ Vuldrick Garrison
Posted by Vuldrick at 2006-09-04 07:46:00 Voted 10.00 on 08/06/06
Jargh193,
The location, unfortuneatly, can not be saved during the client leaving event. I tried this as my first approach to this system and learned the hard way that it will not work.
The reason for this is that the PC object no longer technically exists after the client leaves and so that event can not "see" their location. The work around I came up with is to use the code by hooking into the area onexit event. You could hook this into every area on exit, so that when the client exits they will fire off the area exit event to cause a save :) Luckily, the area exit event fires before the client leave event, so this works on my server quite well.
On my server, the location of a PC is saved each time they rest, use the save location tool, or exit an area. The last option keeps them honest in so far as they can't just save location in a safe spot, go to dangerous areas, then log off to avoid death and then come back after server reset to the safe spot.
The flexability of this system is tremendous, you just have to balance your server's needs with its capabilities.
I hope that answers your question, if not just let me know. _________________________ Vuldrick Garrison
Question, can I make it, and how would I, so that the location is saved on its own during client leaving and entering without using the stones, would like the players not to be able to choose to go back to a safer area if they log out somewhere dangerous, would also mean avoiding potential exploits.
Posted by Vuldrick at 2006-08-06 06:59:28 Voted 10.00 on 08/06/06
I thought I would vote to get the ball rolling a bit more here. I want to see what others think about the system . . . if you want enhancements or additions, etc.
Come on folks . . . "vote early and vote often" :) Let me know what you like and don't like please. _________________________ Vuldrick Garrison
Posted by puket at 2006-07-24 18:03:29 Voted 10.00 on 07/24/06
My Vote.
Posted by puket at 2006-07-24 18:01:26 Voted 10.00 on 07/24/06
I use these scripts in area_onenter in several cities in my PW-World. Possible to make it so that only one time the location is saved in one city. When a player is working in a city,let me say in a crafting house,every time he is walking in the city to another house he will get the message "location saved".
Another point is the restoration location after server reset to get the right Set_facing after teleport.
Let me say thank you very much for your script bundle.
Posted by Lanessar at 2006-02-13 21:37:09 Voted 10.00 on 02/13/06
Posted by Lanessar at 2006-02-13 21:36:51 Voted 10.00 on 02/13/06
I attempted to but to no avail. I still use the script though. _________________________ Lan's Placeable Groups v1.5
Posted by Vuldrick at 2006-01-25 03:56:35 Voted 10.00 on 08/06/06
If you actually get the NDBE version working from your converstion . . . perhaps you should post it for others :) _________________________ Vuldrick Garrison
Posted by Lanessar at 2006-01-23 12:09:02 Voted 10.00 on 02/13/06
You're a great scripter.
This was one function which taught me never to listen to "experts" who said "it cannot be done".
I converted this over for use in NDBE (from Knat) and it seems to work well (I have not tried between server resets, but will shortly).
I'll vote as soon as I give it the multiplayer acid test next week. _________________________ Lan's Placeable Groups v1.5
Posted by Vuldrick at 2006-01-22 07:22:09 Voted 10.00 on 08/06/06
Please give me some feedback/votes folks. Nothing is quite as discouraging as seeing a lot of downloads and no comments.
It tells people we are either perfect or we suck as scripters. _________________________ Vuldrick Garrison
Posted by Mauve at 2005-10-24 07:52:58 Voted 10.00 on 10/24/05
This is exactly what i was looking for, for my module :)
Good script
Posted by Vuldrick at 2005-08-03 13:51:57 Voted 10.00 on 08/06/06
I do it by making the item activation script not fire in areas of specific tags. It is done in the onitemactivation script.
As far as not saving in a rest cycle, just exclude the script changes in the onplayerrest module event.
I can probably make some sample scripts for you . . . but it will be a couple days most likely. Very busy for now in real life . . . sorry for any delay. _________________________ Vuldrick Garrison
Posted by Avatar of Pain at 2005-08-01 15:21:08 Voted 10.00 on 06/18/05
Hey there me again... can you send me the scripts required to make the variables and such for the module start area so that a player cannot save and it will not save when resting plz. Im not sure if I just suck at scripting, but I just cant get it to work on my own. My email is [email protected]. Thanks for noticing me hehe.
Posted by Vuldrick at 2005-06-30 21:10:01 Voted 10.00 on 08/06/06
Sorry it took so long to reply, but I have been very busy.
First off, thank you for actually voting . . . of the nearly three hundred people who have downloaded my code you are the only one that has taken time to vote :) At least I know all those people tried it and or use it and that is good enough.
Now to your questions . . .
I am not sure how the stone of recall works but if it is an item that uses an onactivate function then it should be no issue. Really about anything should work with my system since mine only saves locations and jumps you where you last saved via triggers or portal or whatever.
But again I dont know the code for the stone of recall. Give me a link and I will try to look at it and maybe even just fix it up for you.
So far as keeping a player from porting via a trigger by accident . . . maybe you should consider using a portal instead for the portaling. In my PW the PCs get jumped in a convo with an NPC and I don't use the trigger. There is a placeable object in my erf that is a portal . . . might do you better. _________________________ Vuldrick Garrison
Posted by Avatar ( 70.65.xxx.xxx ) at 2005-06-19 04:03:32
I voted by the way! I just can't get my post to show for some reason. Lol
Posted by Avatar ( 70.65.xxx.xxx ) at 2005-06-19 04:01:18
I am using this now in my module, is there anywa I can get this to work with the stone of recall? And is there anyway that I can make it so if the player just happens to walk over the trigger that rests over the start that they don't get teleported. I love this script, awesome work, easy to interpret and apply, and just what I needed in my PW. If there is a way to have recall as well could you either make a post here or send me an email with the right script so I can get this to function in my module without removing a bunch of stuff for my recall stone.
Posted by Avatar of Pain at 2005-06-18 23:45:55 Voted 10.00 on 06/18/05
Sorry, I actually read the rest of the commentts posted here. So I gave you a higher rating hehe... realized the true versatility of this download, still would like to know about recall stone.
Posted by Vuldrick at 2005-02-27 09:04:00 Voted 10.00 on 08/06/06
I had to revise this system a bit for my PW, Kingdom of Paramon, because I did not want my PCs to save in the start area. If they save in the start area then they dont ever have to go back to where they left off.
What I did is I made a trigger in the start area, that was as big as the start area. I made a script in the onenter event that set a local int on the PC. Then I modified the saving event in the on rest that checked if the int was on the PC. If the int is there, there is not save taking place. Finally, in the onexit of the trigger, I set the int on the PC back to zero so they can save after they get in the game.
I could supply you with the trigger and the altered save function if you need it. But it works nicely.Vuldrick Garrison _________________________ Vuldrick Garrison
Posted by Anonymous ( 24.168.xxx.xxx ) at 2005-02-25 08:08:00
I have this setup in my module and it is working but I have one problem.I am using the on rest save location and the trigger over the start location.It works fine unless I try to save in the start area in which case it warps me to an area I haven't been to thats no where near the start of the module.Do I have to use the trigger that came with the download?The area's are not linked and have seperate names.I changed the start area to a small inhospitable zone thinking no one would rest there.Then I tried to save in the old start area and it still warps me to the other area again.Yet the new start location can be saved at.Im extremely new to this if anyone could help it would be great.
Posted by Vuldrick at 2005-01-05 04:06:00 Voted 10.00 on 08/06/06
Glad you are finding the scripts useful. They are very dynamic in terms of easy modification for things you need . . .
In fact I do the same thing for mulitple subraces at my PW. You could also, as I do in my PW, call for deity, class, alignment, etc and spawn PCs in at the appropriate church or whatever for their first time joining the world. Very simple little additions all in all. And the good thing is that it still keeps their persistent location for their next login.
I have found though that I like to do the more complex routine like this via a conversation since it makes the checks very simple.
Thanks for showing everyone how to modify the code . . . should help some newer users.
Posted by Darkness_FallsDM ( 84.57.xxx.xxx ) at 2005-01-04 08:24:00
I love those scribts. We modiefied them a little as we want not only racial starting points we needed subrace starting ones. So i will submit the portal scribt with one subrace put in.
// Persistent start location portal . . . make a portal with this script onused in your area containing your start location
void main()
{
// This script pulls data for location and jumps PC to last save point
object oPC = GetLastUsedBy();
if(GetIsPC(oPC)||(GetIsDM(oPC) && !GetIsDMPossessed(oPC))) // Script will fire for PCs and DMs
{
string sPCName = GetName(oPC); // Gets the name of the PC
string CDKey = GetPCPublicCDKey(oPC); // Gets the public CD Key of the player . . . adds to quality of check
string sID = GetStringLeft(sPCName,10); // Indivudual Character Used
string sHID = sID+CDKey; // HCR Style user check
// Read Persistent Location Data
int nPlayerBeenHere = GetCampaignInt("PlayerStartLoc", "StartLocSet_" + sHID, oPC); // The check to see if PC has a saved location
int nAreaX = GetCampaignInt("PlayerStartLoc", "AreaX_" + sHID, oPC);
int nAreaY = GetCampaignInt("PlayerStartLoc", "AreaY_" + sHID, oPC);
int nAreaZ = GetCampaignInt("PlayerStartLoc", "AreaZ_" + sHID, oPC);
string sAreaName = GetCampaignString("PlayerStartLoc", "AreaName_" + sHID, oPC);
string sAreaTag = GetCampaignString("PlayerStartLoc", "AreaTag_"+ sHID, oPC);
// Set up the location from Database info
float y = IntToFloat(nAreaY);
float x = IntToFloat(nAreaX);
float z = IntToFloat(nAreaZ);
vector vTargetLoc = Vector(x, y, z);
location lTargetLoc = Location(GetArea(GetObjectByTag(sAreaTag)), vTargetLoc, 0.0);
if(nPlayerBeenHere == 1) // if the player has a saved location lets run this scripts
{
SendMessageToPC(oPC,"Portaling to your Saved Location in 3 Seconds...");
DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTargetLoc)));
}
else // Run this if there is no saved location . . .
// Create Waypoints in areas that you want certain races to jump to
// using the tags I indicated below.
{
if (GetRacialType(oPC)==RACIAL_TYPE_DWARF)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Dwar
f"),FALSE)));
}
string Drow = "Drow";
string drow = "drow";
if (GetRacialType(oPC)==RACIAL_TYPE_ELF)
{
string sSubrace = GetStringLowerCase(GetSubRace(oPC));
if ((sSubrace == Drow) || (sSubrace == drow))
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Drow
"),FALSE)));
}
else
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Elf"
),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_GNOME)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Gnom
e"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HALFELF)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Half
elf"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HALFLING)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Half
ling"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HALFORC)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Half
orc"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HUMAN)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Huma
n"),FALSE)));
}
}
}
}
WHat we did is we call a subrace. As we dont want the drow to go to the elven start location... that would be bad :D
So you can just replace the race and copy paste
Posted by Darkness_FallsDM ( 84.57.xxx.xxx ) at 2005-01-04 08:24:00
I love those scribts. We modiefied them a little as we want not only racial starting points we needed subrace starting ones. So i will submit the portal scribt with one subrace put in.
// Persistent start location portal . . . make a portal with this script onused in your area containing your start location
void main()
{
// This script pulls data for location and jumps PC to last save point
object oPC = GetLastUsedBy();
if(GetIsPC(oPC)||(GetIsDM(oPC) && !GetIsDMPossessed(oPC))) // Script will fire for PCs and DMs
{
string sPCName = GetName(oPC); // Gets the name of the PC
string CDKey = GetPCPublicCDKey(oPC); // Gets the public CD Key of the player . . . adds to quality of check
string sID = GetStringLeft(sPCName,10); // Indivudual Character Used
string sHID = sID+CDKey; // HCR Style user check
// Read Persistent Location Data
int nPlayerBeenHere = GetCampaignInt("PlayerStartLoc", "StartLocSet_" + sHID, oPC); // The check to see if PC has a saved location
int nAreaX = GetCampaignInt("PlayerStartLoc", "AreaX_" + sHID, oPC);
int nAreaY = GetCampaignInt("PlayerStartLoc", "AreaY_" + sHID, oPC);
int nAreaZ = GetCampaignInt("PlayerStartLoc", "AreaZ_" + sHID, oPC);
string sAreaName = GetCampaignString("PlayerStartLoc", "AreaName_" + sHID, oPC);
string sAreaTag = GetCampaignString("PlayerStartLoc", "AreaTag_"+ sHID, oPC);
// Set up the location from Database info
float y = IntToFloat(nAreaY);
float x = IntToFloat(nAreaX);
float z = IntToFloat(nAreaZ);
vector vTargetLoc = Vector(x, y, z);
location lTargetLoc = Location(GetArea(GetObjectByTag(sAreaTag)), vTargetLoc, 0.0);
if(nPlayerBeenHere == 1) // if the player has a saved location lets run this scripts
{
SendMessageToPC(oPC,"Portaling to your Saved Location in 3 Seconds...");
DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTargetLoc)));
}
else // Run this if there is no saved location . . .
// Create Waypoints in areas that you want certain races to jump to
// using the tags I indicated below.
{
if (GetRacialType(oPC)==RACIAL_TYPE_DWARF)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Dwar
f"),FALSE)));
}
string Drow = "Drow";
string drow = "drow";
if (GetRacialType(oPC)==RACIAL_TYPE_ELF)
{
string sSubrace = GetStringLowerCase(GetSubRace(oPC));
if ((sSubrace == Drow) || (sSubrace == drow))
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Drow
"),FALSE)));
}
else
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Elf"
),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_GNOME)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Gnom
e"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HALFELF)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Half
elf"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HALFLING)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Half
ling"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HALFORC)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Half
orc"),FALSE)));
}
if (GetRacialType(oPC)==RACIAL_TYPE_HUMAN)
{
SendMessageToPC(oPC,"Portaling to your homeland in 3 Seconds...");
DelayCommand(3.0,AssignCommand(oPC,ActionJumpToObject(GetObjectByTag("Start_Huma
n"),FALSE)));
}
}
}
}
WHat we did is we call a subrace. As we dont want the drow to go to the elven start location... that would be bad :D
So you can just replace the race and copy paste
Posted by Vuldrick at 2004-12-09 15:47:00 Voted 10.00 on 08/06/06
The scripts are not just drag and drop so to speak. You must make sure you define the PC using the object declarations at the top of the scripts correctly.
I have an erf in the package with the trigger and portal etc premade so you dont have to worry about it . . . if you use them.
Sounds like you are trying to save the PC location via triggers for each area which should work. But saving the location does not put them back where they were. You must also read the location when they come back and place them where they were.
Also, the loc_jump script will not work in the onclient enter script. The PC object is not useable as it is not fully loaded into the area onclient enter. You must use the script in a portal or trigger or an area onenter script.
I have this setup working in my module perfectly well . . . so I am certain that the reason you are having difficulty is due to improper use of the scripts.
Check out the demo module for proper useVuldrick Garrison _________________________ Vuldrick Garrison
Posted by puket ( 213.54.xxx.xxx ) at 2004-12-07 16:31:00
There is a big problem with this location saving.I placed some triggers with area_loc_saving in my Cities (online mod)
If a player is leaving a city and goes further in the mod some areas and he logs out and log back in the still running module he will be allways transported back to this city area location saving.I'm not using a portal on client_enter.The loc_jump script is in the module on_client_enter.So I must say it is not very flexible for me.
Posted by Vuldrick at 2004-12-01 20:12:00 Voted 10.00 on 08/06/06
Okay, just to be on the safe side, and to take concerns about database issues after resave . . .
I went ahead and modified the scripts to save the area tag and vector for the PC into the database.
Should not be an issue now for sure.
Thanks for the thoughts . . . let me know if this seems better.Vuldrick Garrison _________________________ Vuldrick Garrison