Override properties for CreateItem* functions

Archive of the older Feature Request Forum Posts

Moderator: POL Developer

Locked
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am
Location: Myrtle Beach, South Carolina

Override properties for CreateItem* functions

Post by MontuZ »

Just like;
CreateNpcFromTemplate( template, x, y, z, override_properties := 0, realm := _DEFAULT_REALM)

Only for items.
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post by ncrsn »

You can already.

Get item's info using GetItemDescriptor(objtype / objtypename) and change values in it before creating the item.

Code: Select all

var objtype := OBJTYPE_AXE; // 3907
var descriptor := GetItemDescriptor(objtype);
print(descriptor);
descriptor.color := COLOR_RED;

// Results a red axe.
CreateItemInBackpack(who, descriptor, 1);
Overriding the values in struct is sometimes a bit hard (cprops...), but it is doable. Also note that r/o values cannot be changed (weight).
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am
Location: Myrtle Beach, South Carolina

Post by MontuZ »

Locked