Page 1 of 1

Adding a door

Posted: Sat Jul 03, 2004 8:51 pm
by Nighthawk4
I am trying to add a door to the side of a large tree.

I add the Doorway - I tried various different ones - the result is the same for all of them.

I make the doorway useable, but when I click on it, the door does not open.

Also, there does not seem to be any way to add a Transition from this doorway to the other door.

I assume it needs a custom script - I don't have a clue how to do that.

Also, how do I add it to the side of a tree without it either sticking out in mid-air or being hidden by part of the tree?

Any help please? :?

Posted: Sat Jul 03, 2004 8:58 pm
by Cymbolism
Hehe, I have a script, it was developed by Sindol, it is to be used in the Green Tower if approved by Psycho, but he hasn't got the mod yet :wink:
void main()
{
// the user is identified
object oUser = GetLastUsedBy();

// reads the tag from the trapdoor
string sDoorTag = GetTag(OBJECT_SELF);

// find the destination, determined from the tag of the trapdoor
object oDest = GetWaypointByTag(sDoorTag + "_Destination");

// make sure the trapdoor is NOT locked or nothing will happen
if (!GetLocked(OBJECT_SELF))
{
if (GetIsOpen(OBJECT_SELF))// if open: jump user and close again
{
AssignCommand(oUser, JumpToObject(oDest,FALSE));
PlayAnimation(ANIMATION_PLACEABLE_CLOSE );
}
else // if closed: open
{
PlayAnimation(ANIMATION_PLACEABLE_OPEN );
}
}
}
put it on used and it links to a waypoint named <tag of object>_Destination

EDIT: you might notice it mentions a trapdoor. That's what I wanted if for originally, but have also used it for doors.

Posted: Sat Jul 03, 2004 10:22 pm
by Aloro
Even better: use the script I wrote called "door_onused". You'll need to create a waypoint for the destination (e.g. WP_MyDestination), then lay down the door. Add a string variable to the door called sDestination, and give as the value the Tag of the Waypoint. So in this case, you'd make a variable for the door called sDestination (string) = WP_MyDestination. Put the script "door_onused" in the door's OnUsed event handler.

I am 100% certain this script exists on the Le'Or server, and the Wilderness as well. I don't recall if I ever exported it for import to the other modules.

Dang, I really need to document all these utility scripts I've been writing for my own use. ;)

- Aloro

Posted: Sun Jul 04, 2004 5:45 pm
by Nighthawk4
Thanks guys, I used the one suggested by Cymbolism.

It works fine :lol:

Posted: Sun Jul 04, 2004 5:50 pm
by Sindol
Cymbolism better switch to the one Aloro uses though. It's no use importing another script that does the same as an existing script basically. That's like reinventing the wheel.

Would be nice if you could dump some of those utility scripts in the scripting library Aloro. Not that it takes much time to write such simple things, but it's still time better spent on something else. :wink:

Posted: Sun Jul 04, 2004 5:53 pm
by Cymbolism
Yes, I have just been searching to see if it was posted in here already but can't find it.
Can you please post it up Aloro so I can test it in the Mod before submission? Cheers :D

Posted: Sun Jul 04, 2004 7:36 pm
by Aloro
Cymbolism wrote:Yes, I have just been searching to see if it was posted in here already but can't find it.
Can you please post it up Aloro so I can test it in the Mod before submission? Cheers :D
Yep, sorry, I'll try to put a few of those in the library today. :)

- Aloro

Posted: Sun Jul 04, 2004 7:42 pm
by Cymbolism
Thanks heaps - You tha man :D