A member wich returns a list of all the creatures tamed by characters [creature.setmaster(who)];
It would be usefull when characters lose their creatures and we need to give them a reference for release them or whatever
New member: who.minions
- Core Essence
- Neophyte Poster
- Posts: 38
- Joined: Tue Feb 07, 2006 10:40 am
- Core Essence
- Neophyte Poster
- Posts: 38
- Joined: Tue Feb 07, 2006 10:40 am
- Core Essence
- Neophyte Poster
- Posts: 38
- Joined: Tue Feb 07, 2006 10:40 am
-
Marilla
Why is it 'cleaner'? A dozen reasons:
First, is this: Who is to say that anyone really wants -all- NPCs that have had npc.SetMaster(who); called to show up on who.minions? I know I use .SetMaster() on NPCs that I would never want to show up in my lists of pets or other such NPCs. I also have NPCs that have NOT had .SetMaster() called show up on some such lists. A scripted system lets me control exactly how and what shows up on what lists - and lets me easily create separate lists with separate criteria for inclusion, in fact.. making the scripted system much 'cleaner'.
Oh.. and the other thing that makes the scripted system 'clean' is that I have a single include file that handles all of the registering, unregistering and listing of NPCs, for all the various groups.
This, incidentally, was one reason I had recently requested method scripts for mobiles, including PCs; So that a custom implementation of adding, removing and listing NPCs could be tied directly to the PC instance, rather than in an include file. But in the meantime, the include works fine, too.
First, is this: Who is to say that anyone really wants -all- NPCs that have had npc.SetMaster(who); called to show up on who.minions? I know I use .SetMaster() on NPCs that I would never want to show up in my lists of pets or other such NPCs. I also have NPCs that have NOT had .SetMaster() called show up on some such lists. A scripted system lets me control exactly how and what shows up on what lists - and lets me easily create separate lists with separate criteria for inclusion, in fact.. making the scripted system much 'cleaner'.
Oh.. and the other thing that makes the scripted system 'clean' is that I have a single include file that handles all of the registering, unregistering and listing of NPCs, for all the various groups.
Code: Select all
function RegisterNPC(npc, master, type)
var npcs := GetObjProperty(master, "#npcs_"+type);
...etc... add/verify the NPC on the list...
endfunction
function UnRegisterNPC(npc, master, type)
var npcs := GetObjProperty(master, "#npcs_"+type);
...etc... Remove the NPC from the list...
endfunction
function ListRegisteredNPCs(master, type)
var npcs := GetObjProperty(master, "#npcs_"+type);
...etc... verify each NPC still exists, then list it...
endfunction