Skip to content

Tweaking Scripts

Well, I've been playing a bit, and I've discovered that you can set a customized script for some characters. For example, I set Yoshimo to search for traps. However, once he found one, I had him disarm it, pick the lock, and open the chest to see what was in. I couldn't take anything out, however, because the AI canceled the action and returned to searching for traps. It was a bit annoying.

I searched on here for some tips on how to adjust some of these scripts. One of the recommendations was a certain java program that would let you compile/decompile scripts. Unfortunately, I've found out that Google Chrome apparently doesn't have any java support anymore.

Any tips on how to adjust these scripts? I'd like to tweak them a little.

Comments

  • ZosimusZosimus Member Posts: 19
    Well, no one has answered, but now I have the program NearInfinity working on my computer. Accordingly, I can see the scripts and modify them. However, I'm uncertain about the syntax. Are there any manuals?
  • ZosimusZosimus Member Posts: 19
    I still cannot determine whether my PC has innate spells (such as cure light wounds) so that the script can activate these abilities when needed. These abilities do not seem to be listed in spells.ids nor does a check for CLERIC_CURE_LIGHT_WOUNDS return positive even if the PC has his innate cure light wounds skill. If anyone has advice for how to activate these abilities, please let me know.
  • BelanosBelanos Member Posts: 968
    I've found this to be a good source for learning about scripting functions and syntax as well:

    http://gibberlings3.net/iesdp/
  • Igneos_EructidIgneos_Eructid Member Posts: 11
    edited November 2015
    its not cleric, its INNATE_CURE_LIGHT_WOUNDS

    you will need to install java on your machine to get nearinfinty working...I would also recommend a search of bcs files with nearinfinty for syntax, to see how they are used. I would also recommend installing the latest bp series scripts, as they contain all possible spells and abilities, but unfortunately, in the wrong order...
  • ZosimusZosimus Member Posts: 19
    INNATE_CURE_LIGHT_WOUNDS is not found in spells.IDS

    I have made some progress, but I'm still suffering as I cannot get some features to work. For example, I made a SORC.BS to handle a sorcerer, but when he got hit with glitterdust and his AC dropped, he used all of his level 1 spells on casting and recasting an armor spell. Although I had no immediate solution as there does not seem to be any way to determine whether the character is already affected by a spell, I hit on the idea of putting a timer on that spell so that it would get cast no more than once every 5 minutes. Unfortunately, I haven't been able to get the timer system to work. Some guides suggested that I could initialize the timers with StartTimer(101,1) in an IF OnCreation() block, but this doesn't seem to work with PCs. So then I tried to initialize the timers in a !TimerExpired(100) to have a new timer (set to expire) that would be expired whenever the timers were initialized. I also tried StartTimer(100,0) intending to start it in an expired state, but that didn't work. So I tried StartTimer(100,1) but the problem is that the block constantly showed not expired, so it constantly reinitialized the timers to 1 second. So then I tried to use a locals variable e.g. IF !Global("Initialized","LOCALS",1) as a way to initialize, but that didn't seem to work either. I finally hit on the idea of putting a PauseGame() in the middle of the block to determine whether the block was executing -- and it is, but too many times even though I specifically set the Initialized Value to 1 in the block.

    This also hampered progress in the use of WIZARD_MELF_ACID_ARROW because I wanted to cast that spell first, but not recast until at least 30 seconds later (as it has a lingering effect) but again, I couldn't get the timers going! For awhile I was using a workaround with a RandonNumGT(10,8) to only cast it once in awhile, but it wasn't the solution I was looking for.

    This is the current script state:

    IF
    !ActionListEmpty()
    THEN
    RESPONSE #100 // If the PC is doing something, don't do anything!
    END

    IF
    TimerExpired(101)
    See(NearestEnemyOf(Myself))
    HPGT(LastSeenBy(Myself),10)
    !HasBounceEffects(LastSeenBy(Myself))
    HaveSpell(WIZARD_MELF_ACID_ARROW) // Broken -- never executes.
    THEN
    RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_MELF_ACID_ARROW)
    StartTimer(101,18)
    END

    IF
    See(NearestEnemyOf(Myself))
    HPGT(LastSeenBy(Myself),20)
    !HasBounceEffects(LastSeenBy(Myself))
    HaveSpell(WIZARD_FLAME_ARROW)
    THEN
    RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_FLAME_ARROW)
    END

    IF
    See(NearestEnemyOf(Myself))
    HPGT(LastSeenBy(Myself),20)
    !HasBounceEffects(LastSeenBy(Myself))
    HaveSpell(WIZARD_CHROMATIC_ORB)
    THEN
    RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_CHROMATIC_ORB)
    END

    IF
    See(NearestEnemyOf(Myself))
    HPGT(LastSeenBy(Myself),20)
    !HasBounceEffects(LastSeenBy(Myself))
    HaveSpell(WIZARD_MAGIC_MISSILE)
    THEN
    RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_MAGIC_MISSILE)
    END

    IF
    See(NearestEnemyOf(Myself))
    HPGT(LastSeenBy(Myself),20)
    !HasBounceEffects(LastSeenBy(Myself))
    HaveSpell(WIZARD_BURNING_HANDS)
    THEN
    RESPONSE #100
    Spell(LastSeenBy(Myself),WIZARD_BURNING_HANDS)
    END

    IF
    See(NearestEnemyOf(Myself))
    !Range(NearestEnemyOf(Myself),4)
    THEN
    RESPONSE #100
    EquipRanged()
    AttackOneRound(NearestEnemyOf(Myself)) // I prefer this because you can often fire a shot
    END // then switch to melee before the monster closes

    IF
    See(NearestEnemyOf(Myself))
    Range(NearestEnemyOf(Myself),4)
    THEN
    RESPONSE #100
    EquipMostDamagingMelee()
    AttackOneRound(NearestEnemyOf(Myself))
    END

    IF
    !StateCheck(Myself,STATE_SLOWED) // To guard against damaged AC if slowed
    TimerExpired(102) // Timer doesn't work
    HaveSpell(WIZARD_ARMOR)
    CheckStatGT(Myself,5,ARMORCLASS)
    THEN
    RESPONSE #100
    Spell(Myself,WIZARD_ARMOR)
    StartTimer(102,300)
    END

    IF
    HaveSpell(WIZARD_STONE_SKIN)
    CheckStatLT(Myself,1,STONESKINS) // This part works fine.
    THEN
    RESPONSE #100
    Spell(Myself,WIZARD_STONE_SKIN)
    END

    IF
    !Global("Initialized","LOCALS",2)
    THEN
    RESPONSE #100
    SetGlobal("Initialized","LOCALS",2)
    StartTimer(100,1)
    StartTimer(101,1)
    StartTimer(102,1) // This part constantly runs and pauses the game.
    PauseGame()
    END

  • ZosimusZosimus Member Posts: 19
    I have upgraded to the Enhanced Edition, patched my old edition, and patched the new one. I am having better success with scripting. I can now get the INNATE_CURE_LIGHT_WOUNDS spells to go off. I have not revisited the timer issue, but hope to work on that soon.
Sign In or Register to comment.