Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Akamatsu

Pages: [1] 2
1
I've always done projects by myself for the most part I just spend 1-2 years working on it.

there is only 1 game I have worked on with a team and that's SCP containment Breach

I normally pick things up pretty fast so I'm not to worried but if somebody has the free time to help I will not complain.

2
That's a good idea never thought about that.

3
Also I'm always looking for help with my project if anyone is interested it's quite a large scale for one person i'll be showing off screenshots and such at a later point once I feel things are up to my standards I could always use another person on the project no matter what you can do.

I'll be sure to give a special thank you to Diarandor and Max

4
Code: Lua
  1. local enemy = ...
  2. local game = enemy:get_game()
  3. local map = enemy:get_map()
  4. local hero = map:get_hero()
  5. local sprite = enemy:create_sprite("enemies/Redead2")
  6. local movement
  7. local IsPlayerFrozen = false
  8.  
  9.  
  10. function enemy:on_created()
  11.  
  12. movement = sol.movement.create("target")
  13.  
  14.   enemy:set_life(8)
  15.  
  16.   enemy:set_damage(10)
  17.  
  18. end
  19.  
  20.  
  21.  
  22.  
  23.  
  24. function enemy:on_restarted()
  25.  
  26. sol.timer.start(self, 3000, function() sol.audio.play_sound("Redead/RedeadMoan") end)
  27.  
  28. self:get_sprite():set_animation("immobilized")
  29.  
  30. enemy:check_hero()
  31.  
  32. end
  33.  
  34.  
  35.  
  36. function enemy:check_hero()
  37.  
  38.    if self:get_distance(hero) <= 80 then
  39.  
  40.    movement = sol.movement.create("target")
  41.  
  42.    self:get_sprite():set_animation("walking")
  43.  
  44.    movement:set_speed(28)
  45.  
  46.    movement:start(enemy)
  47.  
  48. end
  49. sol.timer.start(self, 1000, function() self:check_hero() end)
  50.  
  51. if self:get_distance(hero) <= 80 then
  52.  
  53. if IsPlayerFrozen == false then
  54.  
  55.    sol.timer.start(self, 3000, function() hero:freeze() end)
  56.  
  57.    IsPlayerFrozen = true
  58.  
  59. end
  60.  
  61. end
  62.  
  63. if self:get_distance(hero) <= 80 then
  64.  
  65. if IsPlayerFrozen == true then
  66.  
  67.    sol.timer.start(self, 5000, function() hero:unfreeze() end)
  68.  
  69.     IsPlayerFrozen = false
  70. end
  71. end
  72. end
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81. function enemy:on_dying()
  82.  
  83. sol.audio.play_sound("Redead/RedeadDie")
  84.  
  85. end

5
it was already fixed before I tried to change it  :D I just changed it back although I kind of have a rough idea of what was wrong with it.

so enemies do not play walking left and right animations by default?

6
Not, sure what their is to explain?

if I use the else feature instead of making another if statement it no longer loops like it does before I changed it.

Basically the hero no longer gets unfrozen and frozen more then once.

7
can you explain a bit more for some reason if I make it else the code doesn't work anymore it just runs it once instead of looping it for some reason.

8
I've been doing that since I started.
I'm going to put my redead code here just in case somebody is looking for one and since you guys helped me it's only fair

I cleaned it up last night and made it look nicer your welcome to look over it and point anything out that may have been done wrong or could have been done better but it works like it should doesn't mean it couldn't be improved.

Code: Lua
  1. local enemy = ...
  2. local game = enemy:get_game()
  3. local map = enemy:get_map()
  4. local hero = map:get_hero()
  5. local sprite = enemy:create_sprite("enemies/Redead2")
  6. local movement
  7. local IsPlayerFrozen = false
  8.  
  9.  
  10. function enemy:on_created()
  11. movement = sol.movement.create("target")
  12.   enemy:set_life(8)
  13.   enemy:set_damage(10)
  14. end
  15.  
  16.  
  17.  
  18.  
  19.  
  20. function enemy:on_restarted()
  21.   sol.timer.start(self, 3000, function() sol.audio.play_sound("Redead/RedeadMoan") end)
  22.   self:get_sprite():set_animation("immobilized")
  23.   enemy:check_hero()
  24. if self:get_distance(hero) <= 80 then
  25. if IsPlayerFrozen == false then
  26.   sol.timer.start(self, 3000, function() hero:freeze() end)
  27.   IsPlayerFrozen = true
  28.   sol.audio.play_sound("Redead/RedeadScream")
  29. end
  30. end
  31.   if self:get_distance(hero) <= 80 then
  32.   if IsPlayerFrozen == true then
  33.   sol.timer.start(self, 5000, function() hero:unfreeze() end)
  34.   IsPlayerFrozen = false
  35. end
  36. end
  37. end
  38.  
  39.  
  40.  
  41. function enemy:check_hero()
  42.   if self:get_distance(hero) <= 80 then
  43.   movement = sol.movement.create("target")
  44.   self:get_sprite():set_animation("walking")
  45.   movement:set_speed(28)
  46.   movement:start(enemy)
  47. end
  48. sol.timer.start(self, 1000, function() self:check_hero() end)
  49. end
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. function enemy:on_dying()
  59. sol.audio.play_sound("Redead/RedeadDie")
  60. end
  61.  
  62.  

9
Yes, that's exactly what I did

10
ah I figured out why it was giving errors I kind of feel dumb now I was putting code like this

Code: Lua
  1. if game:get_value("Sleeping") == 2
  2. then movement:set_target(hero)
  3. then movement:set_target(hero)
  4. then movement:set_target(hero)
  5. end

I actually had no idea how to use the local function this is basically the same thing as a reference from elder scrolls engine's I was wondering if their was a way to use this type of feature but I just didn't understand how to declare it this helps me out VERY much seriously thanks for explaining this will make things much smoother  :D

11
Okay,

Thank you so much for your help the reason I wrote

Code: Lua
  1. if game:get_value("Sleeping") == 2

for each one is because for whatever reason it was giving me errors if I tried to group them under one .

no clue why it did this for me maybe I just did it wrong not 100% sure

either way thanks for the tips I learned coding on other engines but I have not really messed with lua before so it's still kind of new to me.

12

Here is the code.


Code: [Select]


local enemy = ...
local game = enemy:get_game()
local map = enemy:get_map()
local hero = map:get_hero()
local sprite
local movement
local sprite = enemy:create_sprite("enemies/" .. enemy:get_breed())

-- Event called when the enemy is initialized.
function enemy:on_created()
if game:get_value("Sleeping") == nil
then game:set_value("Sleeping",1)
end

  enemy:set_life(25)
  enemy:set_damage(12)
enemy:get_damage()
self:set_pushed_back_when_hurt(false)
end

function enemy:get_damage()
enemy:set_hurt_style("monster")
self:set_animation("sleeping")
end


function enemy:on_hurt()
if game:get_value("Sleeping") == 1
then game:set_value("Sleeping",2)
end
sol.audio.play_sound("IronKnuckle/Iron_KnuckleHit")
sol.audio.play_music("MiniBossTheme")
end

function enemy:on_dead()
enemy:create_enemy{
name = "UnarmoredIronKnuckle",
      breed = "IronKnuckle Early Unarmored",
}
sol.audio.play_sound("IronKnuckle/Iron_KnuckleLoseArmor")
end

function enemy:on_restarted()
if game:get_value("Sleeping") == 2
then movement = sol.movement.create("target")
end
if game:get_value("Sleeping") == 2
then movement:set_target(hero)
end
if game:get_value("Sleeping") == 2
then movement:set_speed(15)
end
if game:get_value("Sleeping") == 2
then movement:start(enemy)
end
if game:get_value("Sleeping") == 2
then sprite:set_animation("walking")
end
end

13
Yeah,

I'm not sure either I did have local enemy = ... I honestly have no idea why but when I changed it to self instead of enemy it worked I can send you the whole code if you want to take a look maybe I did something wrong?

Honestly I'm much better at making sprites then coding so far so I really need to work on that is their a way for me to get in touch with you guys like steam or discord maybe?

I don't want to bother you with to many questions but you guys seem nice and I could use your advice on how things look and act if that's fine with you of course.

14
"Using the tag code = lua inside square brackets is super helpful is people are looking over your code, so you might do that next time. Have you used BBC formatting like that before? You can just copy and paste the whole enemy script so someone helping you can see how things are related.

One thing it looks like in your create-a-bat code is that enemy:create_enemy() needs x and y coordinates specified, or else you're creating it up at 0,0: the top left corner of the map. Perhaps they're being created but you can't see them up there for some reason?

Also, when are you calling your timer? You should probably call the timer in the enemy:on_restarted() event, or enemy:on_created()
It doesn't look like you're ever calling the timer?"

Actually I have it set to create the bat's on self and sorry I had no idea you could use brackets  ??? what I was doing in my code doesn't work it seems what I tried to do was when the enemy was created make it run a check_hero command then under the function check hero make it spawn the bat and set a timer to check the hero again seems that doesn't work though.

I just tested out trying to set the timer under enemy:on_restarted() and it worked!
Thanks for the help!

Sorry, for my ignorance.

15
Okay so I managed to figure it out for some reason you can't use

enemy:set_pushed_back_when_hurt(false)

it has to be

self:set_pushed_back_when_hurt(false)

there is one more issue I'm having with my mini boss I'm trying to make him spawn bats every 3 seconds but its not working mind taking a look at the code?

here is the first bit

function enemy:on_created()
  self:set_pushed_back_when_hurt(false)
  self:set_hurt_style("boss")
  sprite = enemy:create_sprite("enemies/Ghomess")
  enemy:set_life(100)
  enemy:set_damage(9)
  enemy:check_hero()

end

I used   enemy:check_hero() to make it run the next part

function enemy:check_hero()
enemy:create_enemy{
name = "BadBat",
     breed = "BadBat",
}

sol.timer.start(self, 3000, function() enemy:check_hero() end)
end

it seems to be an issue with the timer it doesn't work for some reason not sure why do you notice anything wrong?


Pages: [1] 2