1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Trigger] Special Effect Won't Go Away

Discussion in 'Triggers & Scripts' started by Pson, Apr 29, 2013.

  1. Pson

    Pson

    Joined:
    Apr 5, 2013
    Messages:
    239
    Resources:
    0
    Resources:
    0
    Could someone point out what I've got wrong here and the special effect doesn't die when it's supposed to? It's a custom birth mesh trigger and the attached effect model should go away when the wait time ends.

    click
    • Untitled Trigger 003
      • Events
        • Unit - A unit Begins construction
      • Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • (Unit-type of (Constructing structure)) Equal to Scythian Barracks
            • (Unit-type of (Constructing structure)) Equal to Scythian Storehouse
            • (Unit-type of (Constructing structure)) Equal to Scythian Warlord's Stables
            • (Unit-type of (Constructing structure)) Equal to Scythian Market
            • (Unit-type of (Constructing structure)) Equal to Scythian Civ Center
      • Actions
        • Custom script: local effect udg_SFX
        • Custom script: local unit udg_Building
        • Set Building = (Constructing structure)
        • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        • Special Effect - Create a special effect attached to the origin of Building using war3mapImported\BirthMesh.mdx
        • Set SFX = (Last created special effect)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of Building) Equal to Scythian Barracks
          • Then - Actions
            • Wait 10.00 seconds
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Unit-type of Building) Equal to Scythian Storehouse
              • Then - Actions
                • Wait 5.00 seconds
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Unit-type of Building) Equal to Scythian Warlord's Stables
                  • Then - Actions
                    • Wait 20.00 seconds
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Unit-type of Building) Equal to Scythian Market
                      • Then - Actions
                        • Wait 10.00 seconds
                      • Else - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (Unit-type of Building) Equal to Scythian Civ Center
                          • Then - Actions
                            • Wait 120.00 seconds
                          • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Building is alive) Equal to True
          • Then - Actions
            • Special Effect - Destroy SFX
            • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
          • Else - Actions
     
  2. BloodDrunk

    BloodDrunk

    Joined:
    May 11, 2012
    Messages:
    1,963
    Resources:
    1
    Maps:
    1
    Resources:
    1
    why do you use (Building is alive) ?

    move the destroying out of the ITE (right beyont ITE)
    does the other action works?
     
  3. Nichilus

    Nichilus

    Joined:
    Sep 26, 2009
    Messages:
    1,973
    Resources:
    0
    Resources:
    0
    Well, first off, if you are creating more than one of those buildings at a time, your trigger will bug.
    Second, I don't know what you are trying to do, but 0% Transparency means the unit is visible (like all other units) while 100% transparency makes the unit invisible, so you will be able to target it, but you won't see how the building looks like; and only shadow and ground texture will remain.

    Third - why don't you create a second trigger
    • Triggers
      • Events
        • Unit - A unit Finishes construction
      • Conditions
        • (Constructed structure) Equal to Building
      • Actions
        • -------- actions --------

    or do you want the building to become invisible during the its construction?
     
  4. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    it wont bug up because of multiple buildings being created. he uses local variables.

    put some messages in there to see were it stops
     
  5. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,804
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    There's nothing wrong with your trigger.
    Does the sfx model have a proper death animation?
    If it doesn't then the model will disappear after 5 seconds instead of instantly.

    Don't know why, but this is how WC3 handles it.
     
  6. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    What happens to the building if the building destroyed before it is completely built ?
     
  7. Pson

    Pson

    Joined:
    Apr 5, 2013
    Messages:
    239
    Resources:
    0
    Resources:
    0
    Thanks to everyone for the replies. This is where I took it from and then edited the trigger to make it suit my needs. Which explains my cluelessness on what not working and why I can't answer some of the "why you did that part that way" questions: Link

    I think it doesn't have one, cause at first, it worked like that with some delay. I think it stopped working when I fixed the custom scripts to make them work by capitalising the "B" of "Building" variable (I had it as "b" by mistake).

    I think the effect is destroyed as the effect is attached to the structure.
     
  8. deathismyfriend

    deathismyfriend

    Joined:
    Oct 24, 2012
    Messages:
    6,528
    Resources:
    14
    Spells:
    12
    Tutorials:
    2
    Resources:
    14
    Effects don't get destroyed that way. If u want proof make a unit with an effect with a long death animation and kill the unit then watch the effect stay there after the unit is dead. I believe ur problem is what zwiebelchen has said.

    Also if u have a typo with the custom script or the model link then that could easily be ur problem.
     
  9. Pson

    Pson

    Joined:
    Apr 5, 2013
    Messages:
    239
    Resources:
    0
    Resources:
    0
    I just did a test. I knew already that canceling the building during construction removes the effect. Then I tested and destroying it with attacks still removes the effect (but after some seconds - should be the lack of death animation issue).

    Maybe you confuse it with effects created at position instead of attachment?

    Problem isn't the delay, guess I could live with it or find another mesh model. It is that it doesn't disappear at all as long as the building stays alive.
     
  10. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,804
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    Then you are messing up either the Building or the SFX variable. Considering they are both locals, it's very unlikely, so maybe put a debug message into that last ITE block to see if the code even reaches that point.
     
  11. Squiggy

    Squiggy

    Joined:
    Mar 25, 2008
    Messages:
    2,627
    Resources:
    18
    Maps:
    2
    Spells:
    15
    Tutorials:
    1
    Resources:
    18
    Can't you just use a dummy using that model and give it an expiration timer?
    You can kill the dummy if the building is destroyed during construction.
     
  12. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,804
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    That would create additional, unneeded overhead. The trigger above works. Definitely. It's something with the model. Maybe it has a very long animation sequence on death or something. Maybe just upload the model for us to check it out?
     
  13. huy60vn

    huy60vn

    Joined:
    Feb 6, 2013
    Messages:
    414
    Resources:
    0
    Resources:
    0
    Nice to meet you again, Pson!! :D It's a long time I didn't see you.
    About your problems, you need to do this, but I'm not sure that's very correct :|
    Trigger
    • Events
      • Unit - A unit Begins construction
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Constructing structure)) Equal to Scythian Barracks
          • (Unit-type of (Constructing structure)) Equal to Scythian Storehouse
          • (Unit-type of (Constructing structure)) Equal to Scythian Warlord's Stables
          • (Unit-type of (Constructing structure)) Equal to Scythian Market
          • (Unit-type of (Constructing structure)) Equal to Scythian Civ Center
    • Actions
      • Custom script: local effect udg_SFX
      • Custom script: local unit udg_Building
      • Set Building = (Constructing structure)
      • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Special Effect - Create a special effect attached to the origin of Building using war3mapImported\BirthMesh.mdx
      • Set SFX = (Last created special effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Building) Equal to Scythian Barracks
        • Then - Actions
          • Wait 10.00 seconds
          • Special Effect - Destroy SFX
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        • Else - Actions
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Building) Equal to Scythian Storehouse
            • Then - Actions
              • Wait 5.00 seconds
              • Special Effect - Destroy SFX
              • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
            • Else - Actions
              • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Building) Equal to Scythian Warlord's Stables
        • Then - Actions
          • Wait 20.00 seconds
          • Special Effect - Destroy SFX
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
          • Else - Actions
            • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of Building) Equal to Scythian Market
              • Then - Actions
                • Wait 10.00 seconds
                • Special Effect - Destroy SFX
                • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
                • Else - Actions
                  • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Building) Equal to Scythian Civ Center
            • Then - Actions
              • Wait 120.00 seconds
              • Special Effect - Destroy SFX
              • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
              • Else - Actions
                • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
     
  14. Pson

    Pson

    Joined:
    Apr 5, 2013
    Messages:
    239
    Resources:
    0
    Resources:
    0
    Hey Huy:) Checked the trigger you posted on my profile, seems to have the same issues with the old one though. Is this one the same?

    The model is this one, in case it has the faults. Could upload the map as well if that's not the issue.
     
  15. huy60vn

    huy60vn

    Joined:
    Feb 6, 2013
    Messages:
    414
    Resources:
    0
    Resources:
    0
    Uh, it's different a little:
    Conditions
    ---
    Actions
    If/ Then/Else
    ---
    ---
    |__ If/Then/Else
    and
    Conditions
    ---
    Actions
    If/Then/Else
    ---
    ---
    If/Then/Else
    I can't upload now because it's too long :?
     
  16. Pson

    Pson

    Joined:
    Apr 5, 2013
    Messages:
    239
    Resources:
    0
    Resources:
    0
    Seems the problem isn't with the mesh. Destructible doodads as the attachment don't get removed either.

    Attaching the map in case someone can help more. Also if someone can spare the time I could use some other fixes and trigger check-up , credits will be given ofc.
     

    Attached Files:

  17. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,804
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    I don't see any destructables in your trigger? Are you sure you posted everything we need to know?

    I checked your model and as I assumed, it doesn't have a death animation. This means that the model will not disappear instantly when the effect is removed, but after a certain amount of time (more than 5 seconds).
     
  18. Pson

    Pson

    Joined:
    Apr 5, 2013
    Messages:
    239
    Resources:
    0
    Resources:
    0
    I mean I did a test with a destructible instead of the birth mesh, and exactly the same thing happens.

    Got the part with the lack of death anim. But this shouldn't be the issue. I've even observed it for several minutes and it's still there. If this helps, the dust part of the mesh disappears sometime after the construction but still the mesh remains.
     
  19. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,804
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    Then add some debug messages and check where your trigger stops working.
     
  20. Pson

    Pson

    Joined:
    Apr 5, 2013
    Messages:
    239
    Resources:
    0
    Resources:
    0
    Trying to add the texts to check where it bugs, i got a "disabling trigger cause there are script errors" or something message. In bold the lines with errors (kinda low in the spoiler text), the ones where the variables local functions are add:

    click
    //***************************************************************************
    //*
    //* Global Variables
    //*
    //***************************************************************************

    globals
    // User-defined
    dialog udg_FactionSelection = null
    button array udg_FSButton
    dialog udg_FactionSelection2 = null
    dialog udg_FactionSelection3 = null
    dialog udg_FactionSelection4 = null
    force udg_CP_Group = null
    player udg_Temp_Player = null
    unit udg_BirthmeshScythianBarracks = null
    unit udg_BirthmeshScythianStorehouse = null
    unit udg_BirthmeshScythianMarket = null
    unit udg_BirthMeshScythianCivCenter = null
    unit udg_BirthmeshScythianWarlordStable = null
    integer udg_init = 0
    integer udg_init_Copy = 0
    force udg_Alliesofvictor = null
    weathereffect udg_weathereffect = null
    integer udg_WeatherRandom = 0
    unit udg_Building = null
    effect udg_SFX = null

    // Generated
    trigger gg_trg_Melee_Initialization = null
    trigger gg_trg_Selection = null
    trigger gg_trg_Romans = null
    trigger gg_trg_Scythians = null
    trigger gg_trg_Celts = null
    trigger gg_trg_Greeks = null
    trigger gg_trg_Macedonians = null
    trigger gg_trg_Carthaginians = null
    trigger gg_trg_Persians = null
    trigger gg_trg_ComputerPlayer2 = null
    trigger gg_trg_Romans_Copy = null
    trigger gg_trg_Scythians_Copy = null
    trigger gg_trg_Celts_Copy = null
    trigger gg_trg_Greeks_Copy = null
    trigger gg_trg_Macedonians_Copy = null
    trigger gg_trg_Carthaginians_Copy = null
    trigger gg_trg_Persians_Copy = null
    trigger gg_trg_ComputerPlayer3 = null
    trigger gg_trg_Romans_Copy_2 = null
    trigger gg_trg_Scythians_Copy_2 = null
    trigger gg_trg_Celts_Copy_2 = null
    trigger gg_trg_Greeks_Copy_2 = null
    trigger gg_trg_Macedonians_Copy_2 = null
    trigger gg_trg_Carthaginians_Copy_2 = null
    trigger gg_trg_Persians_Copy_2 = null
    trigger gg_trg_ComputerPlayer4 = null
    trigger gg_trg_Romans_Copy_3 = null
    trigger gg_trg_Scythians_Copy_3 = null
    trigger gg_trg_Celts_Copy_3 = null
    trigger gg_trg_Greeks_Copy_3 = null
    trigger gg_trg_Macedonians_Copy_3 = null
    trigger gg_trg_Carthaginians_Copy_3 = null
    trigger gg_trg_Persians_Copy_3 = null
    trigger gg_trg_Morale_Death = null
    trigger gg_trg_Morale_Killer = null
    trigger gg_trg_Morale_AttackerDefender = null
    trigger gg_trg_Stamina = null
    trigger gg_trg_Stamina_Berserk_units = null
    trigger gg_trg_Bloodhounds = null
    trigger gg_trg_Logistics = null
    trigger gg_trg_Scythian_age_up = null
    trigger gg_trg_alex = null
    trigger gg_trg_Advert = null
    trigger gg_trg_trade = null
    trigger gg_trg_Special_Resource = null
    trigger gg_trg_Market_and_colony_income_WIP = null
    trigger gg_trg_AI_trade = null
    trigger gg_trg_MAc_town_income = null
    trigger gg_trg_Coinage = null
    trigger gg_trg_Untitled_Trigger_001 = null
    trigger gg_trg_Untitled_Trigger_002 = null
    trigger gg_trg_And_Bounty = null
    trigger gg_trg_Double_ownership_change = null
    trigger gg_trg_pack_camp = null
    trigger gg_trg_rank_up = null
    trigger gg_trg_hastatus_promote = null
    trigger gg_trg_princeps_promote = null
    trigger gg_trg_Passive_to_hostile = null
    trigger gg_trg_Settlement_Respawn = null
    trigger gg_trg_Sea_Fish_Respawn = null
    trigger gg_trg_Sea_Trade_Respawn = null
    trigger gg_trg_Colony = null
    trigger gg_trg_Sea_Fish = null
    trigger gg_trg_Sea_Trade = null
    trigger gg_trg_Iron = null
    trigger gg_trg_Elephants = null
    trigger gg_trg_Horses = null
    trigger gg_trg_Numidian_Merc = null
    trigger gg_trg_as_said = null
    trigger gg_trg_Untitled_Trigger_003 = null
    trigger gg_trg_VD = null
    endglobals

    function InitGlobals takes nothing returns nothing
    local integer i = 0
    set udg_FactionSelection = DialogCreate()
    set udg_FactionSelection2 = DialogCreate()
    set udg_FactionSelection3 = DialogCreate()
    set udg_FactionSelection4 = DialogCreate()
    set udg_CP_Group = CreateForce()
    set udg_init = 0
    set udg_init_Copy = 0
    set udg_Alliesofvictor = CreateForce()
    set udg_WeatherRandom = 0
    endfunction

    function Trig_Untitled_Trigger_003_Func016C takes nothing returns boolean
    if ( ( GetUnitTypeId(GetConstructingStructure()) == 'h00Y' ) ) then
    return true
    endif
    if ( ( GetUnitTypeId(GetConstructingStructure()) == 'h010' ) ) then
    return true
    endif
    if ( ( GetUnitTypeId(GetConstructingStructure()) == 'h012' ) ) then
    return true
    endif
    if ( ( GetUnitTypeId(GetConstructingStructure()) == 'h015' ) ) then
    return true
    endif
    if ( ( GetUnitTypeId(GetConstructingStructure()) == 'h00Z' ) ) then
    return true
    endif
    return false
    endfunction

    function Trig_Untitled_Trigger_003_Conditions takes nothing returns boolean
    if ( not Trig_Untitled_Trigger_003_Func016C() ) then
    return false
    endif
    return true
    endfunction

    function Trig_Untitled_Trigger_003_Func010C takes nothing returns boolean
    if ( not ( GetUnitTypeId(udg_Building) == 'h00Y' ) ) then
    return false
    endif
    return true
    endfunction

    function Trig_Untitled_Trigger_003_Func011C takes nothing returns boolean
    if ( not ( GetUnitTypeId(udg_Building) == 'h010' ) ) then
    return false
    endif
    return true
    endfunction

    function Trig_Untitled_Trigger_003_Func012C takes nothing returns boolean
    if ( not ( GetUnitTypeId(udg_Building) == 'h012' ) ) then
    return false
    endif
    return true
    endfunction

    function Trig_Untitled_Trigger_003_Func013C takes nothing returns boolean
    if ( not ( GetUnitTypeId(udg_Building) == 'h015' ) ) then
    return false
    endif
    return true
    endfunction

    function Trig_Untitled_Trigger_003_Func014C takes nothing returns boolean
    if ( not ( GetUnitTypeId(udg_Building) == 'h00Z' ) ) then
    return false
    endif
    return true
    endfunction

    function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_2709" )
    local effect udg_SFX
    local unit udg_Building

    set udg_Building = GetConstructingStructure()
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_2711" )
    call SetUnitVertexColorBJ( udg_Building, 100, 100, 100, 0.00 )
    call AddSpecialEffectTargetUnitBJ( "origin", udg_Building, "war3mapImported\\BirthMesh.mdx" )
    set udg_SFX = GetLastCreatedEffectBJ()
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_2710" )
    if ( Trig_Untitled_Trigger_003_Func010C() ) then
    call TriggerSleepAction( 10.00 )
    call DestroyEffectBJ( udg_SFX )
    call SetUnitVertexColorBJ( udg_Building, 100, 100, 100, 100.00 )
    else
    endif
    if ( Trig_Untitled_Trigger_003_Func011C() ) then
    call TriggerSleepAction( 5.00 )
    call DestroyEffectBJ( udg_SFX )
    call SetUnitVertexColorBJ( udg_Building, 100, 100, 100, 100.00 )
    else
    endif
    if ( Trig_Untitled_Trigger_003_Func012C() ) then
    call TriggerSleepAction( 20.00 )
    call DestroyEffectBJ( udg_SFX )
    call SetUnitVertexColorBJ( udg_Building, 100, 100, 100, 100.00 )
    else
    endif
    if ( Trig_Untitled_Trigger_003_Func013C() ) then
    call TriggerSleepAction( 10.00 )
    call DestroyEffectBJ( udg_SFX )
    call SetUnitVertexColorBJ( udg_Building, 100, 100, 100, 100.00 )
    else
    endif
    if ( Trig_Untitled_Trigger_003_Func014C() ) then
    call TriggerSleepAction( 120.00 )
    call DestroyEffectBJ( udg_SFX )
    call SetUnitVertexColorBJ( udg_Building, 100, 100, 100, 100.00 )
    else
    endif
    endfunction

    //===========================================================================
    function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_003, EVENT_PLAYER_UNIT_CONSTRUCT_START )
    call TriggerAddCondition( gg_trg_Untitled_Trigger_003, Condition( function Trig_Untitled_Trigger_003_Conditions ) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
    endfunction


    Could it be the issue is there?

    Also, could it be I need more than unit/special effect for those variables. Some array number or something?