.createnpc error

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.

Moderator: POL Developer

Post Reply
roquettedu
New User
Posts: 6
Joined: Wed Jul 28, 2010 4:24 pm

.createnpc error

Post by roquettedu »

I have on POL95 here and when i try to create a npc like: .createnpc horse and click on somewhere occurs one error:

NPC Creation Failed:
Parameter 4 bust be a Struct or Integer (0) , got Struct

What does it means, someone knows how can i fix it ?
Basara
Novice Poster
Posts: 47
Joined: Fri Oct 13, 2006 6:37 am
Location: UK

Re: .createnpc error

Post by Basara »

post part or all of your createnpc script?
roquettedu
New User
Posts: 6
Joined: Wed Jul 28, 2010 4:24 pm

Re: .createnpc error

Post by roquettedu »

Code: Select all

use uo;
Use cfgfile;
Use file;

Include "include/time";

program textcmd_createnpc( who, template )

	if( !template )
		SendSysMessage( who, "Usage is .createnpc <template>" );
		return;
	endif

	var props := struct;
	props.+facing := who.facing;
	var loc := TargetCoordinates(who);

	var result := CreateNpcFromTemplate( template, loc.x, loc.y, loc.z, props );
	if( !result )
	SendSysMessage( who, "NPC Creation Failed: " + result.errortext );
    else
    LogEditing( Who, result );
	endif

endprogram

Function LogEditing( Who, Npc )

    If( !Who || !Npc )
    Return 0;
    Endif

    Var TEXT_Logged := Array;
    Var Seconds := PolCore().SysTime;
    Var Date := GetDateString( Seconds ) + " :: " + GetTimeString( Seconds );

    TEXT_Logged.Append( "Created " + Date );
    TEXT_Logged.Append( "Staff    " + Who.name + " [" + Hex( Who.serial ) + "] - [" + Who.ip + "]" );
    TEXT_Logged.Append( "NPC      " + Npc.name + " [" + Hex( Npc.serial ) + "]" );
    TEXT_Logged.Append( "Location " + Npc.x + " " + Npc.y + " " + Npc.z );
    TEXT_Logged.Append( "" );
    TEXT_Logged.Append( "" );

    AppendToFile( "data/logging/Created_NPCs.txt", TEXT_Logged );

    Return 1;

Endfunction
zed
New User
Posts: 4
Joined: Thu Jun 24, 2010 4:25 am
Location: Poland / Warsaw

Re: .createnpc error

Post by zed »

var props := struct;
props.+facing := who.facing;

check:

var props array;
props.+facing := who.facing;
User avatar
andenixa
Grandmaster Poster
Posts: 105
Joined: Tue Nov 09, 2010 1:33 am

Re: .createnpc error

Post by andenixa »

I am having a similar error in my npc creation script:

var props := struct;
props.+facing := who.facing;
var result := CreateNpcFromTemplate( template, loc.x, loc.y, loc.z, props );

Resulting in SysMsg:
Parameter 4 bust be a Struct or Integer (0) , got Struct


As a side note I think all rabid people who do:

var something array;

Should be put down before they actually hurt someone.

Along with those who discovered and armed the array/struct aberration without consent.
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Re: .createnpc error

Post by Austin »

andenixa wrote:I am having a similar error in my npc creation script:
Should be put down before they actually hurt someone.

Along with those who discovered and armed the array/struct aberration without consent.

Same for those still using POL 095... That thing is like 9 years old!
User avatar
andenixa
Grandmaster Poster
Posts: 105
Joined: Tue Nov 09, 2010 1:33 am

Re: .createnpc error

Post by andenixa »

I appreciate your answer and fully aware of the fact that most of those are probably fixed in new cores. But its next thing to impossible to leap for a new core if your script-base is 9 years old unless you're are up for a total rewrite which just isn't feasible.
Post Reply