• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Special Effect Won't Go Away

Status
Not open for further replies.
Level 7
Joined
Apr 5, 2013
Messages
243
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.

  • 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
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
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?
 
Level 7
Joined
Apr 5, 2013
Messages
243
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

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

What happens to the building if the building destroyed before it is completely built ?
I think the effect is destroyed as the effect is attached to the structure.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
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.
 
Level 7
Joined
Apr 5, 2013
Messages
243
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.
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
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.
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.
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
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.
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?
 
Level 8
Joined
Feb 6, 2013
Messages
432
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 :|
  • 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
 
Level 7
Joined
Apr 5, 2013
Messages
243
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.
 
Level 8
Joined
Feb 6, 2013
Messages
432
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 :?
 
Level 7
Joined
Apr 5, 2013
Messages
243
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.
 

Attachments

  • AncientEmpiresPreAlpha3.w3x
    4.5 MB · Views: 46

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Seems the problem isn't with the mesh. Destructible doodads as the attachment don't get removed either.
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).
 
Level 7
Joined
Apr 5, 2013
Messages
243
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).

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.
 
Level 7
Joined
Apr 5, 2013
Messages
243
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:

//***************************************************************************
//*
//* 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?
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
Are you tring to remove the Special Effect? If it is, you should set the effect into a variable then Destroy *Variable = Special Effect*. Make sure the variable should be set after you created the special effect to ensure the variable will take effect into a correct Special effect.

Because most problem is that, others do Special Effects and sometimes they dont know that the special effect does not removed because they didnt set the variable into the proper special effect that should be removed!
 
Level 7
Joined
Apr 5, 2013
Messages
243
Nope not solved, Zwiebelchen just solved a bug I created trying to fix this. I'll try both pieces of advice and come up with results.

Edit: Actually I think what you suggest is what I'm already doing.
 
Level 7
Joined
Apr 5, 2013
Messages
243
The first part seems to work well. But the part after the if/then/else bugs (doesn't display the text in game)
  • 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
          • Game - Display to (All players) the text: 1
          • Wait 10.00 seconds
          • Special Effect - Destroy SFX
          • Game - Display to (All players) the text: 2
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
          • Game - Display to (All players) the text: 3
        • Else - Actions
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
The first part seems to work well. But the part after the if/then/else bugs (doesn't display the text in game)
  • 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
          • Game - Display to (All players) the text: 1
          • Wait 10.00 seconds
          • Special Effect - Destroy SFX
          • Game - Display to (All players) the text: 2
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
          • Game - Display to (All players) the text: 3
        • Else - Actions

Try to set Building into Constructed instead of Constructing... just a try.
 
Level 7
Joined
Apr 5, 2013
Messages
243
It says that's for the "finishes construction" event though, doesn't match with "beggins".
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Might be a dumb question... but is the object in question a "Scythian Baracks"?
Your ITE block doesn't even run if no number is shown.

Does the SFX variable exist in the variable editor?

I'm sorry, I don't have the slightest clue why this doesn't work. The thing is: there is definitely nothing wrong with your code.
Can you convert the trigger to custom text and post it here please? This way we can find out when the GUI compiler messes something up.
 
Level 7
Joined
Apr 5, 2013
Messages
243
The objects are correct, I tried it with most of the five in case i had a specific problem but always with the same issue.

The two trigger variables for this trigger are Building/Unit/-none- , SFX/Special Effect/-none.

The trigger is:
  • 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
          • Game - Display to (All players) the text: 1
          • Wait 10.00 seconds
          • Special Effect - Destroy SFX
          • Game - Display to (All players) the text: 2
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
          • Game - Display to (All players) the text: 3
        • 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
          • Special Effect - Destroy SFX
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
        • 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
          • Special Effect - Destroy SFX
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
        • 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
          • Special Effect - Destroy SFX
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
        • 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
          • Special Effect - Destroy SFX
          • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
        • 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
The last part with building is alive is currently disabled, tried to make it work by placing the actions after the wait for each building. Didn't work either way.
 
Level 7
Joined
Apr 5, 2013
Messages
243
It works until after "set SFX", I've tried that already. After the if, then, else is where it stops working.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Can you convert your trigger to custom text and post it here, so we can debug it on the JASS level? I think the GUI compiler messes something up here.

This is a good idea. That would help us debug it.

Also are u sure it stops after the set SFX = last created SFX ?

and ik this doesnt help the problem but it will shorten the trigger a lot.
  • If - Conditions
    • (Unit-type of Building) Equal to Scythian Barracks
  • Then - Actions
    • Game - Display to (All players) the text: 1
    • Wait 10.00 seconds
    • Special Effect - Destroy SFX
    • Game - Display to (All players) the text: 2
    • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
    • Game - Display to (All players) the text: 3
  • 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
      • Special Effect - Destroy SFX
      • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
    • 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
      • Special Effect - Destroy SFX
      • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
    • 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
      • Special Effect - Destroy SFX
      • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
    • 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
      • Special Effect - Destroy SFX
      • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
    • 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

  • 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
  • Special Effect - Destroy SFX
  • Animation - Change Building's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
 
Level 7
Joined
Apr 5, 2013
Messages
243
Can you convert your trigger to custom text and post it here, so we can debug it on the JASS level? I think the GUI compiler messes something up here.

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)
Game - Display to (All players) the text: 1
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


Also are u sure it stops after the set SFX = last created SFX ? [...]

Yes until there the text shows up, if I put it after the If/then/else it doesn't.

I had the trigger this along shorter way (only difference, last part needs a condition = Building is alive else the special effect doesn't show up, nor the building model). I changed it only to check if the other way worked, it didn't so now it's changed back (check the hidden code).
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
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)
Game - Display to (All players) the text: 1
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




Yes until there the text shows up, if I put it after the If/then/else it doesn't.

I had the trigger this along shorter way (only difference, last part needs a condition = Building is alive else the special effect doesn't show up, nor the building model). I changed it only to check if the other way worked, it didn't so now it's changed back (check the hidden code).

No what he meant is JASS. Custom Text. Go to your trigger and go to Edit then Convert to Custom text.
 
Level 7
Joined
Apr 5, 2013
Messages
243
No what he meant is JASS. Custom Text. Go to your trigger and go to Edit then Convert to Custom text.

Wups:p
Here it is then:
JASS:
function Trig_Untitled_Trigger_003_Copy_Func014C 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_Copy_Conditions takes nothing returns boolean
    if ( not Trig_Untitled_Trigger_003_Copy_Func014C() ) then
        return false
    endif
    return true
endfunction

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

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

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

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

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

function Trig_Untitled_Trigger_003_Copy_Func013C takes nothing returns boolean
    if ( not ( IsUnitAliveBJ(udg_Building) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Untitled_Trigger_003_Copy_Actions takes nothing returns nothing
    local effect udg_SFX
    local unit udg_Building
    set udg_Building = GetConstructingStructure()
    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_2721" )
    if ( Trig_Untitled_Trigger_003_Copy_Func008C() ) then
        call TriggerSleepAction( 10.00 )
    else
    endif
    if ( Trig_Untitled_Trigger_003_Copy_Func009C() ) then
        call TriggerSleepAction( 5.00 )
    else
    endif
    if ( Trig_Untitled_Trigger_003_Copy_Func010C() ) then
        call TriggerSleepAction( 20.00 )
    else
    endif
    if ( Trig_Untitled_Trigger_003_Copy_Func011C() ) then
        call TriggerSleepAction( 10.00 )
    else
    endif
    if ( Trig_Untitled_Trigger_003_Copy_Func012C() ) then
        call TriggerSleepAction( 120.00 )
    else
    endif
    if ( Trig_Untitled_Trigger_003_Copy_Func013C() ) then
        call DestroyEffectBJ( udg_SFX )
        call SetUnitVertexColorBJ( udg_Building, 100, 100, 100, 100.00 )
    else
    endif
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_003_Copy takes nothing returns nothing
    set gg_trg_Untitled_Trigger_003_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_003_Copy, EVENT_PLAYER_UNIT_CONSTRUCT_START )
    call TriggerAddCondition( gg_trg_Untitled_Trigger_003_Copy, Condition( function Trig_Untitled_Trigger_003_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_003_Copy, function Trig_Untitled_Trigger_003_Copy_Actions )
endfunction
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Ah, I see the problem now.
It is indeed a problem with GUI messing something up!

The problem is that you used a shadowed local and used this shadowed local in the conditional blocks.
As you can see in the JASS script, the conditions get "outsourced", which means they call a seperate function. However, inside this seperate function, the local is not existant anymore, because, well, it is a local!

In order to fix this, we need an additional global unit variable that is not going to be a shadowed local, but has to be "fed" by the shadowed local at each time frame (so before and after the wait).
Let's just call it "TempUnit".
Change all conditions in the if-then-else blocks to "TempUnit".
Then, before the if-then-else blocks and after the if-then-else blocks, set TempUnit = Building to generate a temporary global out of your shadowed local!

  • 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)
    • Set TempUnit = Building
    • 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)
    • Game - Display to (All players) the text: 1
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of TempUnit) 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 TempUnit) 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 TempUnit) 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 TempUnit) 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 TempUnit) Equal to Scythian Civ Center
      • Then - Actions
        • Wait 120.00 seconds
      • Else - Actions
    • Set TempUnit = Building
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (TempUnit is alive) Equal to True
      • Then - Actions
        • Special Effect - Destroy SFX
        • Animation - Change TempUnit's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Else - Actions
    • Custom script: Set udg_SFX = null
    • Custom script: Set udg_Building = null
EDIT:
We should have done this JASS investigation earlier. Could have saved a lot of time.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Ah, I see the problem now.
It is indeed a problem with GUI messing something up!

The problem is that you used a shadowed local and used this shadowed local in the conditional blocks.
As you can see in the JASS script, the conditions get "outsourced", which means they call a seperate function. However, inside this seperate function, the local is not existant anymore, because, well, it is a local!

In order to fix this, we need an additional global unit variable that is not going to be a shadowed local, but has to be "fed" by the shadowed local at each time frame (so before and after the wait).
Let's just call it "TempUnit".
Change all conditions in the if-then-else blocks to "TempUnit".
Then, before the if-then-else blocks and after the if-then-else blocks, set TempUnit = Building to generate a temporary global out of your shadowed local!

  • 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)
    • Set TempUnit = Building
    • 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)
    • Game - Display to (All players) the text: 1
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of TempUnit) 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 TempUnit) 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 TempUnit) 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 TempUnit) 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 TempUnit) Equal to Scythian Civ Center
      • Then - Actions
        • Wait 120.00 seconds
      • Else - Actions
    • Set TempUnit = Building
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (TempUnit is alive) Equal to True
      • Then - Actions
        • Special Effect - Destroy SFX
        • Animation - Change TempUnit's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Else - Actions
    • Custom script: Set udg_SFX = null
    • Custom script: Set udg_Building = null
EDIT:
We should have done this JASS investigation earlier. Could have saved a lot of time.

ya we really shouldve had it converted to jass. I hate how GUI converts conditions. It really is horrible. Hopefully we will remember this the next time we see a local variable being used with conditions lol.
 
Level 7
Joined
Apr 5, 2013
Messages
243
Ah, I see the problem now.
It is indeed a problem with GUI messing something up!

The problem is that you used a shadowed local and used this shadowed local in the conditional blocks.
As you can see in the JASS script, the conditions get "outsourced", which means they call a seperate function. However, inside this seperate function, the local is not existant anymore, because, well, it is a local!

In order to fix this, we need an additional global unit variable that is not going to be a shadowed local, but has to be "fed" by the shadowed local at each time frame (so before and after the wait).
Let's just call it "TempUnit".
Change all conditions in the if-then-else blocks to "TempUnit".
Then, before the if-then-else blocks and after the if-then-else blocks, set TempUnit = Building to generate a temporary global out of your shadowed local!

  • 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)
    • Set TempUnit = Building
    • 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)
    • Game - Display to (All players) the text: 1
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Unit-type of TempUnit) 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 TempUnit) 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 TempUnit) 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 TempUnit) 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 TempUnit) Equal to Scythian Civ Center
      • Then - Actions
        • Wait 120.00 seconds
      • Else - Actions
    • Set TempUnit = Building
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (TempUnit is alive) Equal to True
      • Then - Actions
        • Special Effect - Destroy SFX
        • Animation - Change TempUnit's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
      • Else - Actions
    • Custom script: Set udg_SFX = null
    • Custom script: Set udg_Building = null
EDIT:
We should have done this JASS investigation earlier. Could have saved a lot of time.

Thanks a lot:) And thanks to everyone else who tried to help as well)
 
Level 7
Joined
Apr 5, 2013
Messages
243
There's still some issue now that I tested it.

Custom script: Set udg_SFX = null
Custom script: Set udg_Building = null

Appear as errors (expected endif) when I try to save.

When I disable them and try the trigger, the building model hides upon finishing construction. Are they responsible for it?
 
Level 7
Joined
Apr 5, 2013
Messages
243
Cheers, that is fixed:) Still the building model remains invisible upon construction though.
 
Level 7
Joined
Apr 5, 2013
Messages
243
Does your model used for the building have the attachment point "origin"?
Better create that SFX at coordinates, not attached to the building.

Since the trigger seems correct, shouldn't there be another way around it? If not, would I need some custom script to work with the coordinates/avoid leaks? Also could it have issues like needing an extra trigger for effect destruction?
 
Level 7
Joined
Apr 5, 2013
Messages
243
destruction is the same. u just create it at position of unit rather than attached to unit. also u need to clear the point leak when u do it this way.

And how do I clear the point leak please?

Edit:Actually i think it has something to do with the transparency. Setting it to 100% first/0% after construction, makes the building as well as the effect invisible until construction is done. Setting the opposite, makes both the building and the effect visible during construction and hides both of them after it's done.
 
Level 7
Joined
Apr 5, 2013
Messages
243
http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
also plz dont double post instead hit the edit button in the bottom right of ur last post
setting the building's transparency to 0 wont affect the effect

1) Thanks:) It's the Custom script: call RemoveLocation(udg_loc) right?
2) I've merged them already as soon as I remembered that:)
3) What happens according to my tests is:
-Invisible building through transparency change = Invisible Effect
-Visible building through transparency change = Visible Effect
 
Status
Not open for further replies.
Top