Luke Posted September 25, 2019 Share Posted September 25, 2019 (edited) As you probably know, creatures currently executing an 'AttackReevaluate()' action won't switch target unless they're forced to move in order to attack their target. This is particularly relevant for ranged creatures (since unlike melee attackers they usually don't chase their target) => As a result, you need to execute a 'ClearActions(Myself)' command in order to stop 'AttackReevaluate()' and look for another valid target. The problem is that it doesn't seem to work in my case.... I'd like to summon @DavidW since he uses this technique quite often in SCS.... Sample script below: Spoiler BEGIN_ACTION_DEFINITION Name(AttackReevaluateRanged) TRIGGER !StateCheck(scstarget,STATE_REALLY_DEAD) ACTION RESPONSE #scsprob1 EquipRanged() AttackReevaluate(scstarget,scsargument1) END ///////////////////////////////// IF Global("validtarget","LOCALS",1) !Range(NearestEnemyOf(Myself),5) THEN RESPONSE #100 SetGlobal("validtarget","LOCALS",0) SetGlobalTimer("stayontarget","LOCALS",TWO_ROUNDS) ClearActions(Myself) END IF See(NearestEnemyOf(Myself)) !Range(NearestEnemyOf(Myself),5) GlobalTimerExpired("stayontarget","LOCALS") THEN RESPONSE #100 SetGlobalTimer("stayontarget","LOCALS",TWO_ROUNDS) ClearActions(Myself) END IF !Global("inafight","LOCALS",1) See(NearestEnemyOf(Myself)) THEN RESPONSE #100 SetGlobal("inafight","LOCALS",1) SetGlobalTimer("stayontarget","LOCALS",TWO_ROUNDS) Continue() END IF TRIGGER TargetBlock(EnemiesInOrder) THEN DO Combine() Action(AttackReevaluateRanged,30) END The problem is that the CRE in question keeps attacking always the same target, even if someone else is closer than the current target ('NearestEnemyOf(Myself)' is the most important target). It will switch target only after the timer "stayontarget" has expired... But SCS ranged creatures constantly switch targets (even if the timer has not expired yet). How do you manage to achieve that? Edited September 25, 2019 by Luke Quote Link to comment
DavidW Posted September 26, 2019 Share Posted September 26, 2019 I’m not sure, to be honest: SCS’s combat AI involves a lot of trial-and-error and playtesting, it wasn’t written off the back of a systematic understanding of exactly what does what. I suggest starting with existing SCS code and editing it one step at a time until the behavior changes. Quote Link to comment
temnix Posted September 27, 2019 Share Posted September 27, 2019 Have you tried !See(NearestEnemyOf) as a clearing trigger? Creatures will continue to beat up on enemies even if they are already dead, but they don't detect the dead. Quote Link to comment
Luke Posted September 27, 2019 Author Share Posted September 27, 2019 (edited) @temnix I don't think that will work... I'm fairly confident it's some hidden mechanics behind 'AttackReevaluate()' that is preventing my CRE from switching targets... I'd like to ask @Galactygon for some help... It seems he already bumped into this issue some time ago... Edited September 27, 2019 by Luke Quote Link to comment
temnix Posted September 27, 2019 Share Posted September 27, 2019 Suit youself, but this makes a creature stop when Player1 leaves: IF !See(Player1) THEN RESPONSE #1 ClearActions(Myself) END IF True() THEN RESPONSE #1 AttackReevaluate("imoen",60) // Imoen END Quote Link to comment
Luke Posted October 25, 2019 Author Share Posted October 25, 2019 (edited) There's another detail that (unfortunately) the IESDP doesn't mention, i.e.: 'ActionListEmpty()' doesn't return true once 'Reevaluation Period' is up (to tell the truth, I'm not sure about this...) Edited November 5, 2019 by Luke Quote Link to comment
Luke Posted November 6, 2019 Author Share Posted November 6, 2019 (edited) On 9/26/2019 at 2:32 AM, DavidW said: I’m not sure, to be honest: SCS’s combat AI involves a lot of trial-and-error and playtesting, it wasn’t written off the back of a systematic understanding of exactly what does what. I suggest starting with existing SCS code and editing it one step at a time until the behavior changes. OK, I think I found out what's happening here: it's a matter of using object specifiers (e.g., [PC], SecondNearest([PC]), [EVILCUTOFF] and so forth) instead of 'NearestEnemyOf(Myself)', 'SecondNearestEnemyOf(Myself)', and so forth... Now everything seems to work as I originally intended + this explains why your AI cannot be "lured/kited" ... Edited November 6, 2019 by Luke Quote Link to comment
Recommended Posts
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.