• 🏆 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!

[Solved] Creating a building inside of another building (Placement Requirement visual issue)

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Edit:

Here's the solution i'm going with now. Using dummy units for every type of Shop would be a lot easier than this workaround, but I don't want dummy units. Will hiding/unhiding units like this cause any issues? It appears to work fine ingame.

  • Select Shop Copy
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set ushop_SelectUnit = (Triggering unit)
      • Set ushop_tempPlayer = (Triggering player)
      • -------- - --------
      • Set ushop_tempPoint[0] = (Position of ushop_SelectUnit)
      • -------- - --------
      • Set ushop_HideGroup = (Units within 400.00 of ushop_tempPoint[0])
      • Unit Group - Pick every unit in ushop_HideGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A flying unit) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit - Hide (Picked unit)
            • Else - Actions
      • -------- - --------
      • Unit - Create 1 (Unit-type of ushop_SelectUnit) for ushop_tempPlayer at ushop_tempPoint[0] facing Default building facing degrees
      • Set ushop_ShopDummy[(Player number of ushop_tempPlayer)] = (Last created unit)
      • Set ushop_tempUnit = (Last created unit)
      • -------- - --------
      • Unit - Add Select Hero to ushop_tempUnit
      • Unit - Add Sell Items to ushop_tempUnit
      • Unit - Add Invulnerable (Neutral) to ushop_tempUnit
      • Animation - Change ushop_tempUnit's size to (1.00%, 1.00%, 1.00%) of its original size
      • -------- - --------
      • Unit Group - Pick every unit in ushop_HideGroup and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
      • Custom script: call DestroyGroup (udg_ushop_HideGroup)
      • -------- - --------
      • Selection - Select ushop_tempUnit for ushop_tempPlayer
To explain the trigger:

Let's say there's a Goblin Merchant pre-placed on the map. The trigger works like this:
1) You select the Goblin Merchant
2) The Goblin Merchant and nearby units are hidden
3) A copy of the Goblin Merchant is created on top of it
4) The hidden units are all un-hidden
5) The copy or "Dummy" as I refer to it has it's size set to 1% so you can't see it or select it
6) The game automatically selects the "dummy" shop

This gives the illusion that you're still selecting the Goblin Merchant, but you're really selecting
a shop hidden underneath it.

Note:
The only reason I have to hide ALL nearby units is because of player-built shops like Arcane Vault having "Placement Requires: Buildable". This one field messes things up. A pre-placed shop like a Goblin Merchant doesn't have any problems and you don't actually have to hide/unhide anything for it to work.

So don't even bother with this if you're solely working with pre-placed shops.
 

Attachments

  • pic.png
    pic.png
    3.6 MB · Views: 155
Last edited:
Level 8
Joined
Feb 17, 2018
Messages
114
I'm not sure, but try this:
1) in object editor set your moving building movement speed above 0 (1 for example)
2) move your building with your setX setY trigger
3) set your building's movement speed back to 0 with a trigger
4) (optional) report back to me to provide a feedback if it worked or not
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
I'm not sure, but try this:
1) in object editor set your moving building movement speed above 0 (1 for example)
2) move your building with your setX setY trigger
3) set your building's movement speed back to 0 with a trigger
4) (optional) report back to me to provide a feedback if it worked or not

No luck, unless I did it wrong.

  • Select Shop
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set ushop_tempPoint[0] = (Position of Arcane Vault 0010 <gen>)
      • -------- - --------
      • Unit - Create 1 (Unit-type of Arcane Vault 0010 <gen>) for Player 1 (Red) at ushop_tempPoint[0] facing Default building facing degrees
      • Set ushop_tempUnit = (Last created unit)
      • -------- - --------
      • Set X = (X of ushop_tempPoint[0])
      • Set Y = (Y of ushop_tempPoint[0])
      • Custom script: call SetUnitX( udg_ushop_tempUnit, udg_X )
      • Custom script: call SetUnitY( udg_ushop_tempUnit, udg_Y )
      • -------- - --------
      • Unit - Set ushop_tempUnit movement speed to 0.00
      • Custom script: call RemoveLocation (udg_ushop_tempPoint[0])
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
The closest I could get to what I wanted was like this:
1) hide the original shop
2) create a dummy shop in some far off unseen corner of the map (so the shadow wouldn't be noticeable)
3) move the dummy shop to the position of our hidden shop
4) hide and unhide the dummy shop (this updates its Pathing Texture so it's in the correct position)
5) unhide the original shop

This works and allows you to stack the buildings. However, the dummy shop's shadows are going to still be off in some corner of the map and even after destroying the dummy shop the shadows will remain.
On top of that, if you ever want to remove/destroy your dummy shop you will also need to hide/unhide it again to update it's texture/shadow.

Doing it like this seemed to work, but it was sketchy seeing as how I had these stacking shadows in the corner of the map that would never disappear. I suppose you could call that a solution. I actually forget why I didn't go with this option, there was some other problem with it but I can't recall what. I'll have to try and recreate it again.
 
Level 8
Joined
Feb 17, 2018
Messages
114
Try leaving trigger as it used to be you removed collision action) just adding ms action and object editor stuff. I suggest this because i had simillar problem when unit's hit box moved but model and shadow didn't and experimenting with ms helped as I noticed that if unit's ms is 0 what i described earlier happens and if it's above 0 units moves with shadow nad model. But this was with setX setY so have you tried "move unit instatly"?
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
I tried to do something. Is it what you wanted?
Thanks for the help!

After testing your map I realized that I had been going about it wrong the whole time. It's really as simple as this:

  • trigger
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Set position[1] = (Position of Arcane Vault 0000 <gen>)
      • Unit - Hide Arcane Vault 0000 <gen>
      • Unit - Create 1 Arcane Vault for Player 1 (Red) at position[1] facing Default building facing degrees
      • Unit - Unhide Arcane Vault 0000 <gen>
Just hide the main building, create the dummy building on top of it, and unhide the main building. Keep in mind you will need to hide/unhide ALL of the buildings if you wanted to stack more than 2.

And if you want to move the dummy building inside of another building:
(I used " a unit Finishes construction" to show that you can do this with buildings constructed by your workers)

  • trigger
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • Set position[1] = (Position of Arcane Vault 0000 <gen>)
      • Unit - Hide Arcane Vault 0000 <gen>
      • Unit - Move (Constructed structure) instantly to position[1]
      • Unit - Unhide Arcane Vault 0000 <gen>
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
After testing it out, I found that this doesn't actually work 100% of the time, unfortunately. Sometimes the new dummy shop is SLIGHTLY off position.
I found that it's because the units standing around the shop were interfering with it's placement.
In order to remedy this I not only Hide just the original shop, but instead hide ALL of the living, non-flying, non-hidden units within 400 range of it.
Then I unhide all of those units after I move/create the dummy shop.

This seems like a bandaid fix and I don't know if hiding/unhiding these units will cause any other problems.
I tested it a bunch of times and it seems to work, but I'm not positive that it's fullproof.

New trigger:

  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • Set ushop_tempPoint[0] = (Position of (Triggering unit))
      • -------- - --------
      • Set ushop_HideGroup = (Units within 400.00 of ushop_tempPoint[0] matching ((((Matching unit) is hidden) Equal to False) and (((Matching unit) is A flying unit) Equal to False)))
      • Unit Group - Pick every unit in ushop_HideGroup and do (Actions)
        • Loop - Actions
          • Unit - Hide (Picked unit)
      • -------- - --------
      • -------- Move it/Create it --------
      • -------- - --------
      • Unit Group - Pick every unit in ushop_HideGroup and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
      • Custom script: call DestroyGroup (udg_ushop_HideGroup)
EDIT: Also, make sure the unit isn't dead either. If you hide/unhide a dead unit it's pathing texture comes back for some reason.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Yeah, I need both shops to be stacked on top of one another for my Shop system. You select the base shop, and it disselects it and selects the Shop dummy hidden underneath it. So each player can have their own shop that they can navigate with pages and categories.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
It's a bit complicated without knowing how the whole system works so I edited the trigger a bit and tried to narrow it down to just the issue related stuff:

  • Select Shop Copy
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
    • Actions
      • Set ushop_SelectUnit = (Triggering unit)
      • Set ushop_tempPlayer = (Triggering player)
      • -------- - --------
      • Set ushop_tempPoint[0] = (Position of ushop_SelectUnit)
      • -------- - --------
      • Set ushop_HideGroup = (Units within 400.00 of ushop_tempPoint[0])
      • Unit Group - Pick every unit in ushop_HideGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A flying unit) Equal to False
              • ((Picked unit) is hidden) Equal to False
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit - Hide (Picked unit)
            • Else - Actions
      • -------- - --------
      • Unit - Create 1 (Unit-type of ushop_SelectUnit) for ushop_tempPlayer at ushop_tempPoint[0] facing Default building facing degrees
      • Set ushop_ShopDummy[(Player number of ushop_tempPlayer)] = (Last created unit)
      • Set ushop_tempUnit = (Last created unit)
      • -------- - --------
      • Unit - Add Select Hero to ushop_tempUnit
      • Unit - Add Sell Items to ushop_tempUnit
      • Unit - Add Invulnerable (Neutral) to ushop_tempUnit
      • Animation - Change ushop_tempUnit's size to (1.00%, 1.00%, 1.00%) of its original size
      • -------- - --------
      • Unit Group - Pick every unit in ushop_HideGroup and do (Actions)
        • Loop - Actions
          • Unit - Unhide (Picked unit)
      • Custom script: call DestroyGroup (udg_ushop_HideGroup)
      • -------- - --------
      • Selection - Select ushop_tempUnit for ushop_tempPlayer
There's a Goblin Merchant pre-placed on the map. The trigger works like this:
1) You select the Goblin Merchant
2) The Goblin Merchant and nearby units are hidden
3) A copy of the Goblin Merchant is created on top of it
4) The hidden units are all un-hidden
5) The copy or "Dummy" as I refer to it has it's size set to 1% so you can't see it or select it
6) The game automatically selects the "dummy" shop

This gives the illusion that you're still selecting the Goblin Merchant, but you're really selecting
a shop hidden underneath it.

Edit: Made the trigger easier to understand.
 
Last edited:
Level 8
Joined
Feb 17, 2018
Messages
114
Yeah, it's a bit complecated without context. By the way do you need all shop to be shown at once? If yes you can turn off pathing for all of them and leave it for one so the area remains unwalkable.
Edit: Also going back to your original SetX SetY trigger did you consider turning shadow off for a dummy shop(s)?
Edit: I dont think hiding units is necessary. Probaly the reason why new shop spawns a bit off location (with collision turned off) is the pathing.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Yeah, it's a bit complecated without context. By the way do you need all shop to be shown at once? If yes you can turn off pathing for all of them and leave it for one so the area remains unwalkable.
Edit: Also going back to your original SetX SetY trigger did you consider turning shadow off for a dummy shop(s)?
Edit: I dont think hiding units is necessary. Probaly the reason why new shop spawns a bit off location (with collision turned off) is the pathing.
@SharSash
1. Turning off a buildings collision doesn't do anything. The pathing map* (I think I may have accidentally referred to this as Pathing Texture before) is what gives it collision.
2. Hiding buildings turns off their pathing map, so hiding appears to be a must.
3. The whole point of this is so that my created dummy shop can be the same exact unit-type of the building that i'm copying. I don't want to have to touch the object editor.

I'm doing this for a reason. I want the dummy shop to have the same model/name/hit points etc... Unfortunately, we can't change models via triggers or I would just use one dummy unit for everything.
  • Unit - Create 1 (Unit-type of ushop_SelectUnit) for ushop_tempPlayer at ushop_tempPoint[0] facing Default building facing degrees
I'm aware that I can create a matching dummy unit (one without a Pathing Map/collision) for every single Shop in the game, but the idea was to make the system extremely easy and intuitive.

It's certainly not an end of the world issue, there's obvious solutions, they just aren't ideal. The hiding/unhiding is the only solution so far that seems to work properly with all of my desired results.

@Wrda So the main point is to achieve this: When the player selects a Shop, be it a Goblin Merchant, Arcane Vault, Voodoo Lounge, whatever, a copy of that building will be created inside of the selected building. Also, I don't want to have to modify these buildings in the object editor. Not every Shop you select will be pre-placed, so there's building placement restrictions and all sorts of things that I have to deal with. Trying to create an Arcane Vault inside of another Arcane Vault causes all sorts of problems if both buildings have a Pathing Map.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
Let me clarify that I have it working with the hiding/unhiding trigger I posted above. It's just a little sketchy with the hiding/unhiding of units. I don't know if that will cause any problems but it appears to work. Sorry if i'm misleading you guys.

@Wrda I'm aware of the easy solutions, but I don't want 14 dummy units nor do I want even 1 dummy unit. 1 dummy unit suffers from the lack of a proper model for every unit, and multiple dummy unit's is undesirable because I want to make a Shop system that you can import with little to no hassle.

Anyway, I have it working with my method explained above. I appreciate the comments, and at this point i'm just answering questions or taking suggestions. Just let me clarify that I don't want dummy units :p
 
Level 8
Joined
Feb 17, 2018
Messages
114
So i suggest to create a new shop out side the map limits so when you move it with SetXY the shadow will stay out the visual map and then chnage last created shop transperancy to 100% to hide a model. By the way I noticed that you can select both shops at once by cliking and draging curson I don't know of it's the issue for you or not. See map.
 

Attachments

  • move structure.w3x
    17.7 KB · Views: 109
Status
Not open for further replies.
Top