Jump to content

Combat scripting (IWDII)


Callirgos

Recommended Posts

Posted

Hi. I can understand what python is saying after reading it, but I have some general questions about combat scripting.

 

Are the BCS files really controlling the monsters? Many of the monsters have script names that I can't find in the BCS folder. For example the Aurillote Frosttouch has a script called 41CleriF. But the only script I can find is 41Cleric.

 

Why are so many (usually all) script fields unused? Specifically "combat script" says none... But I see them fighting and casting spells in-game.

 

Where is a good starting point to understand how this all works?

Posted

My copy also doesn't have that script. The critter probably has other (general) scripts that take care of attacking, the slot where it is is not that relevant. IIRC it affects the order of execution "only".

Posted

Do not confuse the "script name" with scripts. A script name (aka death variable) is used to identify a creature. In the case of Aurilite Frosttouch, it is set to 41CleriF. The fields override script, special script, ... refer to the actual creature scripts. Although in my copy of the game, only two of the four Aurilite Frosttouch creature files have scripts assigned.

Posted

I'm currently trying to RE-ADD the original script for Bombardier Beetles, 00BTLBM0. The script compiles fine, though there are some things I'm not familiar with. The spell.SPL is set up fine, it should work and I can call it from an item, as "cast spell".

 

However, when I assign the script, I can't make it work. I've even chaneged some of the IF statements, but it never works.

IF
!CreatureHidden(Myself)
HaveSpell(INNATE_BOMBARDIER_BEETLE_CLOUD)
!TimerActive(5)
See(NearestEnemyOf(Myself),0)
Range(LastSeenBy(Myself),7,LESS_THAN)
THEN
RESPONSE #100
 StartTimer(5,21)
 ForceSpell(LastSeenBy(Myself),INNATE_BOMBARDIER_BEETLE_CLOUD)
 RemoveSpell(INNATE_BOMBARDIER_BEETLE_CLOUD)
 WaitAnimation(Myself,WALK)
 WaitAnimation(Myself,CONJURE)
 WaitAnimation(Myself,CAST)
RESPONSE #25
 Continue()
END

Posted
...
Just for curious sake... not that I know much actually on the IwD2 side, but could you add in the .tp2 code you use to install the mod, so we can see if the failure is in the install of the spell, after all you might need to remove the original... and add uses of the spell to the beetle etc.
Posted

I'm not doing my test with Weidu, I'm just using an override .CRE The Creature is a summoned creature, so it should be running scripts from the .CRE and not from an area assigned script. Am I missing something bigger?

 

The .CRE has uses of the spell, and the spell actually works if I call it in some other way. I've tested other scripts and they work with an override .CRE. I can change to different combat scripts, and it's a summoned creature so the area and creature is not already loaded. Its fresh each time, but this specific script doesn't seem to work.

Posted

I've been able to get this to work.. So, the problem must be in the targeting somehow...

 

IF
!TimerActive(5)
THEN
RESPONSE #100
 StartTimer(5,21)
 ForceSpell(Myself,INNATE_BOMBARDIER_BEETLE_CLOUD)
RESPONSE #25
 Continue()
END

Posted

Nope... The issue is with

 

HaveSpell(INNATE_BOMBARDIER_BEETLE_CLOUD)

 

How is that possible when I've manually added the spell to the .CRE?

I added memorization and charges too...

 

I can actually run the script when I remove this.

Posted

So, in the end my script looks like this.

 

IF
GlobalTimerExpired("BEETLE_CLOUD","LOCALS")
Global("Action","LOCALS",1)
THEN
RESPONSE #100
 SetGlobal("Action","LOCALS",0)
END
IF
!TimerActive(5)
Global("Action","LOCALS",0)
!Dead(Myself)
HPPercentLT(Myself,30)
Or(8)
 HitBy([ANYONE],SLASHING)
 HitBy([ANYONE],CRUSHING)
 HitBy([ANYONE],PIERCING)
 HitBy([ANYONE],MISSILE)
 HitBy([ANYONE],FIRE)
 HitBy([ANYONE],COLD)
 HitBy([ANYONE],ELECTRICITY)
 HitBy([ANYONE],MAGIC)
THEN
RESPONSE #100
 SetGlobal("Action","LOCALS",1)
 SetGlobalTimer("BEETLE_CLOUD","LOCALS",70)
 ForceSpell(Myself,INNATE_BOMBARDIER_BEETLE_CLOUD)
 WaitAnimation(Myself,WALK)
 WaitAnimation(Myself,CONJURE)
 WaitAnimation(Myself,CAST)
 Continue()
END
IF
!TimerActive(5)
Global("Action","LOCALS",0)
See(NearestEnemyOf(Myself),0)
Range(LastSeenBy(Myself),7,LESS_THAN)
THEN
RESPONSE #30
 StartRandomTimer(5,2,5)
 SetGlobal("Action","LOCALS",1)
 SetGlobalTimer("BEETLE_CLOUD","LOCALS",70)
 ForceSpell(Myself,INNATE_BOMBARDIER_BEETLE_CLOUD)
 WaitAnimation(Myself,WALK)
 WaitAnimation(Myself,CONJURE)
 WaitAnimation(Myself,CAST)
RESPONSE #70
 StartRandomTimer(5,2,5)
 Continue()
END

 

My last question is about the "cooldown" counter I've made. With GlobalTimerExpired is it considered True ONCE after the timer has expired, or ALWAYS if the timer has expired. Meaning, will the first block of my script cause a 70 second cooldown each time, or only the first time?

Posted
HaveSpell(INNATE_BOMBARDIER_BEETLE_CLOUD)

Make sure the text label is listed in spells.ids else it won't know what to resolve to when the script is compiled.

 

My last question is about the "cooldown" counter I've made. With GlobalTimerExpired is it considered True ONCE after the timer has expired, or ALWAYS if the timer has expired. Meaning, will the first block of my script cause a 70 second cooldown each time, or only the first time?
Your first block will process whenever the timer has expired and any other triggers return valid. So, always when the timer is expired and that global variable is set to 1. Since you set it to 0 in that block, it should only run once per 70 seconds
Posted

Yes, Avenger. It's pretty nifty how that's done :)

 

The area has an entry for each creature, and each creatuer may have different scripts attached. Even if you have 2 of the same creatures in the same area, they may both have different scripts.

 

Summoned Creatures ( at least from the PCs ) still to use thier .CRE scripts :)

 

I'm not 100% sure, but it looks like Area scripts override .CRE scripts per slot. Meaning, if the slot is empty in the area entry the .CRE script for that slot will take effect. Multiple Plot NPCs have no area scripts, and seem to be running their .CRE scripts as written.

Archived

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

×
×
  • Create New...