My last 2 script to "end" the module [HELP]
MorganZ
Member Posts: 17
Hello, I've almost finished my module (with a lot of help from the community members of this forum! special thanks to ForSerious).
Now I'am missing just a couple of scripts!
The first one is a persistance script to record just the position and the hp of charcaters, I've tried this one I've found on the vault with no luck: https://neverwintervault.org/project/nwn1/script/easy-persistent-locations
The second one is a script to destroy a placeble conteiners if a player places specific item in it (I want player to be able to destroy a rock and open a passage revealing a transition if they craft a specific item and then "use it" on the rock).
Thanks for reading, hope you can help me!
Now I'am missing just a couple of scripts!
The first one is a persistance script to record just the position and the hp of charcaters, I've tried this one I've found on the vault with no luck: https://neverwintervault.org/project/nwn1/script/easy-persistent-locations
The second one is a script to destroy a placeble conteiners if a player places specific item in it (I want player to be able to destroy a rock and open a passage revealing a transition if they craft a specific item and then "use it" on the rock).
Thanks for reading, hope you can help me!
0
Comments
I have scripts for the location and HP. (The location doesn't always work though. I know how to make it work, just haven't done it yet.)
For the second thing, it sounds conflicting. Are they going to use the crafted item on the rock, or place the item in the inventory of the rock? Both are possible.
I agree that this needs some clarification but it sounds entirely doable.
Does this pseudocode roughly sound like what you're going for?
thanks!
You need a way to have unique identifiers for players. I like to use the tag of the player. By default it's empty.
Here's the include script to make unique tags for players: This script will be called database_stuff in all the other scripts.
Next we have the OnExit script. Though you can use this in the area OnExit, don't. Put it in the module OnExit script.
Sorry if any of these don't compile right away. I just took them from what I have and edited out all the parts you don't need. I'm also sorry if you thought it was going to be easy.
So the easiest option for the exploding obstacle, is to place an item in the inventory.
I put this script in the OnClosed slot.
teatv apk
I've been using Set/GetCampaignLocation for a few months, and quite randomly it saves a random placeable object instead of an area object. My code above, has not had that issue... yet.
In the server I used to play on most, it was heavily recommended protocol to re-log your character after transferring items to them. The reason being that if the server crashed, you wouldn't lose your gear. It would have saved the character that just lost the gear, but not saved the one that just picked it up. Not sure on the exact timings, but the server only saves characters to disc like once every half hour or so, unless they log off.
Because of that, I try to save critical things to the database, and lesser things to the PC Properties skin. (Like settings the player can change.)
A location is made of three things.
1) The coordinate of the location
2) The Facing/rotation of the location
3) The area of the location - saved by objectID.
The issue comes that ObjectID is not a permanent assignation, but instead simply counts from 0-up every time the module is loaded. The first object (the module) gets objectID0, the next object loaded (the first area) gets 1, next object 2 etc.etc.etc
This makes it naturally volatile. If any changes are made to the area list, the order in which they load will change, which means different objectIDs, which means the location no longer makes sense.
Most persistence functions instead save the three components above themselves, usually using the area Tag instead of ObjectID to resolve the abovementioned issue.
That's what I use in my location scripting, works beautifully IF the module hasn't changed, e.g. I've edited the module, and that's where locations suddenly go bad...