Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Scipt not compiling?

Page: 1 of 1
 Canderis
11-30-2008, 8:13 PM
#1
Again ive needed to ask for help on scripting. The script ive made dosent work. It wont compile. Can you guys see the error?
void main()
{
object oEntering = GetEnteringObject();
object oPC=GetFirstPC();
if (GetIsPC(oEntering))
{
//check if the object is already there to avoid multiple objects
if (!GetIsObjectValid(GetObjectByTag("o")))
{
CreateObject(OBJECT_TYPE_PLACEABLE, "hawkx", Location(Vector(58.25,50.77,1.80),3.04));

ExecuteScript("old_k_003ebo_enter", OBJECT_SELF);
} do you guys see anything wrong with it?
 Det. Bart Lasiter
11-30-2008, 9:01 PM
#2
You left out some closing braces.

void main() { // <1>
object oEntering = GetEnteringObject();
object oPC = GetFirstPC();

if(GetIsPC(oEntering) && !(GetIsObjectValid(GetObjectByTag("o")))) { // <2>
CreateObject(OBJECT_TYPE_PLACEABLE, "hawkx", Location(Vector(58.25, 50.77, 1.80), 3.04));
ExecuteScript("old_k_003ebo_enter", OBJECT_SELF);
} // </2>
} // </1>
 Canderis
11-30-2008, 9:27 PM
#3
Thanks it worked! One last script question:
What would I need to add to that script to check to see if the object is already there? This is an on enter script so i need to make it so that it dosent appear every time I enter the ebon hawk. How would I do that?
 Star Admiral
11-30-2008, 9:38 PM
#4
void main() {

object oEntering = GetEnteringObject();
object oPC = GetFirstPC();

if(GetIsPC(oEntering) && !(GetIsObjectValid(GetObjectByTag("hawkx")))) {
CreateObject(OBJECT_TYPE_PLACEABLE, "hawkx", Location(Vector(58.25, 50.77, 1.80), 3.04));
}

ExecuteScript("old_k_003ebo_enter", OBJECT_SELF);

}

Nothing new needs to be added to the script to check if the object is there, just replace the "o" in GetObjectByTag("o") with the tag of your placeable, as in the above example.

Oh, and you should keep the ExecuteScript for the old onenter script outside the if statement, because you want to fire all the time, not just when the if statement is true.

- Star Admiral
 Canderis
11-30-2008, 9:46 PM
#5
Thanks Star Sdmiral!
Page: 1 of 1