Aller au contenu

Photo

If In Party Condition


  • Veuillez vous connecter pour répondre
15 réponses à ce sujet

#1
WoC_Builder

WoC_Builder
  • Members
  • 225 messages
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.  :)

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

{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.  :)

Thanks!  Russell

#2
Shadooow

Shadooow
  • Members
  • 4 471 messages
int bIsInParty = GetNextFactionMember(oPC) != OBJECT_INVALID;

#3
WoC_Builder

WoC_Builder
  • Members
  • 225 messages
Faction! Thank you! :D Now to figure out the rest.

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

#4
Shadooow

Shadooow
  • Members
  • 4 471 messages
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

#5
WoC_Builder

WoC_Builder
  • Members
  • 225 messages
Ahh, thank you. :)

#6
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
object oPCArea = GetArea(oPC);

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

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


#7
WoC_Builder

WoC_Builder
  • Members
  • 225 messages

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?

#8
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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 .


#9
WoC_Builder

WoC_Builder
  • Members
  • 225 messages
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 :D

#10
WoC_Builder

WoC_Builder
  • Members
  • 225 messages
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?

#11
MagicalMaster

MagicalMaster
  • Members
  • 2 003 messages
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 .


#12
WoC_Builder

WoC_Builder
  • Members
  • 225 messages
Thanks Magical Master!! :D And by the way...when are you coming back? ;)

#13
MagicalMaster

MagicalMaster
  • Members
  • 2 003 messages
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.

#14
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

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)



#15
MagicalMaster

MagicalMaster
  • Members
  • 2 003 messages
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 .


#16
WoC_Builder

WoC_Builder
  • Members
  • 225 messages

MagicalMaster wrote...

Likely never. Send me a PM if you want to discuss it.


Message sent.  ;)