• 🏆 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] Unit Transparency

Status
Not open for further replies.
Level 9
Joined
Oct 17, 2007
Messages
547
I made these GUI triggers so that whenever a hero gets inside a region that covers a house it adjust the transparency of that house unit to 50% allowing the player to see inside and when the hero leaves that region the house unit goes back to 0% transparency.

For some reason it only work on 1/2 of the houses numberes 4,5,6 and 7,8,9 the houses numbered 1,2,3 and 10,11,12 doesn't seem to change transparency when a unit gets inside the region. None of the working house units change back to 0% transparency after the unit leaves.

Heres the code for entering:

  • Enter Player Houses
    • Events
      • Unit - A unit enters HouseP1 <gen>
      • Unit - A unit enters HouseP2 <gen>
      • Unit - A unit enters HouseP3 <gen>
      • Unit - A unit enters HouseP4 <gen>
      • Unit - A unit enters HouseP5 <gen>
      • Unit - A unit enters HouseP6 <gen>
      • Unit - A unit enters HouseP7 <gen>
      • Unit - A unit enters HouseP8 <gen>
      • Unit - A unit enters HouseP9 <gen>
      • Unit - A unit enters HouseP10 <gen>
      • Unit - A unit enters HouseP11 <gen>
      • Unit - A unit enters HouseP12 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Unit-type of (Triggering unit)) Not equal to Storage Manager
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (HouseRegion[(Integer A)] contains (Triggering unit)) Equal to True
            • Then - Actions
              • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
              • Animation - Change HousePlayer[(Integer A)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
              • Custom script: endif
            • Else - Actions
Heres the leaving trigger
  • Leave Player Houses
    • Events
      • Unit - A unit leaves HouseP1 <gen>
      • Unit - A unit leaves HouseP2 <gen>
      • Unit - A unit leaves HouseP3 <gen>
      • Unit - A unit leaves HouseP4 <gen>
      • Unit - A unit leaves HouseP5 <gen>
      • Unit - A unit leaves HouseP6 <gen>
      • Unit - A unit leaves HouseP7 <gen>
      • Unit - A unit leaves HouseP8 <gen>
      • Unit - A unit leaves HouseP9 <gen>
      • Unit - A unit leaves HouseP10 <gen>
      • Unit - A unit leaves HouseP11 <gen>
      • Unit - A unit leaves HouseP12 <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Unit-type of (Triggering unit)) Not equal to Storage Manager
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (HouseRegion[(Integer A)] contains (Triggering unit)) Equal to True
            • Then - Actions
              • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
              • Animation - Change HousePlayer[(Integer A)]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
              • Custom script: endif
            • Else - Actions
I'm not sure which of these line of trigger are at fault for them not working, please take a look at them and let me know.
 
Level 13
Joined
Sep 14, 2008
Messages
1,407
Well I am not sure but I think there is an "if" mistake in the second trigger.

Let's see:

For...
(
if(HouseRegion(integer a) contains triggering unit = true)
)

But does the region contain the unit when the event is "unit leaves region"?
That could stop the trigger from working.



I don't know why only some houses work but I can only guess:

The array HouseRegions is not set right
 
Level 9
Joined
Oct 17, 2007
Messages
547
I just realize what you said about the second trigger. Thanks. Made a copy of teh first one and forgot to change that part.

I can see all the houses when i enter one of them.. none of them change visibility when i enter houses 1,2,3 and 10,11,12

The array is set correctly since I was setting it one by one as i add the houses.
 
Last edited:
Status
Not open for further replies.
Top