Groups

Include ginc_groups to see a number script used for working with group of creatures.

Recently DaveyHavock asked a question about how to use groups to create an onDeath event.

Howdy, wondering if someone has a moment to explain how the custom group ondeath script is used. I guess what i dont understand is how to name the grp, i see it uses getgroupname, but how do i define what the group is?

Kaldor Silverwand  provided a good response with an example script:

The first meeting with Neeshka makes use of groups in this way.

The functions you'll need are are in ginc_group.

Here is a bit of script that I have used for having a few halfling NPC's put into a group and then a script is started once they are dead.

Here's the code he posted. Remember to include ginc_groups. Change the group name and tags, then attach this on a dialog action and you're good to go!

	string sGroupName = "HalflingBrothers";
object oNHalfling;
int i;
ResetGroup(sGroupName);
for (i = 1; i<=3; i++)
{
object oNHalfling = GetObjectByTag("NHalfling" + IntToString(i));
GroupAddMember(sGroupName, oNHalfling);
ChangeToStandardFaction(oNHalfling, STANDARD_FACTION_HOSTILE);
StandardAttack(oNHalfling, GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR,PLAYER_CHAR_IS_PC));
}
GroupOnDeathExecuteCustomScript(sGroupName, "0160_a_cs_halfling_postfight");
 

See the full thread here:
http://nwn2forums.bioware.com/forums/viewtopic.html?topic=646321&forum=1...