• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Compressed Tavern v1.4

Description

Triggers

Changelogs

This system allows you to put a limitless number of heroes in just one tavern.
Example:a hero inside a tavern inside a tavern inside a tavern..............

Also thanks to Adiktuz'Shop System for the idea
[trigger=]CTS Setup
Events
Map initialization
Conditions
Actions
Custom script: set udg_CTS_Hash = InitHashtable()
-------- Setting up all units --------
-------- This determines the unit created when selected or sold --------
-------- ----------------------------- --------
-------- Tavern -> Main Tavern --------
-------- ----------------------------- --------
Set CTS_Unit = Tavern
Set CTS_UnitCreated = Tavern (Main)
Trigger - Run CTS Save <gen> (ignoring conditions)
-------- ----------------------------- --------
-------- Main Tavern -> Human Tavern --------
-------- ----------------------------- --------
Set CTS_Unit = Tavern Human
Set CTS_UnitCreated = Tavern Human
Trigger - Run CTS Save <gen> (ignoring conditions)
-------- ----------------------------- --------
-------- Main Tavern -> Elf Tavern --------
-------- ----------------------------- --------
Set CTS_Unit = Tavern Night Elf
Set CTS_UnitCreated = Tavern Night Elf
Trigger - Run CTS Save <gen> (ignoring conditions)
-------- ----------------------------- --------
-------- Main Tavern -> Orc Tavern --------
-------- ----------------------------- --------
Set CTS_Unit = Tavern Orc
Set CTS_UnitCreated = Tavern Orc
Trigger - Run CTS Save <gen> (ignoring conditions)
-------- ----------------------------- --------
-------- Main Tavern -> Undead Tavern --------
-------- ----------------------------- --------
Set CTS_Unit = Tavern Undead
Set CTS_UnitCreated = Tavern Undead
Trigger - Run CTS Save <gen> (ignoring conditions)
-------- ----------------------------- --------
-------- Return -> Tavern --------
-------- ----------------------------- --------
Set CTS_Unit = Return
Set CTS_UnitCreated = Tavern (Main)
Trigger - Run CTS Save <gen> (ignoring conditions)
-------- ----------------------------- --------
-------- Adding Events --------
-------- ----------------------------- --------
Set CTS_Player[1] = Player 1 (Red)
Set CTS_Player[2] = Player 2 (Blue)
Set CTS_Group = (All players controlled by a User player)
Set CTS_TotalPlayers = (Number of players in CTS_Group)
For each (Integer CTS_Integer) from 1 to CTS_TotalPlayers, do (Actions)
Loop - Actions
Trigger - Add to CTS Open Tavern <gen> the event (Player - CTS_Player[CTS_Integer] Selects a unit)
Trigger - Add to CTS Deselect <gen> the event (Player - CTS_Player[CTS_Integer] Deselects a unit)
Custom script: call DestroyForce(udg_CTS_Group)
[/trigger]
[trigger=]CTS Save
Events
Conditions
Actions
Custom script: call SaveInteger(udg_CTS_Hash,udg_CTS_Unit,1,udg_CTS_UnitCreated)
[/trigger]
[trigger=]CTS Open Tavern
Events
Conditions
(Unit-type of (Triggering unit)) Equal to Tavern
Actions
Set CTS_TempPlayer = (Triggering player)
Set CTS_Tavern = (Triggering unit)
Custom script: set udg_CTS_Key = GetUnitTypeId(udg_CTS_Tavern)
Trigger - Turn off (This trigger)
Selection - Clear selection for CTS_TempPlayer
-------- Load --------
Custom script: set udg_CTS_DummyTavern = LoadInteger(udg_CTS_Hash,udg_CTS_Key,1)
Set CTS_TempLoc = (Position of CTS_Tavern)
Unit - Create 1 CTS_DummyTavern for CTS_TempPlayer at CTS_TempLoc facing Default building facing degrees
Custom script: call RemoveLocation(udg_CTS_TempLoc)
Selection - Select (Last created unit) for CTS_TempPlayer
Trigger - Turn on (This trigger)
[/trigger]
[trigger=]CTS Open Folder
Events
Unit - A unit Sells a unit
Conditions
((Sold unit) is A Hero) Equal to False
Actions
Set CTS_Buyer = (Buying unit)
Set CTS_Seller = (Triggering unit)
Set CTS_TempPlayer = (Owner of CTS_Buyer)
Set CTS_Tavern = (Sold unit)
Selection - Clear selection for CTS_TempPlayer
Custom script: set udg_CTS_Key = GetUnitTypeId(udg_CTS_Tavern)
Custom script: set udg_CTS_DummyTavern = LoadInteger(udg_CTS_Hash,udg_CTS_Key,1)
Set CTS_TempLoc = (Position of CTS_Seller)
Unit - Create 1 CTS_DummyTavern for CTS_TempPlayer at CTS_TempLoc facing Default building facing degrees
Selection - Select (Last created unit) for CTS_TempPlayer
Unit - Remove CTS_Tavern from the game
Custom script: call RemoveLocation(udg_CTS_TempLoc)
[/trigger]
[trigger=]CTS Remove Unit
Events
Unit - A unit Sells a unit
Conditions
Actions
Set CTS_U = (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of CTS_U) Equal to Tavern (Main)
(Unit-type of CTS_U) Equal to Tavern Human
(Unit-type of CTS_U) Equal to Tavern Night Elf
(Unit-type of CTS_U) Equal to Tavern Orc
(Unit-type of CTS_U) Equal to Tavern Undead
Then - Actions
Unit - Remove CTS_U from the game
Else - Actions
[/trigger]
[trigger=]CTS Deselect
Events
Conditions
Actions
Set CTS_U = (Triggering unit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of CTS_U) Equal to Tavern (Main)
(Unit-type of CTS_U) Equal to Tavern Human
(Unit-type of CTS_U) Equal to Tavern Night Elf
(Unit-type of CTS_U) Equal to Tavern Orc
(Unit-type of CTS_U) Equal to Tavern Undead
Then - Actions
Unit - Remove CTS_U from the game
Else - Actions
[/trigger]

v1.1
-Fixed Stock Delay
v1.2
-Fixed heroes being removed when sold.
-Fixed Return sound set
-Added Folder tooltip
-Cached units
v1.3
-Cached units
v1.4
-Added number of players
-Added clear selection when selling units
Contents

CTS v1.4 (Map)

Reviews
17:02, 30th Sep 2012 Magtheridon96: Approved. 3/5
Level 2
Joined
May 7, 2012
Messages
21
I dont like this system. First of all - EVERY time you pressing the button you are create a NEW unit. And I don't know why but they are not deleting when I deselecting them.

Look what I want to suggest: http://www.hiveworkshop.com/forums/pastebin.php?id=hqf9jz
Memory leaks and ugly code but I want to show you the idea what can be done if units will be "preloaded" instead of creating every time.

Also, thanks to Adiktuz's Shop System, this system helps a lot.
 
Level 2
Joined
Oct 29, 2020
Messages
14
This is very nice except for one problem, it doesnt work with Stock intervals or Stock Start Delay... the Stock interval Timers will always reset and infinitely loop everytime you click a different menu, and the only alternative is to set the Stock Delay to 0 for all heroes, but that is not what I want to do


Edit:
Nevermind... I think I found a way to fix it! thanks so much, this is great :)
 
Last edited:
Top