Author Topic: Lever to swap placeables back and forth  (Read 401 times)

Legacy_Tonden_Ockay

  • Hero Member
  • *****
  • Posts: 891
  • Karma: +0/-0
Lever to swap placeables back and forth
« on: January 19, 2016, 06:31:04 pm »


               

Hi


 


I'm using Project Q and it has two city gates one with the gate up and one with the gate down. I would like to have a script that would destroy one and spawn the other in its place. The idea is when ever the leave is switched that the placeables would swap out making it look as the city gate is oping and closing.


 


I was going to try and use NWN Script Generator LS-TK



/*
* Script generated by LS Script Generator, v.TK.0
*
* For download info, please visit:
* http://nwvault.ign.com/View.php?view=Other.Detail&id=1502
*/
// Put this script OnUsed.


void main()
{
object oTarget;
object oSpawn;

// Get the creature who triggered this event.
object oPC = GetLastUsedBy();

// Destroy an object (not fully effective until this script ends).
DestroyObject(GetObjectByTag("Gateup001"));

// Spawn "gatedown001".
oTarget = GetWaypointByTag("city gate");
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "gatedown001", GetLocation(oTarget));
}


but as you can tell I soon realized that the script I wanted to make was a little advanced for the script generator.


 


I was reading on the net that I would need to put two versions of the placeable at the same location (copy/paste the coordinates from one to the other to be sure) and set one as static, the other as not static.


 


Is there already a script on the web that I could use? If so could someone point it out to me?



               
               

               
            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
Lever to swap placeables back and forth
« Reply #1 on: January 19, 2016, 07:22:25 pm »


               

Hi
 
I'm using Project Q and it has two city gates one with the gate up and one with the gate down. I would like to have a script that would destroy one and spawn the other in its place. The idea is when ever the leave is switched that the placeables would swap out making it look as the city gate is oping and closing.


If it is the same city gate, it should just be one placeable with animations for opening or closing it.
You can script something like what you want, but it won't look good when one gate is replaced by another. It would look far better if it were just one placeable which has the animations needed to open and close it.
               
               

               
            

Legacy_Tonden_Ockay

  • Hero Member
  • *****
  • Posts: 891
  • Karma: +0/-0
Lever to swap placeables back and forth
« Reply #2 on: January 19, 2016, 10:02:05 pm »


               

Thanks Zwerkules


 


Project Q has two placeables


 


[Q]City Wall: Gate, Open


[Q]City Wall: Gate, Closed


 


but the "Initial State" option is grayed out and you can't click on it, I'm guessing they don't have animations. 



               
               

               
            

Legacy_Proleric

  • Hero Member
  • *****
  • Posts: 1750
  • Karma: +0/-0
Lever to swap placeables back and forth
« Reply #3 on: January 19, 2016, 11:34:34 pm »


               Have you tried putting a door in the placeable doorway? The trick is to paint the door in a tileset  doorway, Adjust Location in the left-hand palette, then delete the tileset doorway.


Failing that, are there no animated door placeables you could use? In CEP, perhaps? CEP has a script which also handles walkability.


If you really need to toggle the two placeables, paint them both at the same location, with Static unchecked. Apply the cutscene invisibility VFX to one. Use the lever to toggle the vfx onto the other. The "movement" is instantaneous, whereas create/destroy fades in and out. Caveat : owing to a vfx bug, vfx must not be applied until a player enters the area, and must be removed when the last player leaves the area. I can provide examples if need be.