||04-22-2013 10:35 PM
If I wanted to destroy a placeable and replace it with another in the exact same spot how would I go about doing it?
||04-22-2013 10:50 PM
You'd have code that looks something like this:
object oOrigPlac = GetObjectByTag("TAG OF PLACEABLE"); //This is your original placeable, the one you're destroying.
location lOPlac = GetLocation(oOrigPlac); //This is the location of that original placeable.
DestroyObject(oOrigPlac); //Destroys the original placeable.
CreateObject(OBJECT_TYPE_PLACEABLE, "TEMPLATE RES REF OF NEW PLACEABLE", lOPlac); //Creates the new placeable where the old one was.
Now that's assuming you don't have the original placeable's coordinates in the beginning. In all honesty it'd be best to just have the original placeable's coordinates, to reduce glitches/weird things going on that might occur with trying to grab the original placeable's location and use it to spawn the new one when the original has been destroyed. So, if you had the coordinates, the script would look like this:
object oOrigPlac = GetObjectByTag("TAG OF PLACEABLE");
vector PlacPosition = Vector(333.33, 333.33, 333.33);
location lOPlac = Location(PlacPosition, 234.44);
CreateObject(OBJECT_TYPE_PLACEABLE, "TEMPLATE RES REF OF NEW PLACEABLE", lOPlac);
The green 333.33 triplets are the place where your X, Y and Z coordinates of the placeable would go. The red 234.44 is the angle orientation of that placeable.
||04-23-2013 09:01 PM
Or if it gets spawned on a waypoint, just usse it's tag.
Just a note of warning, destroying items and placing them at the same time will mess up the location. The destroyed one still "resides" so the new isn't in the exact same spot but slightly pushed aside to a 'free' position.
So you'll have to delay the spawn. DelayCommand or ActionWait wont work, so there's;
1) Using a delayed ActionPauseConversation (only in conversations)
2) Delaying another script being triggered which adds the new placeable.
|All times are GMT -4. The time now is 09:23 AM.
Powered by vBulletin®
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
LFNetwork, LLC ©2002-2011 - All rights reserved.