• 0

    posted a message on Finding XMLs

    Look in the patch.SC2Archive file, the most up to date file is located in StarCraft II Beta\Versions\BaseXXXXX\

    The most recent ones are always in the patch mpq. If say, BehaviorData.xml is not there, then you would go for LibertyMulti.SC2Mod and look in there.

    Also, the quoted data above, isnt that from the XP tutorial? I don't recall seeing Veterancy in any of the default xml's. But then I havent looked in them recently either.

    Posted in: Galaxy Scripting
  • 0

    posted a message on Diablo 3 UI

    Tehwildcard, would it be possible to get ahold of the map and see how it was done / or some info on how to do stuff like this? Would be much appreciated. =)

    Posted in: Project Workplace
  • 0

    posted a message on [Misc] Getting Official Maps

    sixen, %localappdata%\Blizzard Entertainment\Battle.net\Cache from run or address field should work for all Windows OSes. That way it will go directly to the right folder, depending on where the local appdata is stored.

    Posted in: Tutorials
  • 0

    posted a message on Editor Consume too much memory!

    Depending on what you do when mapping, close other windows down. At start my editor uses 300 Mb memory, changed so it would only load the data module and not terrain. This cut me down to 133 Mb. Now, just as StarCraft 2, the editor WILL use alot of memory when you have a map open. Open a second map and it will eat even more. Kinda something you will have to live with. Im leaning towards #1.

    But if that aint an option, use only the modules you need. :)

    Posted in: Miscellaneous Development
  • 0

    posted a message on Warcraft world editor

    Mouse control without third party tools!

    You 2

    Roomate -1

    Posted in: General Chat
  • 0

    posted a message on Some sort of map protection yet?
    Quote from s3rius: Go

    @HPX: Go

    Well, there is. Some people WILL try to cheat, and you don't want your map to be a playground for cheaters. Especially in RPGs.

    And DRM in games is useful too - up to a certain degree. People made these games for a living so of course they try to protect it. It's different for SC2 maps though, as they're only fun projects (and you don't own any rights, so basically it's not yours anyway lol)

    The thing is, if someone wants to circumvent it, they will. Just as with everything else. I dont see the point on putting time & money into it. :p

    Anyways, this is kinda off topic. If you want to continue this discussion feel free to pm or pm me on irc.

    Posted in: Miscellaneous Development
  • 0

    posted a message on Some sort of map protection yet?

    Well, for now the only protection available is the same protection as in WarCraft 3. Open the map up in a random mpq viewer, remove the file /Triggers and voila!

    Unlike in WC3 when doing the same thing, the map still loads and peeps can look at your unit modifications etc, in WC3 an error would be returned and map refused to open due to the missing file. However, triggers in the GUI interface will be gone.

    Please note, that just as in WC3, people WILL still be able to look how you have done things by reading the JASS in WC3 and by reading MapScript.galaxy in SC2.

    Now, I don't see any reason for protecting the map, same as I don't see a reason for DRM in games, or other media. But if you really are that paranoid, this is your only solution for now. And I honestly don't think it will take that long of a time before someone figures out how to read maps from BNET (customs w protection that is).

    Posted in: Miscellaneous Development
  • 0

    posted a message on MMO Ryzom Open Source
    Quote from Grogian: Go

    Freespace 2 and Star Command 2 (The Ur'Quan Masters) both went open source. One of the Quake engines is open source too if I'm not mistaken.

    But I've never heard of an MMO going open source, that's pretty exciting. Too bad I'm too lazy to read anything.

    Actually Carmack / iD releases most of their engines under GPL. Released

    • Quake Engine (Q1, Half-Life (heavily modified))
    • iD Tech 2 (Q2)
    • iD Tech 3 (Q3, MoH, SoF2, Jedi Knight among others)

    Planned release 2010

    • iD Tech 4 (Doom 3, Quake 4, Enemey Territory: Quake Wars, Prey etc)


    In fact, most of iDs old games have their engine sources released.

    Also, perhaps worth mentioning, I know Second Life released some of its stuff, don't know what license or what parts of the code though.

    I for one think studying the code of Ryzom might be interesting.

    And borrowing models for mods, well nice! :D

    Posted in: General Chat
  • 0

    posted a message on [Data] Complete Hero Tutorial
    Quote from Barterr: Go

    Nice tutorial, helped me start with heroes without much trouble. But I noticed that you are setting "Powerup Cost" on the items, I assume it was to be the item value to be used when pawning and stuff, you should change it to "Repair Resource", that's the one that is considered when pawning.

    This is correct. For some reason CostResource (used for items refund when pawning) is tagged as repaircost in the editor.

    Posted in: Tutorials
  • 0

    posted a message on Terrain Cinematic (Screenshots included)

    Really nice work mono. That looks awesome! I guess I could try doing a video later tonight unless someone else gets it done first. But I have no idea what kind of computer is required for recording. :p

    my rig cpu AMD Phenom x4 955 BE mem 8gb gpu nvidia gtx 285

    Posted in: Terrain
  • 0

    posted a message on [Data] Adding an ability to a unit.

    Nice tutorial. Although I think this one should be tagged [Data] and not [xml].

    Posted in: Tutorials
  • 0

    posted a message on [XML] Inventory, items, powerups and more - Part 1

    @WraithChaser: Go

    Sure.

    This zip is mapfile, datafiles and script in one.

    Posted in: Tutorials
  • 0

    posted a message on Galaxy Natives

    the room triggers might also be related to this.

    "Positions the Room Panel above the specified Unit in 2-D space."

    Who knows, guess will have to see later.

    "Returns true if the game is transistioned. A game is transitioned if it has started as a result of a previous map (IE: Was not simply loaded from a lobby)." Wee, map transitions!

    Posted in: Miscellaneous Development
  • 0

    posted a message on [XML] Inventory, items, powerups and more - Part 1

    Inventory, items, powerups and more - Part 1


    Introduction

    This tutorial will show how to create inventories, different types of items, powerups, item containers, and behaviors to mention a few. It is expected of the reader to have some basic understanding of how the maps works and that you know how to edit XML files and add them again (or use a base folder, I guess that works too).

    Also take note on the fact that I will not explain every part of the map I have done. All my findings will however be available on the Wiki / API Docs. I will also explain certain parts like the weapons in closer detail in Part 2 since they required editing a few more files then your common item. I will try to keep Part 1 somewhat simple and I will repeat myself on stuff like facebuttons ALOT, at least for this one.

    The basemap used for this tutorial is the Tutorial Map by vjeux with a modified add.mpq2k-script so that it will also add the Item*.xml-files. You will find the map, the datafiles and the modified addscript under resources.

    You can also see the map in action (recorded by vjeux).

    If you have any questions, additions or clarifications, feel free to send me a PM me here on the boards or [[irc://chat.freenode.net/sc2mapster|catch me on IRC]] (PM Arthas, not HP-X|Arthas).


    Now, lets begin shall we!



    Table of contents

    Items marked with Italics have yet to be written and added

    1. The New XML tags
      1. CAbilInventory
      2. CItemContainer
      3. CItemClass
      4. CItem
      5. CItemEffectInstant
      6. CItemEffectTarget
      7. CAbilPawn
      8. CUnit (Explains items and powerups)
      9. Adding the relevant GameStrings
    2. Part 2 Contents
    3. Resources & Links
    4. Thanks to



    The New XML tags

    Please take note that these are not all of the new tags. Some of the tags used will be explained during the tutorial, and some will probably be left out in order to maintain a somewhat reasonable length. All data is however available in the map & data files. Of these, not all have been commented, but they will be available in the API XML Docs when I get them in there. If you have questions regarding these, just PM here on the boards or on IRC.


    CAbilInventory

    Resource: CAbilInventory at AbilData.xml wikipage

    Hotkey no longer works in retail

    This tag is used in AbilData.xml and sets the pickup and drop range for items. CAbilInventory also utilizes InfoArray children where each InfoArray represents one inventory. The InfoArray themselves have children tags aswell, namely; EmptyFace, Alignment, Container and Hotkey.

    The code below will create two inventories for this CAbilInventory (HeroInventory), one for the equipment and one for storage. Here is an example of how it will look (Click here for full picture):

    Preview of the gamescreen

    A picture showing the game screen with all the items in the equipment inventory.

    	<CAbilInventory id="HeroInventory">
    		<Range value="2"/>
    		<MaxDropRange value="5"/>
    		<InfoArray>
    			<EmptyFace value="InventoryEquipment"/>
    			<Alignment value="Left"/>
    			<Container value="ContainerEquipment"/>
    			<Hotkey value="Button/Hotkey/InventoryEquipment"/>
    		</InfoArray>
    		<InfoArray>
    			<EmptyFace value="InventoryStorage"/>
    			<Alignment value="Right"/>
    			<Container value="ContainerStorage"/>
    			<Hotkey value="Button/Hotkey/InventoryStorage"/>
    		</InfoArray>
    	</CAbilInventory>
    


    • <Range value="2"/>
      
      Optional tag The distance at which items can be picked up (Default value is 0)
    • <MaxDropRange value="5"/>
      
      Optional tag The distance at which items can be dropped (Default value is 0)
    • <InfoArray> [ . . . ] </InfoArray>
      
      The block containing the inventory panels information, border text, container etc
      • <EmptyFace value="InventoryEquipment"/>
        
        Sets the border text and icon. value is a reference to any element in ButtonData.xml
      • <Alignment value="Left"/>
        
        Optional tag Alignment of the inventory panel, valid values are Left and Right (Default value is Right)
      • <Container value="ContainerStorage"/>
        
        Which Container to use in the inventory. Reference to any element in ItemContainerData.xml
      • <Hotkey value="Button/Hotkey/InventoryStorage"/>
        
        Optional tag The Hotkey to use in order to open the inventory. Reference to any String in GameStrings.txt (Default value is no hotkey)


    This is your basic inventory ability, and it doesn't really use any more posts. Hotkey and Alignment for example, are optional. Same with MaxDropRange and Range. The default behaviors for these are, no hotkey at all, Aligntment to the Right and 0 for both droprange and range. Instead of using blocks you can also use a tag line aswell as this:

    <InfoArray EmptyFace="InventoryEquipment" Alignment="Left"
    Container="ContainerEquipment" Hotkey="Button/Hotkey/InventoryEquipment"/>
    


    In the end you will probably end up picking the method that fits your coding style.

    Now, let's move on with the Container tag.


    CItemContainer

    Resource: ItemContainerData.xml wikipage

    The CItemContainer tag is the part which tells the game how the slots should be placed inside the inventories, which itemclass that can be used for the slots and whether or not we want the equipmentbehavior of the items to be active or not.

    Here is a picture of the inventory which will hopefully help you understand what this code does and what the explanations below means.

    Example of the Equipment Inventory

    On this pic: Four accessory slots to the left, four miscellaneous slots to the right, four storage slots on the bottom, one armor and one weapon slot placed over the model.

    Here is a snippet of the CItemContainer, for full code refer to ItemContainerData.xml inside the DataFiles archive at the bottom of the page.

    	<CItemContainer id="ContainerEquipment">
    		<Model value="Ghost"/>
    		<ModelWidth value="800"/>
    		<ModelHeight value="800"/>
    		
    		<!-- Weapon slot (Right) -->
    		<Slots>
    			<Classes value="WeaponClass"/>
    			<Equip value="1"/> 
    			<Row value="2"/> 
    			<Column value="5"/>
    		</Slots> 
    		
    		<!-- Armor slot (Left) -->
    		<Slots>
    			<Classes value="ArmorClass"/>
    			<Equip value="1"/> 
    			<Row value="1"/> 
    			<Column value="3"/> 
    		</Slots> 
    		
    		<!-- Left column 4 boxes- Accessories -->
    		<Slots>
    			<Classes value="AccessoriesClass"/>
    			<Equip value="1"/> 
    			<Row value="3"/> 
    			<Column value="0"/> 
    		</Slots>
    		<Slots>
    			<Classes value="AccessoriesClass"/>
    			<Equip value="1"/> 
    			<Row value="4"/> 
    			<Column value="0"/> 
    		</Slots>
    		
    		[ . . . ]
    		
    		<Slots>
    			<Equip value="0"/> 
    			<Row value="6"/> 
    			<Column value="5"/> 
    		</Slots>
    	</CItemContainer>
    


    • <Model value="Ghost"/>
      
      Optional tag This defines that we want a model preview in the inventory, in this case a Ghost.
    • <ModelWidth value="800"/>
      
      Optional tag Width of the model box.
    • <ModelHeight value="800"/>
      
      Optional tag Height of the model box.
    • <Slots> [ . . . ] </Slots>
      
      These blocks each represent one slot each.
      • <Classes value="WeaponClass"/>
        
        Optional tag The Classes tag have one attribute which refers to an ItemClass in ItemClassData.xml. You can have several instances of this tag in order to allow more than one item class in one slot.
      • <Equip value="1"/>
        
        Optional tag If set to 1 it enables behaviors on items with EquipWeaponArray or EquipBehaviorArray set. Default value if not used is 0
      • <Row value="2"/> 
        
        Slot row placement in the container.
      • <Column value="5"/>
        
        Slot column placement in the container.


    I suppose you are all still with me on this one! As you can see, this is the Container we referred to earlier in the CAbilInventory section for our Equipment Inventory. We have a Model tag with the Ghost as in the screenshot. Then some trial & error for finding the right spot where you want to place the slot. Take your time and look how I placed the boxes above and compare to the screenshot. I'm leaving the Item Storage out, but its the same principal, only simpler.

    Finally, there are three ways to use the Slots tag. The one explained above, one tag line variation and finally a semi-line semi-block one. Yet again the one you choose depends on your coding style. However, take note on the fact that Classes can not be used in the tag line and must be placed inside a block. Due to this we have three ways of writing slots. Here is the tag line variation:

    <Slots Equip="1" Row="2" Column="5"/>
    

    Nothing special with this one, except this one can't use the Classes attribute. I used this variation with Equip set to 0 or left it out (same result if you leave tag out or set it to 0) when creating the item storage since that one didn't require any Classes attribute.

    	<Slots  Equip="1" Row="2" Column="5">
    		<Classes value="WeaponClass"/>
    		<Classes value="ArmorClass"/>
    	</Slots>
    

    Here is a combination of the line variation with the Classes included. This would work just fine if you want to re-write the sample above. This slot would also allow items of the armor class to be placed in this slot.


    CItemClass

    Resource: ItemClassData.xml wikipage

    The CItemClass use is really just to have categories for certain item types. In the example map I have four classes, WeaponClass, ArmorClass, AccessoryClass and MiscClass. Then I bound the armor slot to ArmorClass items only (using the Classes attribute in the slot), Weapons to the Weapon slot and finally Accessories to the four Accessory slots to the left and Misc items to the Misc slots to the right.

    An example class in the map for Accessories

    	<CItemClass id="AccessoryClass">
    	   <Name value="Accessories"/>
    	</CItemClass>
    


    • <Name value="Accessories"/>
      
      Used to set a description for the class, I'm sure this can be used somehow, but for now I haven't figured that out.


    CItem

    Resource: CItem at ItemData.xml wikipage

    CItem is the tag used for creating passive items. The CItem block (not the containers showed on the map though, they are defined in a CUnit field inside UnitData.xml More on that later.) contains info like effects, icons, names etc. Let's have a look.... after having a peek at this example item + description screen.

    Example of the Ancient Charm and it's display

    Top left: The inventory again! The top item in the accessory slots to the left is the charm.
    Bottom left: A nice mspaint arrow showing you the status icon when wearing the Ancient Charm (yes, I'm aware of the fact it's a slow icon)
    Top right: The name & description of the item.
    Bottom right: The dark void if Blizzard don't add the chat gem to SC2.

    And now for the code:

    	<CItem id="ItemOcularImplants">
    		<Face value="ItemOcularImplants"/>
    		<Flags index="CanDrop" value="1"/>
    		<Class value="AccessoriesClass"/>
    		<Level value="1"/>
    		<EquipBehaviorArray value="ItemOcularImplants"/>
    	</CItem>
    


    • <Face value="ItemOcularImplants"/>
      
      YARBD (Yet Another Reference to ButtonData.xml) to set the icon, name and tooltip.
    • <Flags index="CanDrop" value="1"/>
      
      Optional tag Your good ole flags tag! The value you set here decides if you can drop items or not.
    • <Class value="AccessoriesClass"/>
      
      Optional tag Binds the item to a certain ItemClass, if Equip is set to 1 you can only place the item in an Accessory class slots or slots without a class set.
    • <Level value="1"/>
      
      Optional tag Sets the item level for this perticular item. No known use for this tag is known.
    • <EquipBehaviorArray value="ItemOcularImplants"/>
      
      Optional tag This sets the Behavior (from BehaviorData.xml) we want to use if the item is placed in a slot with Equip set to 1.


    I think that the CItem is pretty much straight forward and therefor won't go in very deep to explain what has been done. I will however mention four tags that can be used to apply Behaviors and WeaponArrays and the difference between them.

    There are a total of four known item modifiers for this type of item, these types are:

    • <CarryBehaviorArray value="ItemOcularImplants"/>
      
      Optional tag This sets the Behavior from BehaviorData.xml and is active as long as it's in your inventory, be it Equip 0 or 1.
    • <CarryWeaponArray Link="Ghost"/>
      
      Optional tag Will Link to a weapon from WeaponData.xml and is active as long as it's in your inventory, be it Equip 0 or 1.
    • <EquipBehaviorArray value="ItemOcularImplants"/>
      
      Optional tag This sets the Behavior from BehaviorData.xml we want to use if the item is placed in a slot with Equip set to 1.
    • <EquipWeaponArray Link="Ghost"/>
      
      Optional tag Will Link to a weapon from WeaponData.xml we want to use if the item is placed in a slot with Equip set to 1.


    Note that the WeaponArray's use Link and not value when defined


    CItemEffectInstant

    Resource: CItemEffectInstant at ItemData.xml wikipage

    Now it's time to move onto something a little more interesting. Active items without targets such as heal, stimpacks and blink. This skill takes all children from CItem and have a few additions of it's own. Let's move on with some more code again!

    	<CItemEffectInstant id="ItemFirstaid">
    		<Face value="ItemFirstaid"/>
    		<Flags index="CanDrop" value="1"/>
    		<Flags index="KillWhenDepleted" value="1"/>
    		<Class value="MiscClass"/>
    		<Level value="2" />
    		<Effect value="ItemFirstaid"/>
    		<EffectCost>
    			<!--<Vital index="Life" value="-50"/>-->
    			<Charge>
    				<CountMax value="5"/>
    				<CountStart value="5"/>
    				<CountUse value="1"/>
    			</Charge>
    		</EffectCost>
    		<EffectFlags index="Transient" value="0"/>
    	</CItemEffectInstant>
    


    • <Face value="ItemFirstaid"/>
      
      You know what this is by this time (right???), a reference to a button in ButtonData.xml.
    • <Flags index="CanDrop" value="1"/>
      
      Optional tag Your good ole flags tag! The value you set here decides if you can drop items or not.
    • <Flags index="KillWhenDepleted" value="1"/>
      
      Optional tag Another Flags index. If set to 1, the item will be removed when you have used all the charges.
    • <Class value="MiscClass"/>
      
      Optional tag Binds the item to a certain ItemClass, if Equip is set to 1 you can only place the item in a Misc class slots or slots without a class set.
    • <Level value="2"/>
      
      Optional tag Sets the item level for this perticular item. No known use for this tag is known.
    • <Effect value="ItemFirstaid"/>
      
      Uses an Effect from EffectData.xml, in this case a custom made for heal
    • <EffectCost> [ . . . ] </EffectCost>
      
      Optional tagThis block has children that sets life drain, energy drain and holds the charge block.
      • <Vital index="Life" value="-50"/>
        
        Optional tag This line WOULD increase the life by 50 points if not commented out. You can also use Energy instead of Life
        • <Charge> [ . . . ] </Charge>
          
          Optional tag This block has children that sets charges.
          • <CountMax value="5"/>
            
            The max amount of charges
          • <CountStart value="5"/>
            
            The number of charges for this item to have when you pick it up.
          • <CountUse value="1"/>
            
            Amount of charges to deduct once you use the item.
    • <EffectFlags index="Transient" value="0"/>
      
      Sets whether or not this item is transient or not. Doesnt seem to have any effect on CItemEffectInstant though


    This is one of the tags I feel is not yet fully explored. For example, I do not know how to use cooldown here, the items will not stack properly (see the bug report on this forum) among other things.

    But let's start from the top with the changes I've done. I wanted this ability to be a self heal spell. At first I tried the commented line (Vital tag) and realized that used the item even if you were already at full health. Worth mentioning is that when negative, this property will add points instead of removing.

    Anyway, since I wanted a proper Heal that won't use a charge & heal if im already at full health I made my own Effect which increased the health after a validation that checked my health. I will cover this later on in another chapter. If you want to explore how I did it yourself, refer to the datafiles for now.

    The last part I want to discuss here is the following code block taken from Renees example which I feels need some coverage although the uses / utilizations are unknown:

    	<RefundFraction>
    		<Resource index="Minerals" value="-1"/>
    		<Resource index="Vespene" value="-1"/>
    		<Resource index="Terrazine" value="-1"/>
    		<Resource index="Custom" value="-1"/>
    		<Charge value="-1"/>
    		<Cooldown value="-1"/>
    	</RefundFraction>
    	<Range value="500"/>
    

    I won't bother using a list for this one. Anyway, it seems like the CoolDown goes in there if this is correct. The RefundFraction for Resource is supposedly there for adding a refund in case you cancel the item use. I havent found anyway to utilize this since when an item is used, it's always instant.


    CItemEffectTarget

    Resource: CItemEffectTarget at ItemData.xml wikipage

    Identical to CItemEffectInstant with three exceptions, the Effect tag should point on a usable ability like CalldownMULE, not a passive ability.

    The next thing, the EffectFlags index="Transient" tag. When you point the try to use an ability on the map you expect the unit to move there if not within range. This however, won't happen IF the flag is set to 1. I can't figure out why you wouldn't want that but thats what the flag does, thus having no effect on CItemEffectInstant due to the range being 0.

    And finally, the Range tag, which obviously sets the distance from the unit you can place target.


    CAbilPawn

    Resource: CAbilPawn at AbilData.xml wikipage

    Now for the CAbilPawn tag which is just that, a pawn ability that let's us sell items to the units and buildings with this ability attached.

    	<CAbilPawn id="PawnItems">
    		<InfoArray index="Pawn1">
    			<Button DefaultButtonFace="Salvage"/>
    			<Display index="Minerals" value="1"/>
    			<Display index="Gas" value="1"/>
    			<RefundFraction index="Minerals" value="1"/>
    			<RefundFraction index="Vespene" value="1"/>
    			<RefundFraction index="Terrazine" value="1"/>
    			<RefundFraction index="Custom" value="1"/>
    			<TargetFilters value="-;-"/>
    			<ValidatorArray value=""/>
    			</InfoArray>
    		<InfoArray index="Pawn2">
    			<Button DefaultButtonFace="Salvage"/>
    			<Display index="Minerals" value="1"/>
    			<Display index="Gas" value="1"/>
    			<RefundFraction index="Minerals" value="5"/>
    			<RefundFraction index="Vespene" value="5"/>
    			<RefundFraction index="Terrazine" value="5"/>
    			<RefundFraction index="Custom" value="5"/>
    			<TargetFilters value="-;-"/>
    			<ValidatorArray value=""/>
    		</InfoArray>
    		<Range value="100"/>
    	</CAbilPawn>
    


    • <InfoArray index="Pawn1"> [ . . . ] </InfoArray>
      
      This blocks contains the information for this pawn ability. Note that the index is important here and has to be Pawn1 as this is the default pawn infoarray.
      • <Button DefaultButtonFace="Salvage"/>
        
        Look, a button. Take a guess on what file it refers to! You guessed it right again, darn it. :(
      • <Display index="Minerals" value="1"/>
        
        If set to 1 it is supposed to show the mineral refund for the item you are about to sell. This is not yet implemented according to Renee
      • <Display index="Gas" value="1"/>
        
        If set to 1 it is supposed to show the gas refund for the item you are about to sell. This is not yet implemented according to Renee
      • <RefundFraction index="Minerals" value="1"/>
        
        This tag will act as a multiplier (Item cost * value) for the amount of minerals to be returned when selling. So say you want this ability, Pawn1 to return just 50% of the minerals. Then you simply set the value to 0.5.
      • <RefundFraction index="Vespene" value="1"/>
        
        This tag will act as a multiplier (Item cost * value) for the amount of espene to be returned when selling. So say you want this ability, Pawn1 to return just 50% of the minerals. Then you simply set the value to 0.5.
      • <RefundFraction index="Terrazine" value="1"/>
        
        This tag will act as a multiplier (Item cost * value) for the amount of terrazine to be returned when selling. So say you want this ability, Pawn1 to return just 50% of the minerals. Then you simply set the value to 0.5.
      • <RefundFraction index="Custom" value="1"/>
        
        This tag will act as a multiplier (Item cost * value) for the amount of ustom to be returned when selling. So say you want this ability, Pawn1 to return just 50% of the minerals. Then you simply set the value to 0.5.
      • <TargetFilters value="-;-"/>
        
        This will decide which target filters the infoarray will apply to. If you only want heroes to be able to sell stuff, this is the place to Make it so!<</color>>)
      • <ValidatorArray value=""/>
        
        The value here is supposed to point to a validator in ValidatorData.xml if you want some kind of check for sellings items


    As you can see in the code above there are a secondary InfoArray, this one can be used if for say, creating a skill that will sell items. Then you can set different RefundFractions for that one. There is a possibility there are more uses for having Pawn2-20 (Yeah, the ones known to be available are Pawn1 to Pawn20).

    The item cost mentioned in the RefundFraction tags are set as a child of CUnit which is the to be explained in the next part. And a final note on the indexes of RefundFraction, you might know minerals and vespene as I did. I did not know what Terrazine and custom was though. But these are apparently 2 extra resource types we may use in our maps. Nifty eh?


    CUnit (Explains items and powerups)

    Resource: CUnit at UnitData.xml wikipage

    Time to put the last few pieces together so that we have a completely working inventory, but first a short explanation on what we are about to do. If you have already checked my tutorial map and looked close on UnitData.xml, ModelData.xml and ActorData.xml you will realize that I created a "new" unit for the items and the powerups. You might also realize what a pain it is to add strings for the units and the items and the effects used (I probably missed one, I hade to make tons of strings for tons of stuff). But as this first chapter of the tutorial is to be somewhat comprehensible and easy to understand. The first code block will instead show you how to Modify the SCV unit to act as a container for one item and the Probe for the powerup.

    At the moment I doubt you can have more than one item bound to one unit unless you clone them. This will be a lot easier with the editor as it might probably create everything from just editing CItem or so where you get to choose model for the container etc. I will cover making unit & powerup containers in the next chapter.

    This is a modification of the already existant SCV units block in UnitData.xml and not a new section at the top.

    It's not much code, but lets dig!

    	<CUnit id="SCV" parent="ITEM">
    		<Item value="ItemOcularImplants"/>
    		<MinimapRadius value="0.375"/>
    		<CostResource index="Minerals" value="200"/>
    		<FlagArray index="Pawnable" value="1"/>
    	</CUnit>
    


    • <CUnit id="SCV" parent="ITEM">
      
      Here we have it, the SCV with one minor modification, the parent attribute, in this case set to ITEM. This will tell the game we have an item and not a regular unit.
    • <Item value="ItemOcularImplants"/>
      
      This binds to the item we created in the CItem earlier.
    • <CostResource index="Minerals" value="200"/>
      
      Here is the cost attribute we talked about previously on CAbilPawn. This is the itemcost / value of the item.
    • <FlagArray index="Pawnable" value="1"/>
      
      Now, we also want this item to be PawnAble so we can sell it to a a unit / building with the ability attached.


    Note that I removed all other data from the SCV and replaced it with the above lines. The same will be done now that we move to the powerup which we base of the Probe.

    	<CUnit id="Probe" parent="POWERUP">
    		<Height value="0.1"/>
    		<PowerupEffect value="PowerupEnergy"/>
    		<PowerupCost>
    			<Charge>
    				<CountMax value="1"/>
    				<CountStart value="1"/>
    				<CountUse value="1"/>
    			</Charge>
    		</PowerupCost>
    	</CUnit>
    


    • <CUnit id="Probe" parent="POWERUP">
      
      The probe with parent set to POWERUP so the game knows what we are dealing with.
    • <Height value="0.1"/>
      
      This raises the unit a bit from the ground.
    • <PowerupEffect value="PowerupEnergy"/>
      
      And now a new tag, PowerUpEffect where the value is a reference to an effect in EffectData.xml, in this case an effect which raises the energy
    • <PowerupCost> [ . . . ] </PowerupCost>
      
      Optional tag This block contains the Charge block used for Charges.
      • <Charge> [ . . . ] </Charge>
        
        Optional tag This tag contains the same children as in CItemEffectInstant and CItemEffectTarget and the only difference is that this sets how many times you can use the powerup before it vanishes. Normally one would leave this and the PowerupCost blocks out.
        • <CountMax value="5"/>
          
          The max amount of uses
        • <CountStart value="5"/>
          
          The number of uses for this powerup when game is initialized or the item is placed / dropped.
        • <CountUse value="1"/>
          
          Amount of uses to deduct once you use the powerup.


    Now, that wasn't too advanced, was it. :) Now for one the final part of CUnit for now, making a building able to Pawn items!

    For this you just add the line below to the observatory for example, that will make it possible to drop items with the FlagArray index Pawnable set to 1.

    <AbilArray Link="PawnItems"/>
    

    That's about it. Now we have only one thing left, adding strings!


    Adding the relevant GameStrings

    Resource: Color constants at Constants wikipage

    Before we begin, why in the world would anyone want to use a file such as GameStrings.txt? Well, simple really. Localization, having GameStrings.txt will make it much easier when translating all the strings. GameStrings.txt also allows you to format the strings with color and certain arithmetic values. If typing the strings directly in the Name tag below, it will show, but you are unable to format them using colors or arithmetic functions.

    Now, lets have a quick look at what a button looks like.

    	<CButton id="ItemOcularImplants">
    		<Name value="Button/Name/ItemOcularImplants"/>
    		<Tooltip value="Button/Tooltip/ItemOcularImplants"/>
    		<Icon value="Assets\Textures\btn-techupgrade-terran-ocularimplants.dds"/>
    	</CButton>
    

    I think most of the tags above are self explanatory. But as you can see on the Name and Tooltip fields, they refer to Button/Name/ItemOcularImplants and Button/Tooltip/ItemOcularImplants.

    The first field tells us that its a Button, the second which type of string, name or tooltip and the last part which Button it is.


    Now, this is what we would add to the GameStrings.txt for this button.


    Button name:

    Button/Name/ItemOcularImplants=Ocular Implants

    Not much to say here, the same string as used in the value field above followed by a = and a string.


    Button tooltip:

    Button/Tooltip/ItemOcularImplants=<c val="ffe303">Class:</c> <c val="00daff">Accessory</c><n/>The ocular implants increases your sight range by 5.<n/>It is however NOT recommended to take these in and out as it may cause permanent damange to your eyes (mentioned in case you didn't figure that out yourself).

    The tooltip string is a little longer and here and contains colorization as seen in the screenshots earlier. This by using the c tag and val attribute.


    Now, there are ofcourse other strings, for example the ones used for naming Behaviors and their tooltips (the small icons that appears to the left in the info panel). The string for ItemOcularImplants (the Behavior) for example looks like this:

    Behavior/Name/ItemOcularImplants=Ocular Implants

    Then we also have the hotkeys which is worth mentioning since we used them in the beginning when looking at CAbilInventory. This is how you set a hotkey. Button/Hotkey/InventoryEquipment=I Button/Hotkey/InventoryStorage=O



    With this, I thank you for reading the first chapter of my tutorial. I hope you enjoyed reading it, or at least learned something while doing so (both is fine with me). If you have any questions, dont hesitate to contact me using any of the methods mentioned in the beginning of the tutorial. Now read down for resources and personal thanks to the people who helped me while writing this tutorial. Until next time!



    Part 2 Contents

    What you will see in Part 2:

    • Creating new item containers (units) in XML
    • Detailed description of creating the Weapons
    • Detailed description of creating the First Aid skill

    What you MIGHT see in Part 2:

    • Pawnshops where you can also shop
    • Cooldown on items



    Resources & Links

    Files

    The Inventory tutorial map file

    The XML files edited to create this map + GameStrings.txt

    Updated add.mpq2k script which also adds the Item*.xml files


    Information and documentation

    XML data files documentation

    These forums

    Tutorial Map by vjeux (thread with information)

    Item*.xml documentation by chilled (in chinese)

    CItem* information by Renee (in chinese)

    Powerup information by Renee (in chinese)

    CAbilPawn information (in chinese)



    Thanks to

    Renee and chilled at bbs.islga.org for their work that made it possible to start playing around with inventories, powerups and pawnshops.

    vjeux, for his tutorial map which made me actually test stuff. The for the scripts which I loaned to the InventoryMap and the help and feedback he have provided.

    Alevice for helping with figuring the Inventory out and his feedback

    gregv21 for the first working PawnShop map.

    Hati for helping with models and actordata

    SC2Mapster & crew for being here

    And everyone else I forgot, I'm pretty sure it's not a little bunch that disappeared here. For the next tutorial Ill make sure to note you all properly. :)



    Posted in: Tutorials
  • 0

    posted a message on Items and Heroes

    Inventory Tutorial - Finished the map for ya. Now im writing the tutorial, will post here when its done.

    • also testing attachments!*
    Posted in: Miscellaneous Development
  • To post a comment, please or register a new account.