Author Topic: If In Party Condition  (Read 438 times)

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
If In Party Condition
« on: August 01, 2012, 01:09:11 am »


               We recently implemented a change to Clerics, breaking them out into three separate classes via domain edits (they may only choose one of our specialized domains), and altering their spell selections based on said domains; Healing (all the heals, mass heals, greater restoration, and ressurection), Death (all the insta-death spells, implosion, et al), and war (divine power, battletide...battle buff spells).  We feel that this reduces Clerics from being "Jack-of-all-Trades" engines of destruction, and forces them, based on their RP, to choose a domain to specialize in.

However, on our PW we have Greater Santuary (GS) nerfed to avoid abuse; i.e.
using it as a free invisibilty check to wander through dungeons.  It lasts 3 rounds, and cannot be cast again until after a ten minute cool down; we do this in a spellhook script.

Sadly, this has the unintended side effect of placing our Healing clerics at a distinct disadvantage, as they now have none of their offensive power anymore, but the greatest defensive spell in their selection is nerfed to almost be useless.

What I want to do is make some simple checks, and if the conditions are met, enable our Healing clerics to utilize the original version of the spell; failure of these same conditions uses our nerfed version.  '<img'>

What I would like to do is (I know, probably not the proper commands, but just trying to get it into understandable english.  '<img'>)...


{if InParty //Not soloing, to avoid possible abuse
    {if PartyInArea  //party members present in same area as healer, to prevent abuse
        {if GetIsInCombat //Party is in combat, so protected healer mode vital to healer

         UseOriginalGreaterSanctuary
        }
    }
else UseNerfedVersion
}

Here is where I run into issues.  I can see nothing that helps me identify if a PC is in a party.  My question is, what would I use?  Associate? Henchman?  Really struggling with this one, so if you can point me in the right direction, I'd appreciate it.

If someone already has something like this and could post an example, I'd appreciate that as well.  '<img'>

Thanks!  Russell
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
If In Party Condition
« Reply #1 on: August 01, 2012, 01:26:44 am »


               int bIsInParty = GetNextFactionMember(oPC) != OBJECT_INVALID;
               
               

               
            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
If In Party Condition
« Reply #2 on: August 01, 2012, 01:35:20 am »


               Faction!  Thank you!  '<img'>  Now to figure out the rest.  

One question though; I see a"b".  Is it a Boolean integer?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
If In Party Condition
« Reply #3 on: August 01, 2012, 01:39:32 am »


               its only name, there is not boolean type in nwn but if integer ariable is likely to have only value of 1 and 0 it is good practice to name the variable with start character of b like boolean
               
               

               
            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
If In Party Condition
« Reply #4 on: August 01, 2012, 01:41:45 am »


               Ahh, thank you.  '<img'>
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
If In Party Condition
« Reply #5 on: August 01, 2012, 02:51:50 am »


               object oPCArea = GetArea(oPC);

if (
     GetArea( GetFirstFactionMember(oPC)) == oPCArea
     && GetArea( GetNextFactionMember(oPC))== oPCArea
    )
    CastOriginalSpell();
               
               

               


                     Modifié par Lightfoot8, 01 août 2012 - 01:52 .
                     
                  


            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
If In Party Condition
« Reply #6 on: August 02, 2012, 12:55:37 am »


               

Lightfoot8 wrote...

object oPCArea = GetArea(oPC);

if (
     GetArea( GetFirstFactionMember(oPC)) == oPCArea
     && GetArea( GetNextFactionMember(oPC))== oPCArea
    )
    CastOriginalSpell();


Juast curious...would this preclude the original spell from working if PartyMember A was in the area, but party member B was not?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
If In Party Condition
« Reply #7 on: August 02, 2012, 03:05:31 am »


               Party Member A = Party Leader.
Party Member B = The next PC in the internal party list.

Member C = oPC; ( C may be equal to A or B. If there are more then three members it may not be)

In order for the spell to work The PC will have to be in the same area as the party leader and the Next PC in the party list. It does not check to see if any of other PC, who may be in the party, are in the same area or not.
               
               

               


                     Modifié par Lightfoot8, 02 août 2012 - 02:06 .
                     
                  


            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
If In Party Condition
« Reply #8 on: August 03, 2012, 12:07:59 am »


               Ahh!  I think I see.  You're saying it does not loop through all party members, just makes sure that the caster and at least one PC are in the same area, which for all intents and purposes works for me.

And reading more carefully, probably that it would be a good idea for the Caster him/herself to be the party leader, so as to only need to check for one other member in party in the area.

Thank You '<img'>
               
               

               
            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
If In Party Condition
« Reply #9 on: August 03, 2012, 02:59:29 am »


               So if I really did not care about how many party members were in the same area, only at least one, I could change the "and" (&&) to an "or" (||) and it wold work so long as it grabbed one party member in the area...correct?
               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
If In Party Condition
« Reply #10 on: August 03, 2012, 03:39:59 am »


               No.  In that case, if the healer is the party leader (or player B, the next party member), it'll return TRUE by itself.

If you're always wanting to make sure there's at least one party member in the area but other party members can be elsewhere, I think you'd have to do a loop.

You'd do something like...

int bPartyMemberInArea = 0;

object oPartyMember = GetFirstFactionMember(oPC);
while (oPartyMember != OBJECT_INVALID)
{
    if ((oPartyMember != oPC) && (GetArea(oPartyMember) == GetArea(oPC)))
    {
         cast original spell;
         bPartyMemberInArea = 1;
         break;
     }
     oPartyMember = GetNextFactionMember(oPC);
}

if (bPartyMemberInArea == 0) cast nerfed spell;



I think you could shorten the last line to

if (!bPartyMemberInArea) cast nerfed spell;

but the "longer" version may be clearer.
               
               

               


                     Modifié par MagicalMaster, 03 août 2012 - 05:52 .
                     
                  


            

Legacy_WoC_Builder

  • Sr. Member
  • ****
  • Posts: 425
  • Karma: +0/-0
If In Party Condition
« Reply #11 on: August 04, 2012, 05:42:52 pm »


               Thanks Magical Master!!  '<img'>  And by the way...when are you coming back?  '<img'>
               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
If In Party Condition
« Reply #12 on: August 05, 2012, 04:16:49 am »


               Likely never.  Send me a PM if you want to discuss it, I'd rather not derail/sully this thread.

As a side note, the above script will count a summon, animal companion, or familiar as a valid party member, I believe (which may be desired if the creature is fighting the enemies and the cleric is healing it).  Can "fix" that if desired, but wasn't sure what you wanted.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
If In Party Condition
« Reply #13 on: August 05, 2012, 05:12:09 am »


               

MagicalMaster wrote...

As a side note, the above script will count a summon, animal companion, or familiar as a valid party member, I believe (which may be desired if the creature is fighting the enemies and the cleric is healing it). Can "fix" that if desired, but wasn't sure what you wanted.


The Above will only check PC party members.

// Get the first member of oMemberOfFaction's faction (start to cycle through
// oMemberOfFaction's faction).
// * Returns OBJECT_INVALID if oMemberOfFaction's faction is invalid.
object GetFirstFactionMember(object oMemberOfFaction, int bPCOnly=TRUE)


               
               

               
            

Legacy_MagicalMaster

  • Hero Member
  • *****
  • Posts: 2712
  • Karma: +0/-0
If In Party Condition
« Reply #14 on: August 05, 2012, 05:25:58 am »


               That was it.  My fault for not actually checking the toolset or Lexicon.

So, change

object oPartyMember = GetFirstFactionMember(oPC);

to

object oPartyMember = GetFirstFactionMember(oPC, FALSE);

and

oPartyMember = GetNextFactionMember(oPC);

to

oPartyMember = GetNextFactionMember(oPC, FALSE);

if you want non-PCs to count as party members.

Thanks, Lightfoot.
               
               

               


                     Modifié par MagicalMaster, 05 août 2012 - 04:26 .