1. SPS Accounts:
    Do you find yourself coming back time after time? Do you appreciate the ongoing hard work to keep this community focused and successful in its mission? Please consider supporting us by upgrading to an SPS Account. Besides the warm and fuzzy feeling that comes from supporting a good cause, you'll also get a significant number of ever-expanding perks and benefits on the site and the forums. Click here to find out more.
    Dismiss Notice
Dismiss Notice
You are currently viewing Boards o' Magick as a guest, but you can register an account here. Registration is fast, easy and free. Once registered you will have access to search the forums, create and respond to threads, PM other members, upload screenshots and access many other features unavailable to guests.

BoM cultivates a friendly and welcoming atmosphere. We have been aiming for quality over quantity with our forums from their inception, and believe that this distinction is truly tangible and valued by our members. We'd love to have you join us today!

(If you have any problems with the registration process or your account login, please contact us. If you've forgotten your username or password, click here.)

Scripting Spells

Discussion in 'BG2: Shadows of Amn (Classic)' started by DCD, Nov 20, 2005.

  1. DCD Gems: 2/31
    Latest gem: Fire Agate


    Joined:
    Oct 26, 2005
    Messages:
    44
    Likes Received:
    2
    I've run into a difficulty in regard to a script I'm working on. The mage in question running the script is supposedly able to multiply his spell attacks by three; when he casts a spell on a monster, the script ForceSpells the same spell on the two closest monsters. The problem is, though, that I do not know how to effectively cast the spell on the NearestEnemyOf(Myself), without requiring going through the whole game and finding the moster CREs to target.

    Here's the issue. With our current triggers, SpellCast, SpellCastOnMe, SpellCastInnate, the objects can be myself or an enemy. However, what I want is for the spell to be cast by myself onto a specified enemy, which appears to be beyond the scripting capabilities. What I originally had was

    IF
    See(NearestEnemyOf(Myself)
    See(SecondNearestEnemyOf(Myself)
    See(ThirdNearestEnemyOf(Myself)
    SpellCast(NearestEnemyOf(Myself),WIZARD_MAGIC_MISSILE)
    THEN
    RESPONSE #100
    ForceSpell(SecondNearestEnemyOf(Myself),WIZARD_MAGIC_MISSILE)
    ForceSpell(ThirdNearestEnemyOf(Myself),WIZARD_MAGIC_MISSILE)
    END

    That's wrong because the object specified is the nearest enemy of myself, meaning if it casts MM, I forcespell MM on the second and third nearest enemies of myself.

    If the script is switched, with myself as the object:

    IF
    See(NearestEnemyOf(Myself)
    See(SecondNearestEnemyOf(Myself)
    See(ThirdNearestEnemyOf(Myself)
    SpellCast(Myself,WIZARD_MAGIC_MISSILE)
    THEN
    RESPONSE #100
    ForceSpell(SecondNearestEnemyOf(Myself),WIZARD_MAGIC_MISSILE)
    ForceSpell(ThirdNearestEnemyOf(Myself),WIZARD_MAGIC_MISSILE)
    END

    The script works, but I want the spell to be cast on three individual targets. What happens if I target the SecondNearetEnemyOf(Myself)? I end up attacking that monster with two MMs, and the NearestEnemyOf(Myself) goes unharmed.

    So, I'm in a quandry. How do I make this work?
     
Sorcerer's Place is a project run entirely by fans and for fans. Maintaining Sorcerer's Place and a stable environment for all our hosted sites requires a substantial amount of our time and funds on a regular basis, so please consider supporting us to keep the site up & running smoothly. Thank you!

Sorcerers.net is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to products on amazon.com, amazon.ca and amazon.co.uk. Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.