harIII Posted December 31, 2011 Share Posted December 31, 2011 I have a really cool idea for part of Yavin in my Shadows of the Empire mod but I'm not sure how to go about doing it. Here's what I need the script to do: 1. Get the location of an NPC in the area (I can do that, the next part is where I get lost) 2. Create three different references for the individual X, Y, and Z coordinates 3. Do this next step five times A - Spawn an invisible placeable at coordinates from the above references at X, Y, and (Z + 3) B - Spawn placeable at (X + 3), Y, and Z C - Spawn placeable at (X - 3), Y, and Z D - Spawn placeable at X, (Y + 3), and Z E - Spawn placeable at X, (Y - 3), and Z This is what I can't figure out, how do I add units to the prerecorded coordinates? Yell at me if this doesn't make sense and you're trying to help. Link to comment Share on other sites More sharing options...
Fastmaniac Posted December 31, 2011 Share Posted December 31, 2011 Well, I can help you with the 3rd step. Assuming you have defined x,y and z-coordinates you can create a loop with a variable i that runs 5 times with spawning the placeables and increasing the variable i by 1. Simplified structure: define x = (X-Coordinate); define y = (Y-Coordinate); define z = (Z-Coordinate); define i = 0; function(){ if (i< 5){ (Spawn... change x,y,z; increase i by 1; execute function) else return}} Note: It's NOT a finished script. Just an impulse for you I don't have time right now, but if I've confused you more than you already are, just say so and I'll try to reexplain what I mean or look into it tomorrow (depending on whether you want to do it by yourself). I don't know yet how it looks like in the scripting language and since it's not possible to use another language, I'll have to look into it aswell... Fastmaniac Link to comment Share on other sites More sharing options...
JCarter426 Posted December 31, 2011 Share Posted December 31, 2011 Something like this should work: void main() { vector vector0 = GetPosition(oObject); vector vector1 = Vector(0.0, 0.0, 3.0); vector vector2 = Vector(3.0, 0.0, 0.0); vector vector3 = Vector(-3.0, 0.0, 0.0); vector vector4 = Vector(0.0, 3.0, 0.0); vector vector5 = Vector(0.0, -3.0, 0.0); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector1, 0.0), sTemplate, FALSE); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector2, 0.0), sTemplate, FALSE); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector3, 0.0), sTemplate, FALSE); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector4, 0.0), sTemplate, FALSE); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector5, 0.0), sTemplate, FALSE); } Just define oObject and sTemplate - although you may want to create multiple placeables and give them all different tags to keep track of them more easily, in which case you need more than one string. Link to comment Share on other sites More sharing options...
Fastmaniac Posted December 31, 2011 Share Posted December 31, 2011 Yep, that's better than my suggestion... I always think too complex... Link to comment Share on other sites More sharing options...
harIII Posted January 3, 2012 Author Share Posted January 3, 2012 Something like this should work: void main() { vector vector0 = GetPosition(oObject); vector vector1 = Vector(0.0, 0.0, 3.0); vector vector2 = Vector(3.0, 0.0, 0.0); vector vector3 = Vector(-3.0, 0.0, 0.0); vector vector4 = Vector(0.0, 3.0, 0.0); vector vector5 = Vector(0.0, -3.0, 0.0); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector1, 0.0), sTemplate, FALSE); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector2, 0.0), sTemplate, FALSE); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector3, 0.0), sTemplate, FALSE); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector4, 0.0), sTemplate, FALSE); CreateObject(OBJECT_TYPE_PLACEABLE, Location(vector0 + vector5, 0.0), sTemplate, FALSE); } Just define oObject and sTemplate - although you may want to create multiple placeables and give them all different tags to keep track of them more easily, in which case you need more than one string. Thanks for throwing this out there I'll give it a try later on tonight. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.