Jump to content

[Script] IWD2 Bard with the lingering song feat


Recommended Posts

Hello,

I'm trying to create a script for bard in IWD2EE that takes into account the "lingering song" feat in order to alternate singing and attacking.

I'm just testing for now and I can't even display the FloatMessage(Myself,26266) every 21 seconds. I feel like I'm only entering the second IF once. The floating message only appears once, and the character only sings.

// Timer for the song (every 3 rounds) - ID 98
IF
    TimerExpired(98)  // Check if the local timer has expired
THEN
    RESPONSE #100
        StartTimer(98, 21) // Restart the local timer for 21 seconds (3 rounds)
        StartTimer(99, 7) // Start the timer to stop the song after 1 round - ID 99
END

// Sing: The Tale of Curran Strongheart
IF
    ActionListEmpty()
    CheckStatGT(Myself, 0, CLASSLEVELBARD) 
    !TimerActive(98) // Check if the local timer is inactive 
    !ModalState(Myself, BATTLESONG) 
THEN
    RESPONSE #100
        FloatMessage(Myself,26266) // Display the float message
        PlayBardSong(THE_TALE_OF_CURRAN_STRONGHEART) 
END

// Stop the song after 1 round
IF
    TimerExpired(99)
    ModalState(Myself, BATTLESONG)
THEN
    RESPONSE #100		
		DisplayString(Myself,19717) // Display the "Hey! *laugh* Stop!" message
        ClearActions(Myself) // Stop the song
END

I'm using the iesdp documentation and the great Cirerrek's IWD2 Scripting Info

Good day to you

Edited by Leilu
Link to comment

I guess PlayBardSong is not interruptable (I doubt a SetInterrupt(TRUE) before would help). The ugly workaround would be by having the reset done by another creature's script, where you can ActionOverride.

Link to comment
16 minutes ago, lynx said:

I guess PlayBardSong is not interruptable (I doubt a SetInterrupt(TRUE) before would help). The ugly workaround would be by having the reset done by another creature's script, where you can ActionOverride.

It is interruptable. The problem was in the code. I've tried that and it's already working better. Now I just need to find a way to let the bard's song activate without wasting too much time not attacking.

IF 
    !TimerActive(255) 
THEN 
    RESPONSE #1 
        DisplayString(Myself,4) 
        StartTimer(255,14) 
		PlayBardSong(THE_TALE_OF_CURRAN_STRONGHEART) 
END 

IF 
    !TimerActive(254) 
	See(NearestEnemyOf(Myself),0)
THEN 
    RESPONSE #2 
        DisplayString(Myself,13) 
        StartTimer(254,6) 
		//ClearActions(Myself)
		AttackOneRound(LastMarkedObject)
END 

 

Link to comment
//Default to Curran Song out of combat
IF
	ActionListEmpty()
	!See(NearestEnemyOf(Myself),0)
	CheckStatGT(Myself,0,CLASSLEVELBARD)
	!StateCheck(Myself,STATE_CONFUSED)
	!StateCheck(Myself,STATE_HELPLESS)
	!StateCheck(Myself,STATE_PANIC)
	!StateCheck(Myself,STATE_STUNNED)
	!StateCheck(Myself,STATE_CHARMED)
	!StateCheck(Myself,STATE_INVISIBLE)
	!ModalState(Myself,BATTLESONG)
THEN
	RESPONSE #100
		PlayBardSong(THE_TALE_OF_CURRAN_STRONGHEART)
END

//If sees ennemy and 2 rounds timer expired, set another timer and force curran song
IF
	ActionListEmpty()
	See(NearestEnemyOf(Myself),0)
	CheckStatGT(Myself,0,CLASSLEVELBARD)
	!GlobalTimerNotExpired("CU_SONG","LOCALS")
	!StateCheck(Myself,STATE_CONFUSED)
	!StateCheck(Myself,STATE_HELPLESS)
	!StateCheck(Myself,STATE_PANIC)
	!StateCheck(Myself,STATE_STUNNED)
	!StateCheck(Myself,STATE_CHARMED)
	!StateCheck(Myself,STATE_INVISIBLE)
THEN
	RESPONSE #100
		//SetGlobalTimer("P!_SING","LOCALS",TWO_ROUNDS) //or ONE_ROUND ? Does not exist in IWD2
		SetGlobalTimer("CU_SONG","LOCALS", 14)
		ReallyForceSpellRES("SPIN144",Myself)  // curran song
		Continue()
END

//If sees ennemy, attacks
IF
	ActionListEmpty()
	CheckStatGT(Myself,0,CLASSLEVELBARD)
	!StateCheck(Myself,STATE_CONFUSED)
	!StateCheck(Myself,STATE_HELPLESS)
	!StateCheck(Myself,STATE_PANIC)
	!StateCheck(Myself,STATE_STUNNED)
	!StateCheck(Myself,STATE_CHARMED)
	See(NearestEnemyOf(Myself),0)
THEN
	RESPONSE #100
		AttackOneRound(NearestEnemyOf(Myself))
END

I found a way to force a bard song each 14 seconds (will be 21sec, faster tests) but I attack with no downtime. I want my bard to attack only 2 out of 4 rounds to act as if I were micro-managing the song and attacks with lingering song.

 

Link to comment

Unfortunately, without the BG exclusive 0x00A1 SpellCastOnMe(O:Caster*,I:Spell*Spell) trigger, the previous solution doesn't seem possible.

I tried this

//Default to Curran Song out of combat
IF
	ActionListEmpty()
	!See(NearestEnemyOf(Myself),0)
	CheckStatGT(Myself,0,CLASSLEVELBARD)
	!StateCheck(Myself,STATE_CONFUSED)
	!StateCheck(Myself,STATE_HELPLESS)
	!StateCheck(Myself,STATE_PANIC)
	!StateCheck(Myself,STATE_STUNNED)
	!StateCheck(Myself,STATE_CHARMED)
	!StateCheck(Myself,STATE_INVISIBLE)
	!ModalState(Myself,BATTLESONG)
THEN
	RESPONSE #100
		PlayBardSong(THE_TALE_OF_CURRAN_STRONGHEART)
END

//If sees ennemy and 2 rounds timer expired, set another timer and force curran song
IF
	ActionListEmpty()
	See(NearestEnemyOf(Myself),0)
	CheckStatGT(Myself,0,CLASSLEVELBARD)
	!ModalState(Myself,BATTLESONG)
	!GlobalTimerNotExpired("CU_SONG","LOCALS")
	!StateCheck(Myself,STATE_CONFUSED)
	!StateCheck(Myself,STATE_HELPLESS)
	!StateCheck(Myself,STATE_PANIC)
	!StateCheck(Myself,STATE_STUNNED)
	!StateCheck(Myself,STATE_CHARMED)
	!StateCheck(Myself,STATE_INVISIBLE)
THEN
	RESPONSE #100
		//SetGlobalTimer("P!_SING","LOCALS",TWO_ROUNDS) //or ONE_ROUND ? Does not exist in IWD2
		SetGlobalTimer("CU_SONG","LOCALS", 14)// Start 2 round timer
		//ReallyForceSpellRES("SPIN144",Myself)  // curran song
		FloatMessage(Myself,4112) //singing
		PlayBardSong(THE_TALE_OF_CURRAN_STRONGHEART)
		FloatMessage(Myself,40553)//wait
		Wait(7)
		Continue()
END

//If sees ennemy, attacks after waiting for a round to be sure bard had enough time to start singing
IF
	ActionListEmpty()
	//!SpellCastOnMeRES("SPIN144",Myself) //unfortunately not in IWD triggers
	CheckStatGT(Myself,0,CLASSLEVELBARD)
	!StateCheck(Myself,STATE_CONFUSED)
	!StateCheck(Myself,STATE_HELPLESS)
	!StateCheck(Myself,STATE_PANIC)
	!StateCheck(Myself,STATE_STUNNED)
	!StateCheck(Myself,STATE_CHARMED)
	See(NearestEnemyOf(Myself),0)
THEN
	RESPONSE #100
		FloatMessage(Myself,31975) //attack!
		AttackOneRound(NearestEnemyOf(Myself))
		//AttackReevaluate(LastSeenBy(),210)
END

but unfortunately Wait(7) does not work like I thought it would. It doesn't wait to make sure the song has time to be sung, but simply makes the character wait and the song never has time to trigger.

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...