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?
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>
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?
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