Is it possible to add new stats to a mob? I was thinking of many different ways, but none would work. Could someone tell me if this is even possible? If not, i think it should really be added as a proc or something.
-Rcet
ID:149891
Jan 31 2002, 1:12 pm
|
|
Rcet wrote:
Is it possible to add new stats to a mob? Sort of. You can, but you'd have to predict all new stats in the code... for example, you could have an event in the game that triggers yourself to become a vampire, and you want to have a "Hunger" stat added to your statistics panel. You could do an if statement such as if(vampire), then do the new stats in there. Here's an example. mob That should work good. I hope this answers your question. |
Rcet wrote:
Is it possible to add new stats to a mob? Yes. Use an associative list. mob var list/MyStats = list() proc // These procs aren't needed to access MyStats, but they demonstrate the idea well. SetStat(StatName as text, value) MyStats[StatName] = value CheckStat(StatName as text) if(StatName in MyStats) return MyStats[StatName] else // no stat of that name return null RemoveStat(StatName as text) MyStats -= StatName Stat() ..() if(statpanel("My Stats")) for(var/stat in MyStats) stat("[stat]:",MyStats[stat]) |
In response to Shadowdarke
|
|
// These procs aren't needed to access MyStats OOP would disagree! ;-) |
You cannot add variables at run time, at least it doesnt seem possible in programming at all to me.
When you compile, you are compiling every possibility in the game that can happen, no matter what. There is no way to add things to the game's source at run time, and adding variables would do just that.
FIREking