CurseForge and Overwolf are joining forces!
Awesome More Information
  • 0

    posted a message on [Resolved] Duplicate Spawn Prevention

    @bzdover: Go

    Seems to be working. Thanks so much for your help!

    [Resolved].

    Posted in: Triggers
  • 0

    posted a message on [Resolved] Duplicate Spawn Prevention

    @b0ne123: Go

    Using an array check for each wave...brilliant idea! Thanks mate I'll try it and post back with results.

    P.S. Income Wars is an awesome map!

    Posted in: Triggers
  • 0

    posted a message on [Resolved] Duplicate Spawn Prevention

    I've been struggling for some time to correctly implement double and triple spawn prevention via triggers.

    I'm working a basic turret defense map, and the last two units in any given wave are occasionally killed at the same time. I have a trigger set up to count the number of units remaining whenever a unit dies, and if there are none left to spawn the next wave. When the last two or three units die at the same time, the next two or three waves spawn all at once.

    In an attempt to resolve this issue I created a Double Spawn Prevention variable and set it to 0 after spawning a wave. When the final unit in a wave dies, an If / Then/ Else action checks for Double Spawn Prevention == 0, then sets the Double Spawn Prevention variable to 1 and call the Spawn Waves trigger.

    My hope was that this would confine the Spawn Waves trigger to one run per cycle, since the If / Then / Else action would check the Double Spawn Prevention variable and thereby block another spawn until the end of the round. Unfortunately, no such luck.

    Any advice on what else I could try? I've copied some of the relevant triggers below, for reference.

    Unit Dies

    Events
        Unit - Any Unit dies
    Conditions
        (Owner of (Triggering unit)) == 10
    Actions
        General - If (Conditions) then do (Actions) else do (Actions)
            If
                (Number of Living units in (Any units in (Entire map) owned by player 10)) == 0
            Then
                General - If (Conditions) then do (Actions) else do (Actions)
                    If
                        Double Spawn Prevention == 0
                    Then
                        Variable - Set Double Spawn Prevention = 1
                        Trigger - Run Spawn Waves  (Ignore Conditions, Dont Wait until it finishes)
    

    <</code>>

    Spawn Waves

    Local Variables
        Waves = 0 <Integer>
    Actions
        Unit - Create 5 Wave Types[Current Wave Number] for player 10 at (Center of Spawn) (No Options)
        Variable - Set Double Spawn Prevention = 0
    

    Thanks guys!

    Posted in: Triggers
  • To post a comment, please or register a new account.