Prozix
New Member
- Reaction score
- 7
Prerequisite:
I wanted to add tomes to my map without having to click a thousand times and do boring repetitive tasks.
I will post the code first so you can have a look at it. If you have some programming experience and you are familiar with textmacros you will probably see how it works.
Adding the tomes
If you place this in your maps header (press F4 to go to the Trigger Editor and click on your map's name), save your map and reopen it. It will have added 9 tomes and 9 abilities. NOTE: If you have created objects that use these codes AT00-AT09 or IT00-IT09 it will replace those objects.
How does it work?
If you wan't to add a tome you have to execute a "runtextmacro" command.
example:
Yay I created a lot of tomes... wait, I need a shop to sell them
No worries my friend, the next line of code merges a nice little Tome Shop into your map
NOTE: Make sure you have no object using this code: nT00 if you do, change the code some you are not using.
If you have any questions about the ObjectMerger you can
If there is something else you want to know, you know what to do
This concludes my semi-tutorial (I wasn't sure what kind of thread this was, template, snippet or tutorial) If you you have suggestions how I could improve my tutorial please post them.
~Prozix
- Jass Newgen pack
I wanted to add tomes to my map without having to click a thousand times and do boring repetitive tasks.
I will post the code first so you can have a look at it. If you have some programming experience and you are familiar with textmacros you will probably see how it works.
Adding the tomes
JASS:
//! textmacro CreateTome takes I, BTNX, BTNY, ICONPATH, STATSTRING, AMOUNT, AGI, INT, STR, HOTKEY, STOCK, REPLENISH, COST
//! external ObjectMerger w3a AIgm AT$I$ abpx $BTNX$ abpy $BTNY$ aart "$ICONPATH$" Iagi 1 $AGI$ Iint 1 $INT$ Istr 1 $STR$ ansf "(+$AMOUNT$)" anam "Item $STATSTRING$ Gain"
//! external ObjectMerger w3t tdx2 IT$I$ iabi AT$I$ ubpx $BTNX$ ubpy $BTNY$ iico "$ICONPATH$" isel 1 igol $COST$ isto $STOCK$ istr $REPLENISH$ uhot $HOTKEY$ unam "Tome of $STATSTRING$ +$AMOUNT$ ($HOTKEY$)" utip "Purchase Tome of $STATSTRING$ +$AMOUNT$ ($HOTKEY$)" utub "Permanently increases the $STATSTRING$ of the Hero by $AMOUNT$ when used."
//! endtextmacro
//! runtextmacro CreateTome("01", "0", "0", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Strength", "2", "0", "0", "2", "Q", "9", "1", "200")
//! runtextmacro CreateTome("02", "0", "1", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Strength", "10", "0", "0", "10", "A", "9", "3", "900")
//! runtextmacro CreateTome("03", "0", "2", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Strength", "100", "0", "0", "100", "Z", "9", "5", "8000")
//! runtextmacro CreateTome("04", "1", "0", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Agility", "2", "2", "0", "0", "W", "9", "1", "200")
//! runtextmacro CreateTome("05", "1", "1", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Agility", "10", "10", "0", "0", "S", "9", "3", "900")
//! runtextmacro CreateTome("06", "1", "2", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Agility", "100", "100", "0", "0", "X", "9", "5", "8000")
//! runtextmacro CreateTome("07", "2", "0", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Intelligence", "2", "0", "2", "0", "E", "9", "1", "200")
//! runtextmacro CreateTome("08", "2", "1", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Intelligence", "10", "0", "10", "0", "D", "9", "3", "900")
//! runtextmacro CreateTome("09", "2", "2", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Intelligence", "100", "0", "100", "0", "C", "9", "5", "8000")
If you place this in your maps header (press F4 to go to the Trigger Editor and click on your map's name), save your map and reopen it. It will have added 9 tomes and 9 abilities. NOTE: If you have created objects that use these codes AT00-AT09 or IT00-IT09 it will replace those objects.
How does it work?
If you wan't to add a tome you have to execute a "runtextmacro" command.
example:
JASS:
//! runtextmacro CreateTome("09", "2", "2", "ReplaceableTextures\CommandButtons\BTNTome.blp", "Intelligence", "100", "0", "100", "0", "C", "9", "5", "8000")
- 09 - This is what will be added to AT.. and IT..: passing "09" as the first parameter creates the codes AT09 for the ability and IT09 for the item
- 2 - The next parameter is the X position for the item when placed in a shop
- 2 - The third parameter is the Y position for the item when placed in a shop
- "Replacable....blp" - This is the icon path
- Intelligence - This will be used as a string in the names and descriptions of your abilities and items
- 100 - This is the amount that is added when the item is used by a hero
- 0 - This is the amount of Agility that is added (you can only add one attribute with this macro, if you try to add more the descriptions won't be correct, the stats will apply to a buying hero)
- 100 - Amount of Intelligence added
- 0 - Amount of Strength added
- C - This is the hotkey for the tome when placed in a shop
- 9 - The maximum stock number
- 5 - Replenish time (in shop)
- 8000 - This is the price of the tome
Yay I created a lot of tomes... wait, I need a shop to sell them
No worries my friend, the next line of code merges a nice little Tome Shop into your map
NOTE: Make sure you have no object using this code: nT00 if you do, change the code some you are not using.
JASS:
//! external ObjectMerger w3u ngme nT00 uico "ReplaceableTextures\CommandButtons\BTNBookOfSummoning.blp" umdl "buildings\other\BookOfSummoning\BookOfSummoning.mdl" usca 1.50 usei IT01,IT02,IT03,IT04,IT05,IT06,IT07,IT08,IT09 ides "Sells various Tomes." unam "Tome Shop"
If you have any questions about the ObjectMerger you can
- Read the manual in your jassnewgen directory (jassnewgenpack5d\grimext\GrimexManual.html)
- Follow the link at the top of my post
If there is something else you want to know, you know what to do
- Use the search function
- If that didn't help, post your question
This concludes my semi-tutorial (I wasn't sure what kind of thread this was, template, snippet or tutorial) If you you have suggestions how I could improve my tutorial please post them.
~Prozix