|
|
 |
12-30-2011, 07:55 PM
|
#1
|
|
Veteran
Join Date: Feb 2008
Posts: 924
|
Scripting: Is this Possible?
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.
|
|
you may:
quote & reply,
|
12-30-2011, 10:02 PM
|
#2
|
|
Rookie
Join Date: Aug 2009
Location: Germany
Posts: 157
Current Game: KotOR, Warframe
|
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:
Code:
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
|
|
you may:
quote & reply,
|
12-31-2011, 12:56 AM
|
#3
|
|
Senior Member
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,565
|
Something like this should work:
Code:
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.
|
|
you may:
quote & reply,
|
12-31-2011, 01:24 PM
|
#4
|
|
Rookie
Join Date: Aug 2009
Location: Germany
Posts: 157
Current Game: KotOR, Warframe
|
Yep, that's better than my suggestion... I always think too complex...
|
|
you may:
quote & reply,
|
01-03-2012, 05:48 PM
|
#5
|
|
Veteran
Join Date: Feb 2008
Posts: 924
|
Quote:
Originally Posted by JCarter426
Something like this should work:
Code:
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.
|
|
you may:
quote & reply,
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Forum Jump
|
|
|
|
|
|