View Full Version : Burning Men


Megaman1986
Wed, 18th Dec '02, 7:25pm
I was on this server called "Kathra's Temple", and inside the temple, men couldn't sit on chairs without getting burned.
How did they do that?
Is it also possible to lock doors, and only make them open for a specific gender, or a specific PERSON?

[ December 19, 2002, 11:52: Message edited by: Taluntain ]

Mithrandir
Wed, 18th Dec '02, 11:09pm
Not to sure but I think in the scripts there is a command to check for gender and then do different things depending on what it gets as an answer. (eg: males, burn them. females, do nothing)

Megaman1986
Thu, 19th Dec '02, 12:46pm
But can doors be locked except for specific persons?
Oh, and when I make a door that requires a key, I can't seem to relock it ingame, which results in people wandering about areas I don't want them in.

Mithrandir
Thu, 19th Dec '02, 3:58pm
For the door thing I think you have to turn on relockable (or something like that)in proporties. :)

Megaman1986
Thu, 19th Dec '02, 4:41pm
I did, but even then I couldn't relock it succesfully.

Zorac
Fri, 20th Dec '02, 4:11pm
Making it work for only a specific person isn't harder than doing it for a specific gender/whatever.

And why not let the door autolock when it is closed?

Megaman1986
Fri, 20th Dec '02, 5:16pm
'Cuz I am a big fat n00b that doesn't know how to do such things.

Errol
Fri, 20th Dec '02, 6:16pm
Well, since non of these people have given you any scripts, i thought I would.

Here's the script to make a door shut itself after 5 seconds. Stick it in the OnOpen script slot in the door.

void main()
{
object oDoor = GetObjectByTag(OBJECT_SELF);
DelayCommand(5.0, ActionCloseDoor(oDoor));
SetLocked(oDoor, TRUE);
}I'll explain it here for you, so you can do this yourself in future, ok?

void main()
This is the header of all scripts (nearly). It basically tells us that the script does something.

object oDoor = GetObjectByTag(OBJECT_SELF);
This line means that when you say: oDoor, is the same as saying: GetObjectByTag(OBJECT_SELF). So whenever you say "oDoor", you actually mean the object the script is assigned to.

DelayCommand(5.0, ActionCloseDoor(oDoor));
This tells the script to wait 5 Seconds, then do the Action: Close Door. The line then refers to the door to close in brackets, which happens to be "oDoor". oDoor actually means the object the script is assigned to remember?
This means that you can put this script in any door, and it will work, instead of putting the name of your door in loads of different scripts.

SetLocked(oDoor, TRUE);
This line says that after having closed the door after 5 seconds, it is set as Locked. You then refer to what object to set as locked, and in this case it's "oDoor" again. I then tell it that this command is TRUE. If it was FALSE, the door would remain unlocked.

------------

I hope that script serves you well for closing and locking your door. :)
To make doors openable by a specific gender, you need to modify the OnOpen script to say that the door should only open, if its a Female or Male opening it. This is possible, but maybe I'll tell you another time. (ie. I don't know, and can't be bothered to find that out)

Hope the script's ok.
Goph:)

Mark Nelson
Sat, 21st Dec '02, 3:37am
Well trying this script my self I get a declaration error on this line:
object oDoor = GetObjectByTag(OBJECT_SELF);
Maybe it is something that I am doing wrong but I copied and pasted it from the above to an ONOpen file that I made called onopen1. So what is wrong with the script that it won't compile?


:confused: :confused:

Megaman1986
Sat, 21st Dec '02, 8:11am
I tried the script...
Sorry, didn't work.
The door didn't close on itself, and when I closed it, it remained unlocked.

Zorac
Sat, 21st Dec '02, 8:15am
The OnOpen is run by the door so it is probably enough to skip the 'object oDoor...' line and just substitute oDoor with OBJECT_SELF in the rest of the script.

You get an error because GetObjectByTag takes a string as argument.

Megaman1986
Sat, 21st Dec '02, 8:23am
I have no idea what you just said... :confused:
All I know is that something everybody can do, is something I suck at.
I WANT MY DOORS TO CLOSE!
Stupid doors...

PS: I also need a script that tells an NPC to undress, can someone tell me what script I need for that?

[ December 21, 2002, 08:42: Message edited by: Megaman1986 ]

Zorac
Sat, 21st Dec '02, 8:46am
Ok, lets keep this simple and take it one step at a time.

void main()
{
DelayCommand(10.0, ActionCloseDoor(OBJECT_SELF));
}Attach this as the doors OnOpen script. It will close the door by itself 10s after you opened it.

Capt. Tripps
Sat, 21st Dec '02, 8:51am
You do need a string for GetObjectByTag. Just rewrite the command as object oDoor = GetObectByTag("yourdoorstag"); subsitute the tag for your door in "yourdoorstag" (you must put it between the quotation marks)and the script should work.

[ December 21, 2002, 08:54: Message edited by: Capt. Tripps ]

Megaman1986
Sat, 21st Dec '02, 9:22am
Ah, now it works.
OK, next problem: making seats.
How do I do that?
If I just put in a chair, I can't sit on it.
And I can't find a 'seat' placeable.

Zorac
Sat, 21st Dec '02, 9:58am
You need to attach a script to the OnUsed slot on the chair. I think the script should look something like this:
void main ()
{
AssignCommand (GetLastUsedBy (), ActionSit (OBJECT_SELF));
}
Haven't got my disc handy so I can't test at the moment.

[ December 21, 2002, 09:58: Message edited by: Zorac ]

Capt. Tripps
Sat, 21st Dec '02, 10:05am
I could have sworn we posted these scripts just a couple of weeks ago. Anyway in the OnUsed script for an usable chair: void main()
{
object oChair = OBJECT_SELF;
if(!GetIsObjectValid(GetSittingCreature(oChair)))
{
AssignCommand(GetLastUsedBy(), ActionSit(oChair));
}
} The if command makes sure no-one else is sitting in the chair first.

Errol
Sat, 21st Dec '02, 2:26pm
OK, could I just ask; Are you making a PW? Because if you are, then boy, get a scripting guide. :rolleyes

Megaman1986
Sat, 21st Dec '02, 2:55pm
PW?

Errol
Sat, 21st Dec '02, 3:31pm
Persistent World.
No matter, here's the revised version of the Script for Closing and locking doors.


void main()
{
DelayCommand(5.0, ActionCloseDoor(OBJECT_SELF));
SetLocked(OBJECT_SELF, 1);
}
Stick it in the OnOpen script for the door, it will close after 5 seconds and lock itself.

Megaman1986
Sat, 21st Dec '02, 3:38pm
One thing: If you scroll back a bit, you'll see me saying that I got the doors working.
My current problem is to make furniture you can actually sit on.

Errol
Sat, 21st Dec '02, 3:42pm
Look man, i've told you, Get a scripting guide. There are loads here on SP!

Anyway, here we go:


void main()
{
object oChair=OBJECT_SELF;
AssignCommand(GetLastUsedBy(),ActionSit(oChair));
}
Stick it in the OnUsed on the chair. Make sure the chair is checked USABLE.
Anyone who clicks on it will sit on it.

Thorin
Sat, 21st Dec '02, 4:43pm
Megaman1986 stop reposting questions people have already answered! You already started a topic on how to make people sit!
http://www.sorcerers.net/cgi-bin/ultimatebb.cgi?ubb=get_topic;f=17;t=000128

Megaman1986
Sat, 21st Dec '02, 11:32pm
I am not talking about NPC's, boy!
I am talking about chairs PC's can sit on!
(I've solved that problem too, by the way).

Hmmm... can I make items made for a specific module work on mine? Like the Emote Wand from Kathra's Temple (anyone ever been on that server)?

Errol
Sun, 22nd Dec '02, 9:14pm
Look, for 3rd time; get a scripting guide. Yes, you can do that, just import the item IIRC.

By the way, that sitting script works for BOTH NPC's and PC's, basically. And Thorin there could outscript you anyday... "boy".

Goph

Megaman1986
Mon, 23rd Dec '02, 7:03am
Where to get a scripting guide... Hmm...
I'll start looking then.

Errol
Mon, 23rd Dec '02, 12:28pm
Thorin's already given you One link. NWVault does a lot, and Sorcerer's Place (http://www.sorcerers.net) does a lot more too!

[ December 23, 2002, 22:10: Message edited by: Gopher ]

Megaman1986
Tue, 24th Dec '02, 8:08am
Ah, OK.

I have another question (please don't shoot me).
Is it possible to take the (visual) effect from the TimeStop spell, and put them in your module as if they were a placeable?

Errol
Sat, 28th Dec '02, 4:24pm
You would make an Invisible Object, then assigna script to it to make it repeat the Time Stop animation, but I don't know how to script it.

Thorin
Sat, 28th Dec '02, 8:05pm
Ok since i am not currently running nwn i cannot give you the exact code. but this should lead you in the right direction

void main() {
object oTarget = GetObjectByTag("Waypoint1");
//Create the new visual effect
effect eDur = EffectVisualEffect (VFX for timestop);
//Apply the effect
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDur, oTarget);

you could place this in a trigger or the on-enter part of the area