• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

w3o-from-csv

Level 8
Joined
Aug 1, 2023
Messages
34
w3o-from-csv is a command line program that converts 'csv' files to 'w3o' (war3map.w3u, war3map.a, war3map.w3t, etc.). The 'war3map.w3u', 'war3map.w3a', etc. files are used by the game and can be imported by the map editor (in the Object Editor [OE] module).

The structure of the 'csv' files is the following: the first 2 columns are mandatory, for a csv file containing <X> kind of data the first 2 columns are:
  • units data: 'unitId', 'baseUnitId'
  • items data: 'itemId', 'baseItemId'
  • destructables data: 'destructableId', 'baseDestructableId'
  • doodads data: 'doodadId', 'baseDoodadId'
  • abilities data: 'abilityId', 'baseAbilityId'
  • buffs/effects data: 'buffId', 'baseBuffId'
  • upgrades data: 'upgradeId', 'baseUpgradeId'

After the first 2 mandatory columns, come the columns for which we want to change the values of the base object:
The following units data table has 4 columns:
Code:
unitId,baseUnitId,startingAgility,movementSpeedBase
U000,Nfir,69,105
the mandatory 'unitId' and 'baseUnitId' are followed by the 'startingAgility' and 'movementSpeedBase' columns. The names of the columns come from the fields' names (the 'Name' column inside the OE's units/items/etc tabs). Other units data column names would be 'abilitiesHero', 'projecileImpactZSwimming', 'shadowImageUnit', 'shadowTextureBuilding', 'hotkey', 'name', etc.

The doodads, abilities and upgrades objects can have fields with multiple values (one value per level/variatiton). Because of these multi-valued fields these objects use another 'csv' file that stores these values.

For doodads the 'doodads-variatons.csv' file's first 2 columns are: 'doodadId', 'variation'.
For abilities the 'abilities-levels.csv' file's first 2 columns are: 'abilityId', 'level'
For upgrades the 'upgrades-levels.csv' file's first 2 columns are: 'upgradeId', 'level'

Here's an example:

'abilities.csv':
Code:
abilityId,baseAbilityId,name,caster,effect,target,iconResearch,iconNormal,buttonPositionNormalX,buttonPositionNormalY,tooltipLearn,tooltipLearnExtended,hotkeyLearn,hotkeyNormal
A000,AHwe,Summon Units,,,,ReplaceableTextures\CommandButtons\BTNMassTeleport.blp,ReplaceableTextures\CommandButtons\BTNMassTeleport.blp,1,2,Learn SummonUnits - |cFFFFCC00Level %d|r (|cFFFFCC00W|r),Summons a few units.|n|n|cffffcc00Level 1|r - Summons 2 Footman |n|cffffcc00Level 2|r - Summons 3 Rifleman |n|cffffcc00Level 3|r - Summons 4 Knights |n,W,W
A001,AHbz,Blizzard,,,,,,,,Learn Blizzard - |cFFFFCC00Level %d|r (|cFFFFCC00Q|r),-,Q,Q
A002,ANcl,Instagib,_,_,_,ReplaceableTextures\CommandButtons\BTNBattleRoar.blp,ReplaceableTextures\CommandButtons\BTNBattleRoar.blp,2,2,Learn Instagib - |cFFFFCC00Level %d|r (|cFFFFCC00E|r),,E,E

'abilities-levels.csv':
Code:
abilityId,level,unitId,dataA,dataB,dataC,dataD,dataE,dataF,dataG,dataH,dataI,manaCost,cooldown,castRange,targetsAllowed,tooltipNormal,tooltipNormalExtended
A000,1,hfoo,2,,,,,,,,,10,1,,,Summon Units - |cFFFFCC00Level 1|r (|cffFFCC00W|r),Summons 2 Footman
A000,2,hrif,3,,,,,,,,,20,2,,,Summon Units - |cFFFFCC00Level 2|r (|cffFFCC00W|r),Summons 3 Rifleman
A000,3,hkni,4,,,,,,,,,30,3,,,Summon Units - |cFFFFCC00Level 3|r (|cffFFCC00W|r),Summons 4 Knights
A001,1,,,50,100,,,,,,,5,0.1,,,Blizzard - |cFFFFCC00Level 1|r (|cffFFCC00Q|r),-
A001,2,,,100,200,,,,,,,5,0.1,,,Blizzard - |cFFFFCC00Level 2|r (|cffFFCC00Q|r),-
A002,1,,0,unit-target,visible,0,FALSE,charm,,,,20,2,500,enemy,Instagib - |cFFFFCC00Level 1|r (|cFFFFCC00E|r),Immediately kills the targeted unit.|ncooldown: 2 seconds|ncast range: 500
A002,2,,0,unit-target,visible,0,FALSE,charm,,,,10,0.5,1000,enemy,Instagib - |cFFFFCC00Level 2|r (|cFFFFCC00E|r),Immediately kills the targeted unit.|ncooldown: 0.5 seconds|ncast range: 1000

These two tables define 3 abilities. The 'A000' ability is based on 'AHwe' (Human/Summon Water Elemental). The 'A001' is based on 'AHbz' (Human/Blizzard). The 'A002' ability is based on 'ANcl' (Channel). Ability 'A000' has 3 levels. Abilities 'A001' and 'A002' each have only 2 levels.

Here's another units data table that references the above abilities:
Code:
unitId, baseUnitId,abilitiesHero,attack1CooldownTime,attack1DamageBase,attack1DamageNumberOfDice,attack1DamageSidesPerDie,attack1Range,startingAgility,movementSpeedBase
U000,Nfir,"A000,A001,A002",0.1,0,1,1,250,0,512

When the 'U000' (a hero unit, because the first letter is capital) is created in the game, it will be able to learn/use the 'A000', 'A001' and 'A002' abilities.

For a field that takes values of type string, the empty string/nil value can be specified with '-' (a single dash/minus/U+002D character).


See also: csv-from-w3x
 

Attachments

  • w3o-from-csv.zip
    97.8 KB · Views: 5
Last edited:
Top