- Joined
- Sep 14, 2009
- Messages
- 284
Hello. I am making an item forging system similar to the one in The Legend of Magnador.
For those who haven't played this map you basically put X number of items in a forge and it creates a forged item.
But in my case the the "forge" unit sells a dummy unit which "triggers" the forging, and number of items is 2. The items that can be forged are called material items and there must be 2 different of them in order to forge a forged item.
Here are the triggers:
The problem is, that if we have more triggers like "ForgeSabertoothNecklace", the ForgeInvalid will run twice and thus add 4 lumber but should only run once and return 2 lumber.
I can't think of a way around to fix this problem.
For those who haven't played this map you basically put X number of items in a forge and it creates a forged item.
But in my case the the "forge" unit sells a dummy unit which "triggers" the forging, and number of items is 2. The items that can be forged are called material items and there must be 2 different of them in order to forge a forged item.
Here are the triggers:
-
ForgeSabertoothNecklace
-
Events
-
Unit - A unit Sells a unit
-
-
Conditions
-
(Unit-type of (Sold unit)) Equal to (==) Forge Item
-
((Selling unit) has an item of type |cffEEDD82Beast Hide|r) Equal to (==) True
-
((Selling unit) has an item of type |cffEEDD82Monster Claw|r) Equal to (==) True
-
-
Actions
-
Unit - Remove (Sold unit) from the game
-
If ((Charges remaining in (Item carried by (Selling unit) of type |cffEEDD82Beast Hide|r)) Greater than (>) 1) then do (Item - Set charges remaining in (Item carried by (Selling unit) of type |cffEEDD82Beast Hide|r) to ((Charges remaining in (Item carried by (Selling unit) of type |cffEEDD82Beast Hide|r)) - 1)) else do (Item - Remove (Item carried by (Selling unit) of type |cffEEDD82Beast Hide|r))
-
If ((Charges remaining in (Item carried by (Selling unit) of type |cffEEDD82Monster Claw|r)) Greater than (>) 1) then do (Item - Set charges remaining in (Item carried by (Selling unit) of type |cffEEDD82Monster Claw|r) to ((Charges remaining in (Item carried by (Selling unit) of type |cffEEDD82Monster Claw|r)) - 1)) else do (Item - Remove (Item carried by (Selling unit) of type |cffEEDD82Monster Claw|r))
-
Set TempPointA = (Position of (Buying unit))
-
Special Effect - Create a special effect at TempPointA using Abilities\Spells\Items\AIem\AIemTarget.mdl
-
Custom script: call RemoveLocation(udg_TempPointA)
-
Special Effect - Destroy (Last created special effect)
-
Set TempPointA = (Center of PMMagicForge <gen>)
-
Item - Create Sabertooth Necklace at TempPointA
-
Custom script: call RemoveLocation(udg_TempPointA)
-
-
-
ForgeInvalid
-
Events
-
Unit - A unit Sells a unit
-
-
Conditions
-
(Unit-type of (Sold unit)) Equal to (==) Forge Item
-
Multiple ConditionsOr - Any (Conditions) are true
-
Conditions
-
(Item carried by (Selling unit) in slot 1) Equal to (==) No item
-
(Item carried by (Selling unit) in slot 2) Equal to (==) No item
-
(Item-class of (Item carried by (Selling unit) in slot 1)) Not equal to (!=) Miscellaneous
-
(Item-class of (Item carried by (Selling unit) in slot 2)) Not equal to (!=) Miscellaneous
-
(Item-type of (Item carried by (Selling unit) in slot 1)) Equal to (==) (Item-type of (Item carried by (Selling unit) in slot 2))
-
-
-
-
-
Actions
-
Unit - Remove (Sold unit) from the game
-
Set ErrorPlayer = Player 9 (Gray)
-
Set ErrorMessage = Unable to forge these items.
-
Custom script: call ErrorMessage(udg_ErrorMessage, udg_ErrorPlayer)
-
Player - Add 2 to Player 9 (Gray) Current lumber
-
-
I can't think of a way around to fix this problem.