Jacob's Self-Righting Sittable Placeables This is a work-around for the bug that breaks sittables when a player logs out while sitting, or when a creature is limboed while sitting. This script runs in the OnUsed event for a usable placeable, and in the OnDeath event for the same placeable (for cleanup). It DOES NOT run in the OnHeartbeat event so it will not slow your server down! Lovely. Zip file contains an erf with example sittables that are ready to go. Or if you want to create your own custom items, just attach the jh_sit_onused to the OnUsed event and the jh_sit_ondeath to the OnDath event for any usable placeable. Then make an invisible object with Blueprint ResRef 'sittingsurface' (if you didn't import it from the erf file). Voila! It's that easy. No more broken chairs when players log out.
One last note about the directions regarding setting the
Appearance attribute to "invisible object". I searched through the lists of both 'Appearance' and 'Appearance (special effect)' but couldn't find any option for "invisible object" specifically. Perhaps that option was taken out in one of their recent patches, so you may want to specify what the exact option is now. Thanks again.
Regards
Disregard on the "On Used Script" question I asked. The scroll of the code box above threw me off. Confirmed that it's two scripts together and one belongs in "OnUsed" and the other is "OnDeath". Thanks.
Thank you for posting the script code so that new people like myself can see how it works. In messing around with the toolset, I tried to follow your instructions to the letter but there is no honest way to do so as they are written. If this script is for people just starting out, you might want to detail your instructions a bit more. For example:
"Just create a custom placeable, name it sitting surface" -- Where is this name supposed to go in the Properties window? I see Localized Description, Localized Name, Tag, etc. Is there someplace specific it needs to go?
"Make sure the Blueprint ResRef is 'sittingsurface' (no spaces)." -- Where is this done? I looked through the entire Properties window and could find no reference to 'ResRef'.
Additionally, is this script to be placed into the 'On Used Script' section?
Thank you very much for the clarification.
Regards.
Posted by Darius Blackthorne ( 68.51.xxx.xxx ) at 2004-09-17 14:13:00
Well for the uneducated masses such as myself..you made this real easy to understand. I had just got this game and when I saw the possibilities for creation I dove right in but scripting stopped me dead cold. At least now there are DL's that I can work with. Thanks again.
Posted by Maeglin ( 212.238.xxx.xxx ) at 2004-05-05 14:58:00
At the JH_SIT_ONDEATH script, there seems to be missing the ClearAllActions(); function to make the player stand up again. Or else you get something like an invisible wheel-chair thingie. (You can run around the area while sitting)
This works for me:
void main() {
// Get this object.
object oChair = OBJECT_SELF;
// If this object is valid.
if(GetIsObjectValid(oChair)) {
// Get attached object variable named "sittingsurface".
object oSurf = GetLocalObject(oChair, "SIT_SURF");
// if attached sitting surface is valid
if( GetIsObjectValid(oSurf)) {
// destroy it.
object oPC = GetSittingCreature(oSurf);
Posted by Maeglin ( 212.238.xxx.xxx ) at 2004-05-05 14:57:00
At the JH_SIT_ONDEATH script, there seems to be missing the ClearAllActions(); function to make the player stand up again. Or else you get something like an invisible wheel-chair thingie. (You can run around the area while sitting)
This works for me:
void main() {
// Get this object.
object oChair = OBJECT_SELF;
// If this object is valid.
if(GetIsObjectValid(oChair)) {
// Get attached object variable named "sittingsurface".
object oSurf = GetLocalObject(oChair, "SIT_SURF");
// if attached sitting surface is valid
if( GetIsObjectValid(oSurf)) {
// destroy it.
object oPC = GetSittingCreature(oSurf);
This is a compilation of the old system into a single score. There were 10 that made this score of 9.80 then rounded to 10.
Posted by H3g3m0n ( ..xxx.xxx ) at 2003-10-27 00:42:00
Usefull little script, saved me the hassle of making one and running into all those bugs =)
A usefull feature might be to have the ability to have 2 people on the larger benches although it would be somwhat more complex as you would need to shift the location of the sittable object off center etc...
Also if you create an Invisible Object with the script you can have people sit on rocks outside or on those chairs that are part of the tilesets, Using this method it is probally possible to fake the 2 people on one bench. =)
Posted by Bainsy ( ..xxx.xxx ) at 2003-08-12 07:00:00
nice script but seems alittle big i have chairs that dont break after a logout and its 5 lines or 6 mail me if you want it
Posted by Ranot ( ..xxx.xxx ) at 2003-07-30 01:40:00
glad to see someone found use from my original, as for why I used heartbeats it was much easier and the lag issue does not occur from localized heartbeats.. it's a pity so many people are against them when they are extremely useful if used properly.
Posted by Jakob Lightbringer ( ..xxx.xxx ) at 2003-07-21 14:00:00
Hopefully BIOWARE will fix the vector sitting problem and I can just take the zeroing out. However, until that happens, I just can't think of any way to sit on a chair that is sitting high up on a ledge or bridge with another valid area under it. The invisible sitting surface will "drop" to the lowest valid location. Sorry.
Luckily NWN has very few areas that overlap each other like that, though.
Posted by Jakob Lightbringer ( ..xxx.xxx ) at 2003-07-21 13:51:00
Luckily, my sitting surfaces (the thing you are sitting on with a 0.0z vector) are invisible, so you wouldn't be able to see them vanishing under the floor anyway. The visible chair that you click on doesn't vanish (or break), because they are never even sat on.
Posted by Ana ( ..xxx.xxx ) at 2003-07-09 02:30:00
Hello, again!
:) This is great, even works with the issues I mentioned in my post below.
That's because of the saving as a local object, (which I did not see between all the comments in your script, erm) , so the original sittable relates to the local object "surface", even if the latter is below ground, now.
Tested this with city elevation and rural elevation.
Only odd thing is, when I have a char sitting on a newly created sittingsurface which is below ground (e.g. the bench I used is above a cave entrance), that char ends up in the cave entrance when she gets up, since the object she sat on is down there, now (z=0.0).
Anyways, this is great work, and I will even get it to work with two seats per bench and all, thanks a lot, Jacob! :)
Have fun,
Ana
Posted by Ana ( ..xxx.xxx ) at 2003-07-09 00:55:00
Hello!
This works great, we use a variant of this script on our server.
Unfortunately these seat vanish under the floor when placed on a tile with a ground level above 0.0, so the chair set to z=0.0 gets created under the floor and is unreachable. Making it appear a bit higher by setting z to a higher value makes users facing east, again.
Just a hint, if you watched your seats vanishing without any clue where they might have gone...
Otherwise, great thing, this script.
Have fun,
Ana
Posted by Bainsy ( ..xxx.xxx ) at 2003-05-02 01:44:00
Iv been playin around with chairs that dont break for sometime now trying to get it to work and yay i managed to do it if u would like to see the script email me its very small and easy to use i destroys any chair u sit on and makes a new one in its place so unless u didnt know what it was doing u wouldnt even notice :) works 100% tested for every thinkable bug and no probs
Posted by WulfRider ( ..xxx.xxx ) at 2003-03-08 11:03:00
Greetings,
I always had trouble using 'artificial sitting surfaces'
because they wouldnt face in the right direction. So it's
just a simple matter of height?
You learn somethign new every day :)
I had a play around and it even works with placing
invisible objects on top of things like parts of the
scenery (since the script zero's the sitting surface
anyway).
Nicely done.
Posted by hi ( ..xxx.xxx ) at 2003-03-01 19:08:00
i need to know if the direction of the sittable can be
corrected coz invisible object have east facing on since
the engine cant detect invis objects
Posted by Jakob Lightbringer ( ..xxx.xxx ) at 2003-03-01 00:13:00
Okay, I found a bug that occurs in NWN version 1.28, if a
player logs out while sitting in a chair and then logs
back in and tries to sit in the same chair. NWN thinks
the player is still sitting there and won't let them sit.
The fix was simple, I added a condition so that if a
player tries to sit in a chair that they are already
sitting in, it will let them. Voila! Perfecto!
Posted by Jakob Lightbringer ( ..xxx.xxx ) at 2003-02-18 21:11:00
I think the problem is that BIOWARE's code sets a special
(and unaccessable) flag when you sit on a chair to
indicate that nobody can sit in it. However, if somebody
logs out or gets limbo'ed while they are sitting in the
chair, the flag never gets reset.
I wish they would fix it (it seems like a bug to me).
But as it stands, the chair is quite simply broken
forever, no matter what.
By the way, Kudos to Ranot who came up with the marvelous
idea of using invisible objects on top of chairs!
Posted by Iris Osiris ( ..xxx.xxx ) at 2003-02-14 17:05:00
Ah! Silly me... I get it now, it's perfect. Pardon the
mistake but I'm pretty tired tonight. And before I ask, I
should import the sample placeables and work out myself
which tags and names etc to change.
*grin* great stuff.
Posted by Iris Osiris ( ..xxx.xxx ) at 2003-02-14 16:53:00
If only a version of this script was made using the actual
objects and not invisible sitting surfaces... there's
nothing wrong with sitting on a chair, why is it made so
much more complicated...?
Still, it looks a fantastic script. Just don't know what
names to change to make it work.
Posted by Jakob Lightbringer ( ..xxx.xxx ) at 2003-01-28 08:13:00
Oh, thank you so much for the great script, Jakob! I'm
your biggest fan!
Thank you, me.
You must be Logged In to post comments in this section.