Author Topic: Can I use a script to spawn a door?  (Read 444 times)

Legacy_Tyndrel

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +0/-0
Can I use a script to spawn a door?
« on: March 19, 2013, 11:25:11 am »


               I have a building placeable that only spawns whan approached, it seems (from experimentation and the Lexicon) that I cannot use the same function (CreateObject) to spawn a door.  Is there some way to do this? 

':unsure:'
               
               

               
            

Legacy_Rolo Kipp

  • Hero Member
  • *****
  • Posts: 4349
  • Karma: +0/-0
Can I use a script to spawn a door?
« Reply #1 on: March 19, 2013, 02:13:57 pm »


               <musing...>

While I can't think of any way to script a proper door, I can think of a way to fake it.

This would requie a placeable, preferable animated door and a placeable SAM.
You'd have to calculate the position and facing of each (perhaps using a waypoint pair - one for the building and one offset for the door/SAM).

When the door is activated (opened), spawn in the SAM. When the SAM is clicked on, transition.

<...aloud>
               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
Can I use a script to spawn a door?
« Reply #2 on: March 19, 2013, 02:16:03 pm »


               No, spawning a door is not possible.

However, you can spawn one of the several door placeables with either the standard 'secret door' script attached to it in its OnUsed event, or create your own script on a custom door placeable. I'm not sure what your building placeable looks like so the placeable door may not completely cover the door entrance, and there will be a little work involved to get the placeable door setup correctly so it moves the people who use it to where you want.
               
               

               
            

Legacy_Tyndrel

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +0/-0
Can I use a script to spawn a door?
« Reply #3 on: March 19, 2013, 04:20:55 pm »


               Thanks folks, I used a placeable door to calculate the exact position for the waypoint, I'll just have to use a placeable door for the actual spawn too. Back to the drawing board.  '<img'>
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Can I use a script to spawn a door?
« Reply #4 on: March 20, 2013, 02:12:09 am »


               Ooooor ... depending on the scene you're setting up, you could use an actual door and just cover it with a larger placeable to hide/disguise it. Then, when you spawn in your hidden building, destroy the obscurring placeable to reveal the door as well. Of course, the door existing might give away where to look when a player is "mousing" around the map "looking" for stuff to find.
               
               

               
            

Legacy_Tyndrel

  • Sr. Member
  • ****
  • Posts: 313
  • Karma: +0/-0
Can I use a script to spawn a door?
« Reply #5 on: March 20, 2013, 08:18:00 am »


               I'm using the NwN 2 building placeables, converted by The George, to make a "Ghost village". The destroyed buildings are spawned in the area "OnEnter" but if a player approaches a building they enter a trigger that changes it into it's non-destroyed counterpart. I was just surprised to find that the "CreateObject" function didn't work with door object types.  It was always going to be tricky to make it function just like a normal area, I'll just have to make it as close as I can but choosing to enter a building that you know wasn't there a moment before probably shouldn't be that normal anyway. 
':huh:'
               
               

               
            

Legacy_Failed.Bard

  • Hero Member
  • *****
  • Posts: 1409
  • Karma: +0/-0
Can I use a script to spawn a door?
« Reply #6 on: March 20, 2013, 12:56:19 pm »


               Can you copy doors?  That might allow storing prefab doors in a DM area, then copying them to the new location, if possible.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Can I use a script to spawn a door?
« Reply #7 on: March 20, 2013, 10:41:54 pm »


               Has anyone tried applying cutscene invisibility to a door? You could leave it open, then shut it and strip the effect, depending on your specific needs for the Ghost Village. Haven't tried, so may not work. Just spitballin'.

Funky