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
Development / Re: Slowdown after leaving the game on for a while
« on: September 30, 2018, 04:51:16 am »
@Christopho

I've got a compiled version and have not had this issue how long does it have to be running?

2
Add me on discord Akamatsu#5130 shouldn't be to hard to figure out how i've got some stuff I'd like to share with you in private and get your thoughts or opinions.

I also was able to get a script to work that we talked about but it's sort of limited for now I can explain more in detail on their.

3
@Max Sorry about this being a bit off topic and all but is their a way I can contact you to share some stuff with you?
I sent you that message forever ago the one you replied to I've got some stuff to discuss with you in private  ;D

do you have steam/Discord?


4
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.

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

6
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

7
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

8
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?

9
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.

10
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.

11
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.  

12
Yes, that's exactly what I did

13
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

14
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.

15

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

Pages: [1] 2