Type: Allies brain
Level: 3 star
Pages: 1
Description: NPC Ally brain. This character is armed with an astro blaster and will run around in a circular motion firing at enemies.
Kode
- WHEN [once] DO [equip][Astro Blaster
- …WHEN DO [team][equals][team 1]Determines that the player is an ally and offers help
- …WHEN [after][objects closer than][5][player][allies] DO [objvar:my leader][equals][it]
- …/…WHEN [duration timer][2] DO [say][text:Following]
- WHEN [objvar:my leader][equal to][nothing]
- …WHEN [objects closer than][5][allies] DO [objvar:my leader][equals][it]
- WHEN [enemies][objects closer than][20][minus][dead objects]
- …WHEN [countdown timer][1][loop][trigger on start] DO [objvar:myenemy][equals][it]
- …WHEN [else] DO [move][toward][my leader][min distance][4]Attack kode
- WHEN [not][objvar:my enemy][is dead] DO
- …WHEN DO [turn][toward][objvar:my enemy]
- …WHEN [distance to][my enemy][less than][4]
- …/…WHEN [duration][4] DO [move][in direction][right][with strafing][at speed][0.65]
- …WHEN [distance to][objvar:my enemy][less than][15]
- …/…WHEN [countdown timer][numvar:pause attack][loop][trigger on start
- …/…/….WHEN DO [shoot][at][objvar:my enemy][without hit reaction]
- …/…/…WHEN DO [numvar:pause attack][equals][random number][0.9][to][1.25]
- …/…WHEN [else][countdown timer][0.5] DO [move][toward][objvar:my enemy]
Alterations
Randomise the movement direction
Just for a bit more variety randomize which direction the character will move in.
Add at line 13
- …WHEN [started to] DO [numvar:turndirection][equals][random number][1][to][2][as integer]
- …WHEN [numvar:turn direction][equal to][1]
- …/…WHEN [duration][4] DO [move][in direction][right][with strafing][at speed][0.65]
- …WHEN [numvar:turn direction][equal to][2]
- …/…WHEN [duration][4] DO [move][in direction][left][with strafing][at speed][0.65]