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 ?
.createnpc error
Moderator: POL Developer
Re: .createnpc error
post part or all of your createnpc script?
-
- New User
- Posts: 6
- Joined: Wed Jul 28, 2010 4:24 pm
Re: .createnpc error
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
Re: .createnpc error
var props := struct;
props.+facing := who.facing;
check:
var props array;
props.+facing := who.facing;
props.+facing := who.facing;
check:
var props array;
props.+facing := who.facing;
Re: .createnpc error
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.
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.
Re: .createnpc error
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!
Re: .createnpc error
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.