CreateNpcFromTemplate - problem with override_properties

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.
Post Reply
dr_bliss
New User
Posts: 20
Joined: Mon Aug 07, 2006 2:02 am

CreateNpcFromTemplate - problem with override_properties

Post by dr_bliss »

This is a few lines of my script's source code:

Code: Select all

    var mnoznik:= RandomInt(GetEffectiveSkill(who, SKILLID_NECROMANCY) - NpcResist)/100;
    if(mnoznik<=0)
        mnoznik:=0.01;
    endif
    var newStats:=newStatistics(npcConfigElem,mnoznik);
    var creature:=CreateNpcFromTemplate(template, trup.x, trup.y, trup.z, [b]newStats[/b]);
    print(creature);
newStatistics function code:

Code: Select all

function newStatistics(npc,m)
    var newStat:= struct;
    newStat.+Color:=1109; newStat.+trueColor:=1109;
    newStat.+STR:=Cint(m*npc.STR); newStat.+INT:=Cint(m*npc.INT); newStat.+DEX:=Cint(m*npc.DEX);
    return newStat;
endfunction
The returned newStat is correct (its struct, for example:
NewStat: struct{ Color = 1109, DEX = 70, INT = 10, STR = 18, trueColor = 1109 } )

And as a "creature" is returned error:

Code: Select all

error{ errortext = "Parameter 4 must be a Struct or Integer(0), got Struct" }
Its very strange and I dont know what is wrong, because I've never tried to use override_properties... I know how to create NPC with changed stats in other way, but i will prefer to do this using ovverride_properties parameter for CreateNpcFromTemlate() command.

Please, help me a little...

Thanks in advance.
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

In this line:

Code: Select all

var creature:=CreateNpcFromTemplate(template, trup.x, trup.y, trup.z, [b]newStats[/b]); 
there are the brackets and the b and /b inside of them. I assume that was intended to bold the text for the purpose of this post and that those don't exist in your script.
dr_bliss
New User
Posts: 20
Joined: Mon Aug 07, 2006 2:02 am

Post by dr_bliss »

I assume that was intended to bold the text for the purpose of this post and that those don't exist in your script.
Yes, of course.
Zgryt
New User
Posts: 19
Joined: Wed Sep 20, 2006 11:53 am

Post by Zgryt »

I have the same problem... Did you do something with that? Is there any way to make that work?
coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am

Post by coltain »

If You use 095 try putting an array instead struct

a struct type (as I recall) is needed for 097
Post Reply