The TurnToward( obj) function crashes UOx3 when an invalid object is selected.
An easy work around is to just put an If statement infront of the function to only fire it if the target is a valid item or NPC.
It is easily repeatable. Set up a function where a GM can select a target for the TurnToward. Select a piece of dirt on the map, UOx3 will crash.
While probably not a serious issue, functions like WalkTo, TextMessage, Follow, etc, just print a waring in Uox3 that says "blah blah blah is an invalid object." or "TextMessage contains no valid <whatever>"
I have never seen Uox3 crash when a bad object type is sent to a function, so I thought I'd post this.
Keep up the good work!
[FIXED] TurnTowrd function crashed UOx3.
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
A crash fix is always a good thing, but take a leaf from the book of other commands, and do something like this for avoiding the crash:
Code: Select all
function onCallback0( socket, ourObj)
{
if( !socket.GetWord( 1 ) && ourObj.isChar )
{
socket.tempObj = ourObj;
socket.CustomTarget(1, "Select location");
}
else
socket.SysMessage8 "You must target a character!" );
}-= Ho Eyo He Hum =-