Author Topic: AttackReevaluate question  (Read 1862 times)

Offline aigleborgne

  • Planewalker
  • *****
  • Posts: 106
AttackReevaluate question
« on: November 21, 2005, 12:18:25 PM »
Hi,

Here is what I found about AttackReevaluate:

AttackReevaluate(O:Target*,I:ReevaluationPeriod*)
Attacks and reevaluates the situation after the time specified, I belive the time is in 15ths of a second. Reevaluate meaning run through the script to see if any other conditions are true.

I have set this little block in the end of my script:
IF
   GlobalTimerNotExpired("cast","LOCALS")
   ActionListEmpty()
THEN
   RESPONSE  #100
      AttackReevaluate(LastSeenBy(Myself),15)
END

I have a mage with many spells.
Often, he swings for 2 rounds before casting a spell.
I have added GlobalTimerNotExpired("cast","LOCALS") to make sure it's not a bug in my script (because timer is one round) but it doesn't change anything
So it means that script is still on AttackReevaluate(LastSeenBy(Myself),15)

Is it a known bug on this action?

I can use AttackOneRound, but I prefer the first one because attackoneround means some loss in casting spells (because he attacks one full round, while I want to fight between casting)

Any help?
Thanks by advance

Offline Echon

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1941
  • Gender: Male
    • The Fields of the Dead
Re: AttackReevaluate question
« Reply #1 on: November 21, 2005, 01:02:58 PM »
What does your spellcasting block look like?

-Echon

Offline aigleborgne

  • Planewalker
  • *****
  • Posts: 106
Re: AttackReevaluate question
« Reply #2 on: December 02, 2005, 03:52:24 AM »
Here is an example of a bug script.
Carrion crawler script
Logic is simple : hold every enemies, then kill them one by one.

If I replace attackreevaluate by attackoneround, it works fine... except that reevaluate would be better if it works!

attackoneround seems to have a problem with monsters. I am not sure yet, but in my test, monsters using attackoneround seem to have a very high thac0.

I tested that a 24hd fire elemental (thac0 0) hitting something with 10 AC
with attackoneround, elemental miss 80% of time
with attackreevaluate, it works fine

Carrion crawler script:
actually, carrion attacks same target untile it dies, even after target is held.
because script is reeavaluate 6 time per second, it should change target once it is held.
I make test putting displaystring before attack, and it was displayed only one time per target
That is why I also had some problems with cast & attack and all my scripts now use attackoneround

Quote
IF
   CheckStat(SixthNearestEnemyOf(Myself),0,SANCTUARY)
   !CheckStatGT(SixthNearestEnemyOf(Myself),0,HELD)
   See(SixthNearestEnemyOf(Myself))
   False()
THEN
   RESPONSE #100
END

IF
   CheckStat(FifthNearestEnemyOf(Myself),0,SANCTUARY)
   !CheckStatGT(FifthNearestEnemyOf(Myself),0,HELD)
   See(FifthNearestEnemyOf(Myself))
   False()
THEN
   RESPONSE #100
END

IF
   CheckStat(FourthNearestEnemyOf(Myself),0,SANCTUARY)
   !CheckStatGT(FourthNearestEnemyOf(Myself),0,HELD)
   See(FourthNearestEnemyOf(Myself))
   False()
THEN
   RESPONSE #100
END

IF
   CheckStat(ThirdNearestEnemyOf(Myself),0,SANCTUARY)
   !CheckStatGT(ThirdNearestEnemyOf(Myself),0,HELD)
   See(ThirdNearestEnemyOf(Myself))
   False()
THEN
   RESPONSE #100
END

IF
   CheckStat(SecondNearestEnemyOf(Myself),0,SANCTUARY)
   !CheckStatGT(SecondNearestEnemyOf(Myself),0,HELD)
   See(SecondNearestEnemyOf(Myself))
   False()
THEN
   RESPONSE #100
END

IF
   CheckStat(NearestEnemyOf(Myself),0,SANCTUARY)
   !CheckStatGT(NearestEnemyOf(Myself),0,HELD)
   See(NearestEnemyOf(Myself))
   False()
THEN
   RESPONSE #100
END

IF
   CheckStat(LastSeenBy(Myself),0,SANCTUARY)
   !CheckStatGT(LastSeenBy(Myself),0,HELD)
   See(LastSeenBy(Myself))
THEN
   RESPONSE #100
      AttackReevaluate(LastSeenBy(Myself),15)
END

IF
   ActionListEmpty()
THEN
   RESPONSE #100
      AttackReevaluate(NearestEnemyOf(Myself),15)
END

« Last Edit: December 02, 2005, 03:58:16 AM by aigleborgne »

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: AttackReevaluate question
« Reply #3 on: December 02, 2005, 05:06:41 PM »
Are you sure that AttackOneRound() is actually having it attack?  I read somewhere once that this action is a bit flaky.  Did you actually see the dice roll numbers appear in the status screen, or did you just count when the monster visually attacked its opponent?
Earn Money Sleeping.

Offline aigleborgne

  • Planewalker
  • *****
  • Posts: 106
Re: AttackReevaluate question
« Reply #4 on: December 03, 2005, 03:35:41 AM »
No I didn't see roll number with attackoneround but  I see attack animation.
I have suspected this was the problem, I can explain why attackoneround is rarely used in bioware scripts.
but that doesn't solve my problem with attackreevaluate

Offline cirerrek

  • Planewalker
  • *****
  • Posts: 92
Re: AttackReevaluate question
« Reply #5 on: December 04, 2005, 02:14:36 AM »
AttackOneRound() & AttackReevaluate() are both flaky. 

Attack() is the only one that works without losing any attacks per round.  Of course, it Attacks until the target is dead.  You have to set an interruption timer to break out of Attack() if something more important comes along, in this case, paralyzing another foe. 

For example in the case of the eSeries Party AI scripts, spell casting is more important than attacking.  So you set a short duration timer to indicate that attacking is interruptible.  Then all the spell blocks check to see if you are doing something interruptible (by checking to see if the short duration timer is in effect).  If it is in effect than it is okay to interrupt the attack sequence to cast the spell.   

Code: [Select]
// * Simple Interruptable Attack Clause
IF
  OR(2)                                                                    // Xyx's Cast&Attack/GB's self-interrupting Attack
     ActionListEmpty()                                                     // if we're doing nothing
     GlobalTimerNotExpired("gh_ActionIsInterruptable","LOCALS")            // or we're doing an interruptible action
  !Allegiance(LastSeenBy(Myself),GOODCUTOFF)                               // and they're not in our party (double-check)
  Exists([EVILCUTOFF.0.0.0.0.0.0])
THEN
  RESPONSE #100
    SetGlobalTimer("gh_ActionIsInterruptable","LOCALS",1)                  // set a 1-sec timer to indicate action is interruptable
    Attack(LastSeenBy(Myself))                                             // Attack()
END

« Last Edit: December 04, 2005, 02:21:46 AM by cirerrek »

Offline aigleborgne

  • Planewalker
  • *****
  • Posts: 106
Re: AttackReevaluate question
« Reply #6 on: December 04, 2005, 04:14:07 AM »
Thanks a lot for that clarification.
I will test and implement your solution :)

AttackOneRound() & AttackReevaluate() are both flaky. 

Attack() is the only one that works without losing any attacks per round.  Of course, it Attacks until the target is dead.  You have to set an interruption timer to break out of Attack() if something more important comes along, in this case, paralyzing another foe. 

For example in the case of the eSeries Party AI scripts, spell casting is more important than attacking.  So you set a short duration timer to indicate that attacking is interruptible.  Then all the spell blocks check to see if you are doing something interruptible (by checking to see if the short duration timer is in effect).  If it is in effect than it is okay to interrupt the attack sequence to cast the spell.   

Code: [Select]
// * Simple Interruptable Attack Clause
IF
  OR(2)                                                                    // Xyx's Cast&Attack/GB's self-interrupting Attack
     ActionListEmpty()                                                     // if we're doing nothing
     GlobalTimerNotExpired("gh_ActionIsInterruptable","LOCALS")            // or we're doing an interruptible action
  !Allegiance(LastSeenBy(Myself),GOODCUTOFF)                               // and they're not in our party (double-check)
  Exists([EVILCUTOFF.0.0.0.0.0.0])
THEN
  RESPONSE #100
    SetGlobalTimer("gh_ActionIsInterruptable","LOCALS",1)                  // set a 1-sec timer to indicate action is interruptable
    Attack(LastSeenBy(Myself))                                             // Attack()
END



Offline aigleborgne

  • Planewalker
  • *****
  • Posts: 106
Re: AttackReevaluate question
« Reply #7 on: December 04, 2005, 05:09:39 AM »
I have tried your block without sucess.
Then I have set some displaystring before and after attack to check what's happening:

IF
   OR(2)
      ActionListEmpty()
      GlobalTimerNotExpired("gh_ActionIsInterruptable","LOCALS")
   CheckStat(LastSeenBy(Myself),0,SANCTUARY)
   !CheckStatGT(LastSeenBy(Myself),0,HELD)
   See(LastSeenBy(Myself))
THEN
   RESPONSE #100
      SetGlobalTimer("gh_ActionIsInterruptable","LOCALS",1)
      DisplayStringHead(Myself,15529) // Melee
      Attack(LastSeenBy(Myself))
      Continue()
END

I added Continue() just to try but it changes nothing (it was a stupid try, but I didn't know what to do)

Ok, the thing is the script get blocked on Attack(LastSeenBy(Myself))
I get one "Melee" string, then nothing until target is killed.

So, either there is a problem with my game, either there is something to add before in the script. or something else...

Offline cirerrek

  • Planewalker
  • *****
  • Posts: 92
Re: AttackReevaluate question
« Reply #8 on: December 04, 2005, 12:30:30 PM »
Your're probably going to figure out some sort of Move_To_Next_Non_Held_Enemy routine. 

It would check

GlobalTimerNotExpired("gh_ActionIsInterruptable","LOCALS") 

and If true it should MoveToObject() - nearest unheld enemy.

I don't have anything like that coded up, so you'll probably have to plink around with it and see what works, unless of course someone else has an example.   

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: