Jump to content
Echon

Allies, scriptwise

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?

Edited by Echon

Share this post


Link to post

EA of ALLY is only granted by the Ally action as far as I know. PCs have EA of 2. I don't remember, but isn't object matching specific, not on intervals?

 

as for what's going on, no idea.

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post

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.

Share this post


Link to post

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.

Edited by Ardanis

Share this post


Link to post

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.

Share this post


Link to post

 

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.

Share this post


Link to post

projectiles do support count limiting, but that's all a hardcoded mess.

Share this post


Link to post

projectiles do support count limiting, but that's all a hardcoded mess.

 

I had been considering taking a look at projectiles and number of targets, but I guess it is not worth the time.

Share this post


Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...