edited July 21 in ORK Scripting
I want a spawner to respawn if the variable conditions match.

However, the Combatant Spawner seems to not respawn once it has been spawned.

Here's the scenario I want:
1. Respawn monsters whenever the bool variable is false. And if the player kills the monster summoned by the Spawner, the bool variable becomes true.

And, through the game event, we make the bool variable false.
in this way , the spawner should respawn monster each time the conditions are met.
but above scenario does not work.
Need advice.
How do I set up the Spawner?

This is my combatant spawner setting.
View post on imgur.com
View post on imgur.com
View post on imgur.com
What is wrong?


2. What does the scene id part mean?
Is this a function that only works when changing the scene?

3. What is the difference between the requirement and the variable condition in the variable settings? I don't understand this part well.
Aren't they two doing the same thing?

4.The purpose of auto destroy and repeat check
Like the removing wall in the tutorial, is the object destroyed if the variable conditions do not match?

5.The isSpawned field in combatantSpawner.cs seems to do the job, right?
Post edited by KESHYAS on
  • yeah, It seems they only run at startup. You may instead want a game event that spawns a combatant when a trigger or variable is set
    Shadowcaste
  • 1) The spawner would only respawn if you leave the scene and come back with that setup. The Repeat Check is only for the initial spawning and is done once the first spawn happens.

    2) The Scene ID is basically doing what you try in #1 - it'll set that combatant/battle to already be done once it was killed, preventing further spawns/battles with the same ID (in that scene). Scene IDs can be removed/set via the event system.
    It's the same as with item collectors, where you use the scene ID to have the item marked as already collected.

    3) I'm not sure what you mean, but if you're talking about the Condition Type difference between Variable and Conditions, it's this:
    - Variable checks a single variable
    - Conditions can check multiple variables, allowing you to have more complex/nested checks
    E.g.: only using variables, you could check:
    - A & B & C
    - A || B || C
    Using conditions, you can check:
    - A & (B || C)
    - A || (B && C)

    4) Auto destroy will destory the game object when the conditions don't match, which is done when the component/game object is first loaded (e.g. when loading the scene or spawning a prefab). With Repeat Check, it'll repeat that check again and again.

    5) Depends on what the job is :)
    The field itself just internally marks the spawner that it spawned something, so that it can despawn them if needed or store the position if needed.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you for the detailed answer!!

    3) I asked the difference between Combatant Spawner's Combatant Settings> Requirements and Variable Conditions in Variable Settings.
    As in the picture below.. (i.e I think the two functions do the same thing, is there a difference? Or is it a matter of complexity like your answer?)
    View post on imgur.com
    View post on imgur.com
    5) If I manipulate the isSpawned in combatantSpanwer.cs (i.e isSpawned = false if I want to respawn a monster, in my script) I think I can achieve the desired function, right?
    (When the variable condition for respawning a monster in one scene matches)
    And
    There will also be a way to spawn monsters whenever the variable conditions match using game events. Which method do you recommend?
    (However, in the game event, is there an iterative check node like the update function? Because the variable matching condition must be checked every time in the game event)
  • 3) Ah, ok - yeah, that's pretty easy to explain:
    The combatant's requirements determine if that combant/group is spawned, the spawner's requirements determine if the whole spawner is used.

    5) No, as said, isSpawned is only a flag used for some functionality, the spawned combatant data is in the spawned array, which is used for spawning/respawning.

    If you're using game events, you can control your spawner using the Start Combatant Spawner and Despawn Combatant Spawner nodes. Setting the spawner's start type to None will let you control it via the event completely, where you can first do all the checks you need (e.g. variables) and spawn or despawn combatants according to that, instead of setting that up on the spawner.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you!
    Start Combatant Spawner Node & Despawn The Combatant Spawner node seems to be what I really want!

    Last question
    Will the following scenario work well?

    1. There are 3 combatant spawners.
    Each start type is set to None.

    2. Summon 3 combatants (monsters) through the Start Combatant Spawner Node.

    3. Kill one monster. Two monsters remain.

    4. In my script, I run a Despawn Combatant Spawner node for each of the three combatant Spawners.

    5. In this case, is the CombatantSpawner of the already dead monster also despawned??
    (I want to easily manage all the spawners , so I want to despawn all the spawners at the same time(including spawner owned by dead combatant) because it's handy)

    In this case, do i get an error because i tried to despawn a non-existent combatant?

    (i.e. 1 of the 3 spawners summoned a monster, but was killed by the player, and the other 2 spawners summoned the monster, but are still alive)
    In the above case, do i have any problems with despawning all the spawners?
  • No, the combatant spawner isn't despawned, just the combatant. Despawning in that regard would just be destroy (or disable) the spawner's game object, and you can do that whenever you like :)

    If the spawners are all removed, it shouldn't really affect the combatants, they'll just not be able to respawn/despawn like that :)

    Also, you can access a combatant's spawner and despawn functionality via the combatant's group:
    combatant.Group.SpawnOrigin
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Sorry for my inexperienced English.
    It's a good answer, but I think I asked the wrong question.

    What I meant was,
    After the 3 Combatant Spawners summon the monster, in order to summon them again, each Spawner's despawn function must be executed (Because IsSpawned should be false, quantity should be --)

    However, the dispawn function includes code that destroys the monster summoned by spawner

    i.e, what I want is,
    the spawner summons the monster, but the player kills it. And i want to execute the despawn function of the spawner. (for spawner to perform spawn function again)
    In this process, it probably seems that the Spawner's dispawn function will destroy the non-existent combatant(killed by player).
    Doesn't this cause an error?
  • No, that shouldn't really cause an issue - if the combatant is already destroyed, it'll not destroy it a 2nd time.

    Also, if you use the respawn options of the spawner, that's handled automatically.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • thanks!!! it much helped
Sign In or Register to comment.