Aller au contenu

Photo

Getting errors with script...


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
MammonTheViscount

MammonTheViscount
  • Members
  • 35 messages
My script is as follows:

void main(){ object oPC = GetEnteringObject(); //Gets the object that just entered the area if(!GetIsPC(oPC)) return;
if(GetIsSkillSuccessful(oPC, SKILL_SEARCH, 15)) { object oCabinet = GetObjectByTag("ShrineOfPelorWall"); location lCabinet = GetLocation(oCabinet); SetLocalLocation( oWall, location lWall  = GetLocation(oCabinet), string sWall = "sWall", ); DestroyObject(oCabinet); }}

Lines 16 and 17 return with "unknown state in compiler" errors...

I'm trying to destroy an object, but before it's destroyed save its location to a local variable that can be called by another script to recreate the object.

What am I doing wrong with it?

Basically i put a wall in front of a secret door that will disappear when a search check is made, but make the wall reappear when the door is closed (to keep the door hidden).

Any thoughts?

Modifié par MammonTheViscount, 24 juillet 2010 - 12:35 .


#2
MammonTheViscount

MammonTheViscount
  • Members
  • 35 messages
guess posting takes out the formatting.... here it is on pastebin.



http://pastebin.com/vtisLmdA

#3
MammonTheViscount

MammonTheViscount
  • Members
  • 35 messages
actually got the script to compile by changing the code to:http://pastebin.com/3xRWxbEK



guess now i have to go and create the create script to put on the door "on close"...

#4
MammonTheViscount

MammonTheViscount
  • Members
  • 35 messages
alright, well now i'm having trouble getting the create script to compile... got an error on line 3 that says "unknown state in compiler"



http://pastebin.com/8PY9x8rK



any help would be appreciated...

#5
Freeze01

Freeze01
  • Members
  • 12 messages
AFAIK

It should just be CreateObject (....);



But by looking at it your script is a bit circular... and you might want completely change it. You base the location where the object is to be placed on the object you want to place at a certain location.

#6
.Lv

.Lv
  • Members
  • 6 messages
The script posted there : http://pastebin.com/3xRWxbEK should not compile. As for deleting an object but storing its location before, you can simply store his location on the module :

if(GetIsSkillSuccessful(oPC, SKILL_SEARCH, 15))
{
   // Get the wall object
   object wall = GetObjectByTag("ShrineOfPelorWall");

   // Get its location
   location loc = GetLocation(wall);

   // Store it on the module
   SetLocalLocation(GetModule(), "!SavedLocation");

   // Delete the wall object
   DestroyObject(wall);
}



Then you can just get it like that :

void main()
{
   // Get the stored location
   location loc = GetLocalLocation(GetModule(), "!SavedLocation");

   // Recreate the wall
   object wall = CreateObject(OBJECT_TYPE_PLACEABLE, "sopwall", loc);
}


Hope it helps you.

Edit: Is there no code tag here ? :/

Modifié par .Lv, 24 juillet 2010 - 11:53 .


#7
LeeMer47

LeeMer47
  • Members
  • 111 messages
Even if the script compiles there may be problems. The door will cause a door transition cursor to appear from an angle (not forward). If the cabinet is static and baked, removing it won't allow you to move up to the door, the bake will remain. I would not have the door there until right before you destroy the cabinet. Make the door, destroy the cabinet. This keeps the door from causing a door cursor to appear over the wall it is attached to.



Also, you can get the x, y and z coordinates of the cabinet from the properties of the cabinet, so why script it? Just put the coordinates in the script for making a new cabinet. And for the door if you choose to create it later.

#8
MammonTheViscount

MammonTheViscount
  • Members
  • 35 messages
i actually got it all working, but i don't know what changes i made to the code as i'm not there at the moment, but i appreciate all the input :-)



LeeMer47 the cabinet actually isn't static, but does have collision turned on so people can't walk through it. The whole thing was scripted out so it could be generalized and put into a script that could be used on several similar objects/circumstances. Just kinda my own twist on hidden doors.