pinoyaida's Forum Posts

  • 9 posts
  • You do not pass a parameter to your function, yet uses a reference to this parameter when you check that DropChance is less than some value.

    The value is then always 0. Few chances that DropChances is less or equal 0.

    Hmm that seems like whats happening after I got a closer look. The obj_drop was spawning but at 0,0. I tried referencing my 'Enemy 1' and the Enemy Family but they still make the drop object somewhere off screen. I thought using the function as the parameter will reference the coordinates were the function was run. Im running out of things for the system to create this drop object.

    I STRONGLY suggest you dont use arrays for this. Either use json (with the awesome plugin that a member made - French Yann iirc) or a mix of arrays and dictionaries, populating them from a configuration file.

    THis plugin looks awsome! thanks! I plan on making a JSON file in Sublime for importing after i get the drop function to work with a smaller array. I am following this tutorial by English Acorn once I get to that point. (https://www.youtube.com/watch?v=ZPG1t-gZfds&t=1861s)

  • In the example and the tutorial, they are part of a function.

    So it is actually more local variables than instances variables which are temporary used for the logic when in the function.

    You can click on the "Download attachments" button on the right, and open the "BeastDropBatch.capx" file in order to see the implementation in Construct of this code.

    Alright. I managed to get something with the example and changed a few things to match my monster drop function needs. The debugger shows the function is running and variables are changing (not yet sure to the correct values). However, the monsters aren't dropping anything upon death. I have the monster 'Enemy_001' in a family and when its HP reaches 0 it destroys itself and calls function 'mon_killed'. The function is as below:

    The obj_Drops has separate animations for each kind of drop because I am looking to animate each drop type later. Can I get a second set of eyes on this?

  • Wow thanks! I missed that link. Ill see what i can do with these and get back to you.

  • ALright. So I have two Arrays called arr_enemy and arr_drops and i set them up as On Start of Layout, set size (#,#,#) and then populated each according to the screenshot below.

    I am following this wonderful guide (https://gamedevelopment.tutsplus.com/tutorials/how-to-code-monster-loot-drops--cms-20449). So now I have arr_stats and arr_temp to help assist with the function I am trying to make. The end goal is to have a enemy drop collectibles upon death but not every monster can drop every drop 100% of the time. Here is a screenie of the example I am following from the link above:

    I am confused on were the following variables are going on line 22-24.

    int BeastType

    int DropChance

    int Rarity

    Correct me if I am wrong but are they inst.variables I have to set on each enemy? Am I reading this right?

  • I found a good solution. I made a separate Progress Bar for each type of enemy sprite and put them in a container. Such as red_enemy had a container with red_enemy_HPbar (progress bar) inside. then i just remade a few lines of code that was supposed to be intended for the entire enemy family but apparently you cant add containers for families. Here is an excerpt. Thanks for the help!!

    https://imgur.com/a/BwgSzdI

  • Assuming playerprojectiles is the bullet hitting the enemy, the event should be Playerprojectiles on collision with enemy, so you can pick the projectile, then destroy it. That should also fix the hp problems as projectile on collision with enemy will pick that enemy and subtract damage.

    Although family logic can be used to reduce some code such as 'create healthbar for red' 'create healthbar for white' etc, you can still split out some code to define things for different types. To do this, create a family instance variable 'type' and then you can assign all stats to red type and all stats to white type on created. So if type=white it will have the appropriate health.

    Alright each enemy is spawning with their own status but the HP bars are still destroyed after one enemy dies. I have it set up as On created, Spawn HPbar, Set position of HPbar to were i want it above the enemy and pin it. I think i need to mess with a 'For Each' or UIDs. I will definitely need help as its just trial and error at this point.

  • Well one issue I can see is that you haven't made use of the family. The whole point of putting enemies in a family is that you don't have to duplicate code, which you have done. Your code should apply to all enemies so there is definitely some redundant code in there. The health bars at least should be in code like on Enemies created, spawn healthbar. Enemies set healthbar to enemies.hp.

    Anyway the actual bug, it's because your set position for the health bar is in its own event and it does the last one on the event sheet, so every tick it is setting the health bar to the position of enemy 2. The set position events for the health bar do not relate to anything and are independent events. The one above for enemy 1 is ignored, you won't see anything happen for that, and if you look in debug mode you will probably see several health bars in that enemy 2 location overlapping each other.

    As for resolving the issue, if you reduce the code as stated above to on Enemies created, spawn healthbar. You can then pin it to the Enemies position at that point and not every tick.

    Hey thanks for the awesome help. Alright i managed to get the family variables down and came up with rough logic. Here is the event sheet excrept and and shoot of what the preview shows. The 'white' enemy has a higher HP cap but seems to be using the HP of the 'red' enemy and the HP progress bar of the 'red' enemies dosnt go down when a bullet collides with it. Once one 'red' enemy dies, all HP progress bars are destroyed.

    https://imgur.com/gallery/qKMxR6L

    https://imgur.com/gallery/FHB9Bgq

  • So its been hours of fruitless research but heres a quick rundown. I have Enemy1 and Enemy2 in a Family with each having different MaxHP & currentHP Instant Variables attached. I have a EnemyHP progress bar. I enemies spawn and the yellow points seen in the preview and the enemies themselves spawn a HP progress bar. Only the progress bar for Enemy2 shows. Attached is my event sheet and a screenshot of when i preview.

    https://imgur.com/gallery/LErIyjM

    https://imgur.com/gallery/RUW3l84

    I have attempted to use containers but it seems i can place the EnemyHP progress bar into a container more than once. UIDs are giving problems for me as well. I have a mix and match of all past post solutions so thing might have gotten a little messy.

    The end goal is to have a HP progress bar hover over each enemy that spawns that track the currentHP variable of the enemy that spawned it.

    THanks for the help in advance,

    -Pino

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So i have a sprite with multiple image points and they fire from those points every 0.2 seconds. But I want to optimize processing speeds.

    Heres another image of my eventsheet for my Enemy. I have three different enemies all with the same set up. I there a way to save on Events?

    Thanks a bunch

    -Pino

  • 9 posts