POL98 Error ??

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 098.

Moderator: POL Developer

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

POL98 Error ??

Post by roquettedu » Sat Jul 31, 2010 9:47 am

I have on POL98 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 ?


Here is the .createnpc script:

Code: Select all

use uo;
use cfgfile;
use basic;

///////////////////////////////////////////////////////////
// Purpose: Custom function to create NPCs from a package
// or otherwise.
// Params: Same as CreateNpcFromTemplate() core function.
// Returns: npc Ref to mobile object.
///////////////////////////////////////////////////////////
function CreateNpc(template, x, y, z, props := 0)
//template := CreateTemplateName(template);
var npc := CreateNpcFromTemplate(template, x, y, z, props);
return npc;
endfunction

///////////////////////////////////////////////////////////
// Purpose: Find the package that the NPC is in.
// Params: template Template name of npc.
// Returns: template Template name containing package.
///////////////////////////////////////////////////////////
function CreateTemplateName(template)
var cfg;
foreach pkgname in (polcore().packages)
cfg := ReadConfigFile(":" + pkgname + ":npcdesc");
if (cfg)
if (FindConfigElem(cfg, template))
return ":" + pkgname + ":" + template;
endif
endif
endforeach

// Not in a package, try config/npcdesc.cfg.
return template;
endfunction

///////////////////////////////////////////////////////////
// Purpose: Returns the template name without package prefix.
// Params: pkgtemplate Npc template name.
// Returns: template Bare template name.
///////////////////////////////////////////////////////////
function TemplateName(pkgtemplate)
var start := find(pkgtemplate, ":", 2) + 1;
if (!start)
return pkgtemplate;
endif

return pkgtemplate[start, len(pkgtemplate)];
endfunction
and there is another one, i dunno which i need to show u

Code: Select all

use uo;


program textcmd_createnpc( who, template )

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

var forbidden := GetGlobalProperty( "ForbiddenTemplates" );
if( !forbidden )
forbidden := array;
endif

foreach monstername in forbidden
if(lower(monstername)== lower(template))
SendSysMessage( who, "This npc type is forbidden, you aren't allowed to create it." );
return;
endif
endforeach

var props array;
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 );
endif

endprogram

Post Reply