Skip to content

Help with spell scripts

EggHuevoEggHuevo Member Posts: 69
edited March 2016 in General Modding
Hi, I've played BG for 15 years. But I don't know the first thing about scripts. I have nearinfinity and I've only used it to modify some items like Drizzt's armor and such, but nothing too complex.

What I want: hotkeys for all spells like the original games had. I looked everywhere on the internet and it seems this is only attainable by scripting. Could somebody please tell me how I can do this?

For instance, creating a script that would cast stoneskin by pressing X, magic missile by pressing W, etc. I only need a few examples (a self buff and an offensive spells) and I can figure out the rest.

Thanks in advance.

Comments

  • AbelAbel Member Posts: 785
    I think you can directly assign hotkeys in game. It's somewhere in the gameplay options, I believe.
  • ErgErg Member Posts: 1,756
    Maybe something like this:
    IF
    HotKey(X)
    HaveSpell(WIZARD_STONE_SKIN) // SPWI408.SPL (Stoneskin)
    THEN
    RESPONSE #100
    Spell(Myself,WIZARD_STONE_SKIN) // SPWI408.SPL (Stoneskin)
    END

    IF
    HotKey(W)
    See(NearestEnemyOf(Myself))
    HaveSpell(WIZARD_MAGIC_MISSILE) // SPWI112.SPL (Magic Missile)
    THEN
    RESPONSE #100
    Spell(NearestEnemyOf(Myself),WIZARD_MAGIC_MISSILE) // SPWI112.SPL (Magic Missile)
    END
  • EggHuevoEggHuevo Member Posts: 69
    Abel said:

    I think you can directly assign hotkeys in game. It's somewhere in the gameplay options, I believe.

    Hey, thanks for your response. I forgot to mention I already know about the ingame option, but there's A LOT of spells missing (stoneskin, most level 6 spells, every level 7-9 spell, abilities). I was looking for somebody who knows how to make a simple script so that when I hit certain key, it prompts certain spell. I guess it's not very difficult to achieve, but I don't know the first thing about scripting.
    Anyway, thanks for responding.
  • EggHuevoEggHuevo Member Posts: 69
    edited March 2016
    Erg said:

    Maybe something like this:

    IF
    HotKey(X)
    HaveSpell(WIZARD_STONE_SKIN) // SPWI408.SPL (Stoneskin)
    THEN
    RESPONSE #100
    Spell(Myself,WIZARD_STONE_SKIN) // SPWI408.SPL (Stoneskin)
    END

    IF
    HotKey(W)
    See(NearestEnemyOf(Myself))
    HaveSpell(WIZARD_MAGIC_MISSILE) // SPWI112.SPL (Magic Missile)
    THEN
    RESPONSE #100
    Spell(NearestEnemyOf(Myself),WIZARD_MAGIC_MISSILE) // SPWI112.SPL (Magic Missile)
    END
    Yeah! That's exactly what I wanted, save for one little thing. Is there any way I can select the target for offensive spells such as magic missile? Or if I wanted to cast something like invisibility, could I select the party member I want to cast it on? Or is it always "automatic"?

    Nevertheless, that's a great start, I appreciate it, thank you very much!

    Edit: I guess in simple words, what I would want is that when I hit W, there shows up a cursor so I can target the, well... target :tongue: Just like I would by manually selecting the spell, only this way it would be done by hitting a certain key.
  • GoturalGotural Member Posts: 1,229
    @EggHuevo
    That profile picture... it's moving!
  • EggHuevoEggHuevo Member Posts: 69
    Gotural said:

    @EggHuevo
    That profile picture... it's moving!

    Lol, yes. Someone pointed it out recently. It's because it's my google account.
  • TressetTresset Member, Moderator Posts: 8,264
    Hmm... Reading scripts is one thing I can do really well. Writing scripts, however, is not something I am confident in. Certainly not confident enough to offer lessons on. However...
    EggHuevo said:

    Edit: I guess in simple words, what I would want is that when I hit W, there shows up a cursor so I can target the, well... target :tongue: Just like I would by manually selecting the spell, only this way it would be done by hitting a certain key.

    If that is all you really want then you don't need scripting knowledge to do that. Just use the assign keys option to bind keys to the casting of certain spells. Some screenshots here from beta patch 2.0 (let me know if you want to see it in 1.3):
    imageimage
  • EggHuevoEggHuevo Member Posts: 69
    @Tresset Yes, I'm aware of that option. But it still lacks a lot of spells, like stoneskin and every high level spell. It's annoying. When I played the original BG2, I had spells in my entire keyboard, lol. I guess if I can't solve this somehow, I'll be forced to play the original instead of the enhanced edition. It's just too tedious for me otherwise. Thanks anyway.
  • EggHuevoEggHuevo Member Posts: 69
    Tresset said:

    @EggHuevo You must not have the beta of patch 2.0 yet. I am seeing ALL the spells there. I imagine all you have to do is either get the beta or just wait until the patch is released officially (which should be relatively soon).
    imageimage

    Oh, you're right, my friend! It's true, I have an older version, the list doesn't even look that way. Is that patch for BG 1, BG 2, or both? In BG 1 is not such a problem, because I can just put stoneskin in F4 and the rest of the hotkeys are there. BG 2 was the problem. Seeing the spells you showed me, I assume this is for BG 2. Great news!
  • TressetTresset Member, Moderator Posts: 8,264
    That is actually BG1 (because I happened to have it open at the time). I assume that BG2 has even more options and includes all the HLA spells as well. Haven't checked yet though... In any case the patches are in the beta stages and are available for both BG1:EE and BG2:EE as long as you got the game from Steam or Beamdog. Follow this link for more info.
  • AbelAbel Member Posts: 785
    So, I was right without even knowing it. Hmm... I feel powerful!
Sign In or Register to comment.