Jump to content

Allies, scriptwise


Echon

Recommended Posts

What is the 'friendly' equivalent of NearestEnemyOf()? Nearest([ALLY])? Nearest([GOODCUTOFF])? I thought I had used these previously without problems but I am getting some unreliable results. I summon a CRE with a SPL via an EFF (allegiance = the caster) and it runs a script with this bit at the end.

IF
    stuff
THEN
    RESPONSE #100
        ReallyForceSpell(Nearest([GOODCUTOFF]),CLERIC_CURE_LIGHT_WOUNDS) // SPPR103.SPL (Cure Light Wounds)
        ReallyForceSpell(SecondNearest([GOODCUTOFF]),CLERIC_CURE_LIGHT_WOUNDS) // SPPR103.SPL (Cure Light Wounds)
        ReallyForceSpell(ThirdNearest([GOODCUTOFF]),CLERIC_CURE_LIGHT_WOUNDS) // SPPR103.SPL (Cure Light Wounds)
        DestroySelf()
END

With two members in the party, player1 receives a CLW and the two others are cast untargeted. With four members, player1 and player2 receive the spell, with the last being untargeted.

 

Using ALLY instead of GOODCUTOFF, all three are untargeted.

 

What is the issue here?

Link to comment

I know PCs are 2, but I wanted something that covers party members, summoned creatures, charmed/controlled allies, etc.

 

 

 

but isn't object matching specific, not on intervals?

 

I am sorry, but I am not sure what you mean by this.

Link to comment

ALLY is just one specific friendly allegiance, such as PC, FAMILIAR or CONTROLLED. GOODCUTOFF includes all kinds of friendly allegiances. However, Nearest() didn't seem to work correctly for me as well, no matter what ea target I specified. In my tests it always targeted the caster himself. SecondNearest([GOODCUTOFF]), ThirdNearest([GOODCUTOFF]) and so on worked as expected.

Link to comment

ALLY is just one specific friendly allegiance, such as PC, FAMILIAR or CONTROLLED. GOODCUTOFF includes all kinds of friendly allegiances. However, Nearest() didn't seem to work correctly for me as well, no matter what ea target I specified. In my tests it always targeted the caster himself. SecondNearest([GOODCUTOFF]), ThirdNearest([GOODCUTOFF]) and so on worked as expected.

 

 

Thanks! That explains why I got those results. Also, this is the kind of information that needs to be in the IESDP. I mean, that would have saved me a lot of time.

 

 

 

weren't you checking critters with exactly GOODCUTOFF, no anything that has that or lower?

 

I tried several, but ended up with GOODCUTOFF.

Link to comment

Out of curiosity, why not just make a spell that uses a projectile that covers all those targets, and have the script cast the spell?

 

That would make it all a lot more simple, but the number of targets affected by the spell increases with the caster's level.

Link to comment

There's no NearestAllyOf() object in BG2.

 

Best thing you can do is to change the summon's allegiance to ENEMY and target NearestEnemyOf() instead. You can use different summons for GOODCUTOFF and EVILCUTOFF casters, selectable via ea-targeted 177 opcode.

Link to comment

You could also change the method completely depending on what you are doing. Is this summon casting cure light wounds to all allies within a certain radius?

 

You could have something like:

 

If

Range(player1,20)

Then

Curelight wounds player1

Continue

 

If

range(player2,20)

Then

Cure light wounds player2

Continue

 

And so on.

Link to comment

 

Nearest() I believe is the creature itself.

From IESDP

 

14 Nearest

Returns the nearest visible creature - usually the active creature.

 

 

Huh. I am not sure how I overlooked that.

 

There's no NearestAllyOf() object in BG2.

 

Best thing you can do is to change the summon's allegiance to ENEMY and target NearestEnemyOf() instead. You can use different summons for GOODCUTOFF and EVILCUTOFF casters, selectable via ea-targeted 177 opcode.

 

That is a very elegant solution, and one I wish I had thought of myself. I just tested it, and the script works as intended now. The script can also change the allegiance as needed so using different summons will not be necessary.

 

You could also change the method completely depending on what you are doing. Is this summon casting cure light wounds to all allies within a certain radius?

 

No. It needs to a cast a spell on the x nearest allies, with x depending on the caster's level. Cure Light Wounds is just used for testing purposes.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...