help adding a single ego to a weapon
Posted: Sat May 02, 2015 3:37 pm
does anyone have an idea of how i can add a single ego to a weapon in code?
i have pre-generated an item with
o = game.zone:makeEntity(game.level, "object", filter, nil, true)
and after some checks it decides how good the item is and its at this point i need to add an ego from the newEntity egos list.
i cant use the built in chance of prefix=n and suffix=n in newEntity because i need to be able to add quite a few if the weapon is rolled as a Rare(1-3prefix,1-3suffix but name is random generated) and slightly more complex weighted chance of 25% chance of prefix, 25% chance of both, 50% chance of a suffix if the item is deemed a Magic item.
i did find this which might be what im after so if you know how to use it let me know.
game.zone:applyEgo(e, ego, type, no_name_change)
i just need a way of getting a single ego onto a weapon perhaps you have a better idea and any info will be a big help then i can work out adding more
i have pre-generated an item with
o = game.zone:makeEntity(game.level, "object", filter, nil, true)
and after some checks it decides how good the item is and its at this point i need to add an ego from the newEntity egos list.
i cant use the built in chance of prefix=n and suffix=n in newEntity because i need to be able to add quite a few if the weapon is rolled as a Rare(1-3prefix,1-3suffix but name is random generated) and slightly more complex weighted chance of 25% chance of prefix, 25% chance of both, 50% chance of a suffix if the item is deemed a Magic item.
i did find this which might be what im after so if you know how to use it let me know.
game.zone:applyEgo(e, ego, type, no_name_change)
i just need a way of getting a single ego onto a weapon perhaps you have a better idea and any info will be a big help then i can work out adding more