- Joined
- Apr 24, 2012
- Messages
- 5,113
-
CSS
-
Events
- Map initialization
- Conditions
-
Actions
- Custom script: set udg_CSS_Hash = InitHashtable()
- Custom script: set udg_CSS_Return = 'I000'
- Custom script: call ExecuteFunc("CSS_OnInit")
- Custom script: endfunction
- -------- ------------------------------------------------- --------
- -------- Register Shop --------
- -------- ------------------------------------------------- --------
- -------- Registers the shop + 11 items --------
- -------- ------------------------------------------------- --------
- Custom script: function CSS_RegisterShop takes nothing returns nothing
- Custom script: set udg_CSS_Key = udg_CSS_SubShop
- Custom script: set udg_CSS_ShopCreated = CreateUnit(Player(15),'n001',0,0,0.0)
-
For each (Integer CSS_I) from 1 to 11, do (Actions)
-
Loop - Actions
- Custom script: call AddItemToStock(udg_CSS_ShopCreated,udg_CSS_Items[udg_CSS_I],1,1)
-
Loop - Actions
- Custom script: call AddItemToStock(udg_CSS_ShopCreated,udg_CSS_Return,1,1)
- Hashtable - Save Handle OfCSS_ShopCreated as (Key Shop) of CSS_Key in CSS_Hash
- Custom script: set udg_CSS_Key = udg_CSS_Return
- Hashtable - Save Handle OfCSS_MainShopCreated as (Key Main) of CSS_Key in CSS_Hash
- Custom script: endfunction
- -------- ------------------------------------------------- --------
- -------- Register Shops --------
- -------- ------------------------------------------------- --------
- -------- Registers up to 12 shops --------
- -------- ------------------------------------------------- --------
- Custom script: function CSS_RegisterShops takes nothing returns nothing
- Custom script: set udg_CSS_MainShopCreated = CreateUnit(Player(15),'n001',0,0,0.0)
-
For each (Integer CSS_I) from 1 to 12, do (Actions)
-
Loop - Actions
- Custom script: call AddItemToStock(udg_CSS_MainShopCreated,udg_CSS_Shops[udg_CSS_I],1,1)
-
Loop - Actions
- Hashtable - Save Handle OfCSS_MainShopCreated as (Key Main Shop) of CSS_Shop in CSS_Hash
- Hashtable - Save True as (Key Shop Allowed) of CSS_Shop in CSS_Hash
- Custom script: endfunction
- -------- ------------------------------------------------- --------
- -------- Register Library --------
- -------- ------------------------------------------------- --------
- -------- Configuration of the system --------
- -------- ------------------------------------------------- --------
- Custom script: function CSS_Library takes nothing returns nothing
- -------- ------------------------------------------------- --------
- -------- Configuration for the main shop --------
- -------- ------------------------------------------------- --------
- Custom script: set udg_CSS_Shop = 'n000'
- Set CSS_Shops[1] = Potions
- Set CSS_Shops[2] = Protection
- Set CSS_Shops[3] = Damage
- Custom script: call CSS_RegisterShops()
- -------- ------------------------------------------------- --------
- -------- Configuration for the sub-shops --------
- -------- ------------------------------------------------- --------
- Set CSS_SubShop = CSS_Shops[1]
- Set CSS_Items[1] = Clarity Potion
- Set CSS_Items[2] = Lesser Clarity Potion
- Set CSS_Items[3] = Potion of Healing
- Set CSS_Items[4] = Potion of Invisibility
- Set CSS_Items[5] = Potion of Lesser Invulnerability
- Set CSS_Items[6] = Potion of Mana
- Custom script: call CSS_RegisterShop()
- Set CSS_SubShop = CSS_Shops[2]
- Set CSS_Items[1] = Khadgar's Gem of Health
- Set CSS_Items[2] = Belt of Giant Strength +6
- Set CSS_Items[3] = Cloak of Shadows
- Custom script: call CSS_RegisterShop()
- Set CSS_SubShop = CSS_Shops[3]
- Set CSS_Items[1] = Claws of Attack +12
- Set CSS_Items[2] = Warsong Battle Drums
- Set CSS_Items[3] = Mask of Death
- Set CSS_Items[4] = Orb of Frost
- Custom script: call CSS_RegisterShop()
- Custom script: endfunction
- -------- ------------------------------------------------- --------
- -------- Select Shop Event --------
- -------- ------------------------------------------------- --------
- -------- Selects the main shop --------
- -------- ------------------------------------------------- --------
- Custom script: function CSS_OnSelect takes nothing returns nothing
- Set CSS_U = (Triggering unit)
- Custom script: set udg_CSS_Key = GetUnitTypeId(udg_CSS_U)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Load (Key Shop Allowed) of CSS_Key from CSS_Hash) Equal to True
-
Then - Actions
- Set CSS_P = (Triggering player)
- Trigger - Turn off (This trigger)
- Selection - Clear selection for CSS_P
- Selection - Select (Load (Key Main Shop) of CSS_Key in CSS_Hash) for CSS_P
- Trigger - Turn on (This trigger)
- Else - Actions
-
If - Conditions
- Custom script: endfunction
- -------- ------------------------------------------------- --------
- -------- On Sell Event --------
- -------- ------------------------------------------------- --------
- -------- Opens the sub-shops or the return button --------
- -------- ------------------------------------------------- --------
- Custom script: function CSS_OnSell takes nothing returns nothing
- Set CSS_Item = (Sold Item)
- Custom script: set udg_CSS_Key = GetItemTypeId(udg_CSS_Item)
- Set CSS_P = (Owner of (Buying unit))
- Trigger - Turn off (This trigger)
- Selection - Clear selection for CSS_P
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Item-type of CSS_Item) Equal to CSS_Return
-
Then - Actions
- Selection - Select (Load (Key Main) of CSS_Key in CSS_Hash) for CSS_P
-
Else - Actions
- Selection - Select (Load (Key Shop) of CSS_Key in CSS_Hash) for CSS_P
-
If - Conditions
- Trigger - Turn on (This trigger)
- Custom script: endfunction
- -------- ------------------------------------------------- --------
- -------- Initialize --------
- -------- ------------------------------------------------- --------
- Custom script: function CSS_OnInit takes nothing returns nothing
- Custom script: set udg_CSS_OnSelect = CreateTrigger()
- Custom script: set udg_CSS_OnSell = CreateTrigger()
-
For each (Integer CSS_I) from 1 to 12, do (Actions)
-
Loop - Actions
- Trigger - Add to CSS_OnSelect the event (Player - (Player(CSS_I)) Selects a unit)
-
Loop - Actions
- Trigger - Add to CSS_OnSell the event (Unit - A unit Sells an item (from shop))
- Custom script: call TriggerAddAction(udg_CSS_OnSelect,function CSS_OnSelect)
- Custom script: call TriggerAddAction(udg_CSS_OnSell,function CSS_OnSell)
- Custom script: call CSS_Library()
-
Events
Attachments
Last edited: