Ok, it must be something a bit backward-awkward-compatible, but here is something I just thought of:
Using the obj.archetype table as a metatable for the instance exvar[id] table:
For each base dsb function that looks for info into an instance's archetype, INSTEAD look for the same info in the exvar[id] table.
So that the info is not lost or copied every time, for each instance that is spawned or qswapped, do: set metatable of "exvar[id]" to be "obj.arch"
I hope I make sense. That would allow some very interesting stuff to be done quite easily.
Lua obj manipulation for hardco(re)der
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Lua obj manipulation for hardco(re)der
I'm assuming the goal of this is to be able to override a certain arch property for a given instance without having to create a whole new arch just to change that one thing, right?
That is, you could set the mass of one individual "rock" to be 5.0kg, or whatever.
That is, you could set the mass of one individual "rock" to be 5.0kg, or whatever.
Re: Lua obj manipulation for hardco(re)der
Yes, or not bother specify different archetypes for each "torch level", discharged spell_casting_item etc.
It would also be useful for monsters and other unpredictable application of this.
But I agree it would probably require a lot of work and break backward compatibility with some dsb-lua code.
It would also be useful for monsters and other unpredictable application of this.
But I agree it would probably require a lot of work and break backward compatibility with some dsb-lua code.
What Is Your Quest ?
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Lua obj manipulation for hardco(re)der
For things like torch level, it's kind of tricky because certain arch properties-- such as the icon used-- are cached by the engine for speed and ease of access, so this method wouldn't work without a whole big mess.
Re: Lua obj manipulation for hardco(re)der
Don't bother, I'm just thinking out loud and leaving my ideas there on the forum,
so that they don't turn round and round in my head like a gold fish in ... grey matter ?
so that they don't turn round and round in my head like a gold fish in ... grey matter ?
What Is Your Quest ?