lfnetwork.com mark read register faq members calendar

Thread: Scripting: Is this Possible?
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 12-30-2011, 07:55 PM   #1
harIII
Veteran
 
harIII's Avatar
 
Join Date: Feb 2008
Posts: 983
Helpful! 
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.
harIII is offline   you may: quote & reply,
Old 12-30-2011, 10:02 PM   #2
Fastmaniac
Rookie
 
Fastmaniac's Avatar
 
Join Date: Aug 2009
Location: Germany
Posts: 164
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
Fastmaniac is offline   you may: quote & reply,
Old 12-31-2011, 12:56 AM   #3
JCarter426
Senior Member
 
JCarter426's Avatar
 
Join Date: Feb 2008
Location: Look to your left.
Posts: 1,635
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.


JCarter426 is offline   you may: quote & reply,
Old 12-31-2011, 01:24 PM   #4
Fastmaniac
Rookie
 
Fastmaniac's Avatar
 
Join Date: Aug 2009
Location: Germany
Posts: 164
Yep, that's better than my suggestion... I always think too complex...
Fastmaniac is offline   you may: quote & reply,
Old 01-03-2012, 05:48 PM   #5
harIII
Veteran
 
harIII's Avatar
 
Join Date: Feb 2008
Posts: 983
Helpful! 
Quote:
Originally Posted by JCarter426 View Post
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.
harIII is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > Knights of the Old Republic > Editing / Modding > Holowan Laboratories > Scripting: Is this Possible?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:17 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.