Author Topic: Allied AI Script Project Alpha  (Read 528 times)

Zefk

  • Sr. Member
  • ****
  • Posts: 492
  • Just helping Solarus
    • View Profile
    • Zelzec Business
Allied AI Script Project Alpha
« on: April 17, 2017, 01:55:54 am »
Allied AI Project Alpha

I recently started working on a Allied AI script while working on the book project. I am panning only 2 allies like in Secret of Mana (Seiken Densetsu 2).

Finished: (All lag is due to bad gifs, the Solarus engine runs fine)
  • Basic Follower Script - The Ally custom entity follows the hero and when the ally gets stuck (hit an obstacle), it searches for the hero.

I seriously cannot believe at how easy this is to program. Thank you Christopho for the amazing functions.


Not finished:
  • Melee
  • Projectiles
  • Custom Entity Enemy
  • Enemy
« Last Edit: April 17, 2017, 02:13:21 am by Zefk »

Zefk

  • Sr. Member
  • ****
  • Posts: 492
  • Just helping Solarus
    • View Profile
    • Zelzec Business
Re: Allied AI Script Project Alpha
« Reply #1 on: May 14, 2017, 02:13:09 am »
Here is a cool function I made for this project. The lib I am making has a bunch of other functions to make showing images easier. This was made to display stats, item amounts, etc.



It is declared like this.

Code: Lua
  1. game:set_value("money", 2)
  2. game:set_value("gem", 3)
  3. game:set_value("silver", 4)
  4.  
  5. entity:font_draw(1,"MONEY: ", 30, 50, "money")
  6.  
  7. entity:font_draw(2,"GEM: ", 30, 80, "gem")
  8.  
  9. entity:font_draw(3,"SILVER: ", 30, 110, "silver")
  10.  
  11. entity:font_create(3, font_name, text_size, render_mode, color_rgb, map)
  12.  
  13. --remove gem text
  14. entity:font_undraw(2)
  15.  
  16. --true remove all text
  17. entity:font_undraw(font_index, true)
« Last Edit: May 14, 2017, 02:25:36 am by Zefk »

Zefk

  • Sr. Member
  • ****
  • Posts: 492
  • Just helping Solarus
    • View Profile
    • Zelzec Business
Re: Allied AI Script Project Alpha
« Reply #2 on: May 16, 2017, 09:07:31 am »
These sprite draw functions that I made for this project can draw a sprite at:

1. The hero
2. An entity
3. A position

It can remove:

1. Any sprite index
2. All of them at once

By default it uses a death animation.

Code: Lua
  1. --create 4 sprites and draw on map
  2. entity:sprite_create(4, map)
  3.  
  4. --Draw at coordinates
  5. entity:sprite_draw(1,"main_heroes/eldran", 130,100, true)
  6.  
  7. --Draw at coordinates
  8. entity:sprite_draw(2,"main_heroes/eldran", 100,100, true)
  9.  
  10. --draw at hero
  11. entity:sprite_draw(3,"main_heroes/eldrina/eldrina", 0,0, true, start_anime, start_sound, end_anime, end_sound, true, hero_visable, false)
  12.  
  13. --draw at an entity named "old"
  14. entity:sprite_draw(4,"main_heroes/eldrina/eldrina", 0,0, true, start_anime, start_sound, end_anime, end_sound, hero_pos, hero_visable, false, direction, true,"old", entity_visable)
  15.  
  16. --remove sprite 1
  17. entity:sprite_undraw(1)
  18.  
  19. --remove all sprites if true
  20. entity:sprite_undraw(1,true)
  21. --or
  22. --remove all sprites if true
  23. entity:sprite_undraw(true)

They all fall down.
« Last Edit: May 18, 2017, 07:50:58 pm by Zefk »