Scripts Contribution Post
Earnest_ernest
Member Posts: 40
I had the idea of using this discussion to post your custom scripts(ones you have made with NearInfinity or the like)
I think I have spent more time learning about scripting than playing the game itself xD.
So I would like to start sharing three related scripts I made myself; partially tested.
It is GuardEE, GuardEE2, GuardEE3.
In a party of mine consisting of three melee warriors on the front and 3 ranged on the back I found it quite annoying that when I scouted for traps with one the ranged thief and saw enemies, the other 3 warriors with Standard attack AI rushed forward to kill the enemies, triggering the not yet disarmed traps on their way.
So I created these scripts,that work quite similar to "guard",to tell them to stay in position and attack the enemy when encountering them at a close range, enough to prevent them triggering the trap. I also wanted some kind of smart targetting so each warrior targeted only one enemy, on an attempt to hold back all possible enemies that were chasing the thief who runned and placed himself behind the front line.
GuardEE Would make the player attack the nearestenemy that is 10 feet-reach
GuardEE2 would make the player attack the secondnearestenemy(if any) that is 10 feet-reach, if there is not a second enemy, he will go for the nearestenemy
GuardEE3 would make the player attack the thirdnearestenemy(if any) that is 10 feet-reach, if there is not a second enemy, he will go for the secondnearestenemy, and if not he will end up going for the nearest.
So you would assign each of the three warrior a different Guard Script.
Fairly enough, the targetting works quite well, yet the defense formation breaks because they chase the enemies that quite often keep chasing the chicken thief who has gone behind the front. Note that I used attack instead of attackoneround.
You are free to improve those scripts.
GuardEE3 sample code:
I think I have spent more time learning about scripting than playing the game itself xD.
So I would like to start sharing three related scripts I made myself; partially tested.
It is GuardEE, GuardEE2, GuardEE3.
In a party of mine consisting of three melee warriors on the front and 3 ranged on the back I found it quite annoying that when I scouted for traps with one the ranged thief and saw enemies, the other 3 warriors with Standard attack AI rushed forward to kill the enemies, triggering the not yet disarmed traps on their way.
So I created these scripts,that work quite similar to "guard",to tell them to stay in position and attack the enemy when encountering them at a close range, enough to prevent them triggering the trap. I also wanted some kind of smart targetting so each warrior targeted only one enemy, on an attempt to hold back all possible enemies that were chasing the thief who runned and placed himself behind the front line.
GuardEE Would make the player attack the nearestenemy that is 10 feet-reach
GuardEE2 would make the player attack the secondnearestenemy(if any) that is 10 feet-reach, if there is not a second enemy, he will go for the nearestenemy
GuardEE3 would make the player attack the thirdnearestenemy(if any) that is 10 feet-reach, if there is not a second enemy, he will go for the secondnearestenemy, and if not he will end up going for the nearest.
So you would assign each of the three warrior a different Guard Script.
Fairly enough, the targetting works quite well, yet the defense formation breaks because they chase the enemies that quite often keep chasing the chicken thief who has gone behind the front. Note that I used attack instead of attackoneround.
You are free to improve those scripts.
GuardEE3 sample code:
IF
See(ThirdNearestEnemyOf(Myself))
Range(ThirdNearestEnemyOf(Myself),10)
THEN
RESPONSE #100
Attack(ThirdNearestEnemyOf(Myself))
END
IF
See(SecondNearestEnemyOf(Myself))
Range(SecondNearestEnemyOf(Myself),10)
THEN
RESPONSE #100
Attack(SecondNearestEnemyOf(Myself))
END
IF
See(NearestEnemyOf(Myself))
Range(NearestEnemyOf(Myself),10)
THEN
RESPONSE #100
Attack(NearestEnemyOf(Myself))
END
2
Comments
for the most part, the advanced AI script works pretty good in the BGEEs, although every once in a while I see that it bugs out in SoA, so maybe later I might work on more custom scripts for my dudes
I'm still wondering if one could script the positioning of the leader in the party formation. That would be cool
I know there are a couple of actions that moves your character relatively from where is positioned at the actual moment(offset movement). With some testing, One could make two scripts that sort of swap positions with those two players