PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
CreateNpcFromTemplate - problem with override_properties

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095)
Display posts from previous:   

Author Message
dr_bliss



Joined: 07 Aug 2006
Posts: 20
Location: Poland -->Torun ->my room ->my computer

PostPosted: Thu Feb 08, 2007 3:08 pm    Post subject: CreateNpcFromTemplate - problem with override_properties Reply with quote

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

Code:

    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:

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:

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.

Author Message
Yukiko



Joined: 02 Feb 2006
Posts: 1080
Location: Southern Central USA

PostPosted: Thu Feb 08, 2007 4:42 pm    Post subject: Reply with quote

In this line:
Code:
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.

Author Message
dr_bliss



Joined: 07 Aug 2006
Posts: 20
Location: Poland -->Torun ->my room ->my computer

PostPosted: Fri Feb 09, 2007 6:55 am    Post subject: Reply with quote

Quote:

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.

Author Message
Zgryt



Joined: 20 Sep 2006
Posts: 12

PostPosted: Thu Dec 27, 2007 7:57 am    Post subject: Reply with quote

I have the same problem... Did you do something with that? Is there any way to make that work?

Author Message
coltain



Joined: 20 Mar 2007
Posts: 87
Location: Poland

PostPosted: Thu Dec 27, 2007 11:09 am    Post subject: Reply with quote

If You use 095 try putting an array instead struct

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

Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095) All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty