Page 1 of 1

Crash without a trace [Solved]

Posted: Sat May 23, 2009 11:40 pm
by Tourny
I'm trying to make a controlled teleport (whether or not somebody already is doesn't matter much to me). The system is basically you enter the region of a panel and it will activate the appropriate teleport region. Before I could get it to turn on, but not off, and there were too many errors so I started over. Now whenever I enter the region, it crashes. When I look in the error log, it makes no reference to the crash and doesn't really acknowledge that anything happened out of the ordinary. The PC_Mungelog also does not report any errors.

Here is my function:

Code: Select all

OnEnterRegion(
   function(region,character)
      if GetEntityName(region) == ("tombcastle_panel") then
         ActivateRegion("tombcastle")
      end
   end,
"tombcastle_panel"
)
The "ActivateRegion" command for the region is up higher in the PostLoad section.

I also have a question that would help eliminate the panel region entirely:

If I use OnObjectKill for the panel, and that activates the teleport region,

then I have a region at the other end that turns off the region and puts the panel back,

If I use OnLeaveRegion> RespawnObject, will that make the panel come back to life?

EDIT: I put the function in code format so it represented the tabs correctly.


EDIT2
(Sorry about double post)

Ok, so I got it to not crash, but the teleport region doesn't turn on.

Code: Select all

Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: bad argument #2 to `OnEnterRegion' (string expected, got no value)
stack traceback:
	[C]: in function `OnEnterRegion'
	(none): in function `ScriptPostLoad'
IS the error.

Code: Select all

ActivateRegion("tombcastle_panel")

OnEnterRegion(
function(regIn,character)
MoveEntityToNode(character,"tombcastle_node")
end,
"tombcastle"
)

OnEnterRegion(
   function(region,character)
      if GetEntityName(region) == ("tombcastle_panel") then
         ActivateRegion("tombcastle")
      end
   end
)

end
Is my script.

Re: Crash without a trace

Posted: Sun May 24, 2009 3:56 pm
by Fiodis
Try going the OnObjectDamage way you described above. I can't think of anything wrong with your script offhand, except that maybe

Code: Select all

      if GetEntityName(region) == ("tombcastle_panel")
should be

Code: Select all

      if GetEntityName(region) == "tombcastle_panel"
(No parentheses around "tombcastle_panel")

Just a hunch, though.

Re: Crash without a trace

Posted: Sun May 24, 2009 4:07 pm
by Tourny
Hmm....

EDIT: I got it to work. Thanks guys.