Impossible Creatures

Impossible Creatures

评价数不足
IC Misc Modding Tips
由 Dephesmo 制作
A collection of small miscellaneous modding tips for Impossible Creatures, that might not deserve a full on guide of their own.
   
奖励
收藏
已收藏
取消收藏
Foreword
- Hey there, the plan is to use this Guide page to document various small modding tips for Impossible Creatures (IC) that I have discovered or yoinked from others, that might not deserve a full on guide of their own, but might be useful to remember.

- Generally setting up a new mod in IC consists of creating a few new files (mainly done by copying the Insect Invasion mods files and slightly modifying them), you can read more about how to set this up properly in this guide:

https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=735413158

- At its core IC modding is about either:
- Placing a new file in your mods "Data" folder to add something new to the game;
- Placing a file with the same name and in the same folder directory inside your "Data" folder, as the original games file - to essentially overwrite the original file.

- Unless of course you know C++, then its another story... but so far, I have not encountered a person who could successfully use the attached SDK to create meaningful changes to the game.

- You can also check out my profile for larger IC related modding guides, like for example a guide on how to make your own mod creature for the game:
https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=3051026290

- So the following sections are going to be various tips in no particular order, hopefully you will find something useful among them.
Max army popcap
- To change your mods max army popcap you will need to do some hex code editing.

- There are various programs that can open a file to view its hex code, I will be using a program called "ImHex":


- Locate your mods main ".dll" file, right click it and open it using the hex editor (in my case my mods .dll is called "picmod.dll"):


- Usually hex code has an Address column:


- If you are using Insect Invasion as your mods ".dll" you need to find this address "000CF800":


- Here you can change the two pop cap values, the pop cap numbers are expressed as HEX code. To understand what value you should enter here search for "hexadecimal to decimal converter" online.
- For example by converting 32 hexadecimal we get 50 in decimal;
- And converting 4B hexadecimal we get 75 in decimal.


- If I wanted my new popcap values to be 80 and 100 I would need to enter hexadecimal values "50" and "64" in the same spots:


- Save your changes, and start your mod to test if it worked:


- And as you can see we have the new popcap values working:
Remove prebuilt armies and zoo combinations
- This guide assumes that you set up your mod by using the Insect Invasion mod files.

- Once you have set up your new mod, you might notice that even though it is fresh, it already contains 4 prebuilt armies and a bunch of prebuilt creatures inside the zoo.



- This is most likely because you set up your mods ".module" file this way (In this case "testmod" being my personal mod):


- I will explain this in a way that I understand it. These lines in your ".module" file tell the game which archive files to open up and use for your mod. While we need all the information found in the "InsectData.sga" for our mod to function, it also contains the mentioned prebuilt armies and prebuilt creatures.

- One way around this, is to create a new archive file that is specifically meant for your mod, and contains all of the information found in "InsectData.sga" except the prebuilt army and zoo information.

- The first step is to extract the "InsectData.sga" archive found in your Impossible Creatures (IC) folder. For this task use the "ModPackager" tool found in your IC game files:


- Open the tool and then locate and open the "InsectData.sga" archive file:


- Once open click "Archive -> Extract Archive":


- And extract the contents to a folder of your choosing, once it reachies 1715/1715 file count, it is finished, there wont be any "finished" message:


- Now open the folder containing the extracted files. And go to this directory in the files:
"...\defprofile\multiplayer"

- This folder contains all of the prebuild armies and prebuild creatures, simply delete all of the folders contents:


- Now we need to rebuild the archive, using the same files we extracted, except they wont contain the prebuilt armies and creatures.

- To do this once again open "ModPackager" tool, but this time click "File -> New":


- In the new dialog window click "Create Archive" and "OK":


- In the next window enter your mods name and click "OK":


- Then fill up this window in the following way, and for the "Root Folder" directory pick the folder in which you extracted all of the "InsectData.sga" contents and click "OK":


- Now you need to add all the folders and files found in this folder by right clicking this directory "header" and either pick "Add Folder" or "Add Files":


- Do this until your contents look like this:


- Once you have attached all of the files and folders, click "Archive -> Build Archive", give it a name that suits your mod, in my case "testmod":


- Once the archive is finished you will recieve a pop-up, at this point you can close the "ModPackager":


- Now place your new archive file inside your IC folder, and again open up your mods ".module" file. At this point you can remove the "InsectData.sga" from the archive list, since our own archive contains all of its information minus the prebuilt army and zoo stuff:


- That is it, now anyone who downloads your mod and launches it wont receive any of the prebuilt armies and creatures originally meant for Insect Invasion. Now if you launched your mod before you swapped out the archive file and information, your "profile" will still contain these armies as if they were made by you.

- To completely get rid of them simply head over to this directory in your game files:
"D:\SteamLibrary\steamapps\common\Impossible Creatures\Profiles\Profile1"

- And delete the folder with your mods name, this folder contains information about your armies and creatures (and some other stuff), on initial launch all of the information found in the mods archive file was simply duplicated in here.

- Upon launch this folder will be automatically remade by the game itself, so you should not be afraid to brick the game.
Changing creature audio - 1
- Normally when you make your own mod creature, you would use audio from other existing creatures, but here I will describe how creature vocal audio is set up for the game, and how you can change it for your mod.

- In impossible creatures (IC) each creature has a few vocal audio files associated with them. Personally I would split them in 2 types like this:
1 - "Selection/Order sounds"
2 - "Event sounds"

- You can inspect these sounds once you extract the "Engine.sga" and "InsectData.sga" archive files using "ModPackager" tool.

- The "Selection/Order sounds" can be found in these folders:
...\audio\orders
...\audio\selection

-The "Event sounds" can be found in these folders:
...\audio\animals
...\audio\combat

- These folders contain audio that is also used for others parts of the game as well as some sounds that seem to simply be leftover files.

- If you have tried to create your own mod creatures, or if you just have edited the existing creatures ".ebp" and ".lua" files you might have encountered these sound files.

- The "Event sounds" are used in the creatures ".ebp" file to set up the audio it will emit in the "world" - grunts when taking damage, dealing damage, dying or being idle. These sound files are pretty flexible and you can have pretty much as many as you would like:


- The "Selection/order" sounds are used in the creatures ".lua" file. You can hear these 2 sound pieces once you either select a creature or when you give it a move/attack order for example. This is set up by typing a number 1 - 77 in the creatures ".lua" file:


- Now unlike the "Event sounds" you are limited by this number. For some reason its just the way the game was made, you can only have 77 different "Selection/order" sounds, I guess you could say this is "hard-coded into the games .dll file".

- The audio files are a bit more messy than it might first appear, so I documented them in a table:
Changing creature audio - 2
Name
Vocal
Selection PAT
Selection WAV
Order PAT
Order WAV
Archerfish
1
archerfish.pat
piranhasrc.wav
archerfish.pat
piranhaorder22.wav
Ant
2
ant.pat
dragonflyattn.wav
ant.pat
antattn1.wav
Armadillo
3
armadillo.pat
armadilloattn22.wav
armadillo.pat
armadilloorder22.wav
Baboon
4
baboon.pat
baboonattn.wav
baboon.pat
baboonoattack.wav
Beaver
5
-
-
-
-
Bull
6
bull.pat
bullattn1.wav
bull.pat
bullattn2.wav
Camel
7
camel.pat
bullattn1.wav
camel.pat
bullattn2.wav
Chameleon
8
chameleon.pat
chameleonselect22.wav
chameleon.pat
chameleonorder22.wav
Cheetah
9
cheetah.pat
cheetahoattack2.wav
cheetah.pat
cheetahoattack.wav
Chimpanzee
10
chimp.pat
chimpselect.wav
chimp.pat
chimporder.wav
Coyote
11
coyote.pat
coyoteselect.wav
coyote.pat
coyoteorder.wav
Crocodile
12
croc.pat
crocodileselect.wav
croc.pat
crocodileorder.wav
Dolphin
13
dolphin.pat
dolphinselect.wav
dolphin.pat
dolphinorder.wav
Dragonfly
14
dragonfly.pat
dragonflyattn.wav
dragonfly.pat
antattn1.wav
Eagle
15
eagle.pat
eagleattn2.wav
eagle.pat
eagleattn1.wav
Electric Eel
16
eel.pat
eelselect.wav
eel.pat
eelorder.wav
Elephant
17
elephant.pat
elephantattn1.wav
elephant.pat
elephanthit1.wav
Garfish
18
garfish.pat
piranhasrc.wav
garfish.pat
piranhaorder22.wav
Giraffe
19
giraffe.pat
giraffeattn2.wav
giraffe.pat
giraffeorder.wav
Gorilla
20
gorilla.pat
gorillaselect.wav
gorilla.pat
gorillaorder.wav
Great white shark
21
greatwhite.pat
greatwselect.wav
greatwhite.pat
greatwhiteoattack1.wav
Grizzly bear
22
grizzly.pat
grizzlyselect.wav
grizzly.pat
grizzlyorder.wav
Hammerhead shark
23
hammerhead.pat
greatwselect.wav
hammerhead.pat
greatwhiteoattack1.wav
Hippopotamus
24
hippo.pat
hippoattn.wav
hippo.pat
hippoattk1.wav
Hornet
25
hornet.pat
hornetselect.wav
hornet.pat
hornetorder.wav
Horse
26
horse.pat
horseselect.wav
horse.pat
horseorder.wav
Hyena
27
hyena.pat
hyenaselect.wav
hyena.pat
hyenachuff.wav
Kangaroo
28
kangaroo.pat
kangarooselect.wav
kangaroo.pat
kangarooorder.wav
Killer whale
29
killerwhale.pat
orcaattn1.wav; orcaattn4.wav
killerwhale.pat
orcaattack2.wav
Komodo dragon
30
komodo.pat
komodoattn2.wav
komodo.pat
komodoorder.wav
Lemming
31
lemming.pat
lemmingattn1.wav
lemming.pat
lemmingorder.wav
Lioness
32
lioness.pat
lionattk2.wav
lioness.pat
lionorder.wav
Lobster
33
lobster.pat
lobsterselect.wav
lobster.pat
lobsterattk3.wav
Moose
34
moose.pat
mooseselect.wav
moose.pat
mooseorder.wav
Mountain lion
35
mntlion.pat
mlionattn1.wav
mntlion.pat
mlionattn2.wav
Musk ox
36
muskox.pat
muskoxattn1.wav
muskox.pat
muskoxhit3.wav
Panther
37
panther.pat
pantherattn2.wav
panther.pat
pantheroattack.wav
Piranha
38
piranha.pat
piranhasrc.wav
piranha.pat
piranhaorder22.wav
Changing creature audio - 3
Name
Vocal
Selection PAT
Selection WAV
Order PAT
Order WAV
Poison frog
39
poisonfrog.pat
22frogselect2.wav
poisonfrog.pat
22frogorder.wav
Polar bear
40
polarbear.pat
grizzlyselect.wav
polarbear.pat
grizzlyorder.wav
Porcupine
41
porcupine.pat
porcupineattn1.wav
porcupine.pat
porcupineoattack1.wav
Praying mantis
42
mantis.pat
prayingmantisselect.wav
mantis.pat
prayingmantisorder.wav
Ram
43
ram.pat
ramselect.wav
ram.pat
ramorder.wav
Rat
44
rat.pat
ratattack2.wav
rat.pat
ratattack2.wav
Rattlesnake
45
rattlesnake.pat
rattlesnakedeath.wav
rattlesnake.pat
rattlesnakeoattack.wav
Raven
46
raven.pat
ravenselect.wav
raven.pat
ravenorder.wav
Rhinoceros
47
rhino.pat
rhinoselect.wav
rhino.pat
rhinoorder.wav
Scorpion
48
scorpion.pat
scorpionselect.wav
scorpion.pat
scorpionorder.wav
Skunk
49
skunk.pat
skunkselect.wav
skunk.pat
skunkorder.wav
Snapping turtle
50
turtle.pat
armadilloattn22.wav
turtle.pat
armadilloorder22.wav
Snowly owl
51
snowyowl.pat
snowyowlselect.wav
snowyowl.pat
snowyowlorder.wav
Sperm whale
52
spermwhale.pat
orcaattn1.wav; orcaattn4.wav
spermwhale.pat
spermwhaleorder.wav
Spitting cobra
53
cobra.pat
cobraselect.wav
cobra.pat
cobraorder.wav
Tiger
54
tiger.pat
tigeroattk1.wav; tigeroattk2.wav
tiger.pat
tigeroattk3.wav
Bat
55
bat.pat
vampireselect.wav
bat.pat
vampireorder.wav
Vulture
56
vulture.pat
vultureattn.wav
vulture.pat
vultureattk.wav
Walrus
57
walrus.pat
walrusselect.wav
walrus.pat
walrusorder.wav
Warthog
58
warthog.pat
warthogselect.wav
warthog.pat
warthogorder.wav
Wolf
59
wolf.pat
wolfselect.wav
wolf.pat
wolforder.wav
Wolverine
60
wolverine.pat
wolverineattn1.wav
wolverine.pat
wolverineorder.wav
Wooly mammoth
61
mammoth.pat
mammothoattack.wav
mammoth.pat
mammothorder.wav
Zebra
62
zebra.pat
zebraselect.wav
zebra.pat
zebraorder.wav
Anaconda
63
anaconda.pat
anacondaselect.wav
anaconda.pat
anacondaorder.wav
Behemoth
64
behemoth.pat
behemothselect1.wav
behemoth.pat
behemothorder2.wav
Black Widow
65
blackwidow.pat
blackwidowselect.wav
blackwidow.pat
blackwidoworder.wav
Bomabrdier beetle
66
bombardier.pat
bombardierselect.wav
bombardier.pat
bombardierorder.wav
Cockroach
67
cockroach.pat
cockroachselect.wav
cockroach.pat
cockroachorder.wav
Condor
68
condor.pat
condorselect.wav
condor.pat
condororder.wav
Fire fly
69
firefly.pat
fireflyselect.wav
firefly.pat
fireflyorder.wav
Giant ant eater
70
giantanteater.pat
gaselect1_22.wav
giantanteater.pat
gaorder1_22.wav
Garden spider
71
gardenspider.pat
gardenspiderselect.wav
gardenspider.pat
gardenspiderorder.wav
Hercules beetle
72
herculesbeetle.pat
herculesbeetleselect.wav
herculesbeetle.pat
herculesbeetleorder.wav
Spider wasp
73
spiderwasp.pat
spiderwaspselect.wav
spiderwasp.pat
spiderwasporder.wav
Stick bug
74
stickbug.pat
stickbugselect1.wav
stickbug.pat
stickbugorder2.wav
Shield bug
75
stinkbug.pat
stinkbugselect1.wav
stinkbug.pat
stinkbugorder1.wav
Tarantula
76
tarantula.pat
tarantulaselect.wav
tarantula.pat
tarantulaorder.wav
Termite
77
termite.pat
termiteselect1_22.wav
termite.pat
termiteorder1_22.wav
Changing creature audio - 4
- To add new sounds to the game, we need to use a tool that is available in the IC game files called "PatchEditor":


- You can read more about this tool in one of the documents available in IC game files, called "IC_PatchEditor_Documentation.doc":
D:\SteamLibrary\steamapps\common\Impossible Creatures\Documents

- In order to add a new "order" or "selection" audio, we will need to replace ".WAV" and ".SMP" files that are referenced by one of the creatures ".PAT" file.

- In short the way IC game audio works is like this:
- Game references ".PAT" files
- Each ".PAT" file links to one or more ".SMP" files
- ".SMP" files are related to one raw sound file (.WAV or .MP3)

- The ".PAT" and ".SMP" files are set up using the "PatchEditor".

- Ok lets add a new sound to the game, by replacing a zebras order/selection sound (Nr. 62 according to my table). As usual I will assume that you have your mod folder all set up.

- First have a sound file you wish to use, in my case I will use this “bublasaur.wav” sound file, that is about 1 second long:


- And place it in games directory here:
D:\SteamLibrary\steamapps\common\Impossible Creatures\data\audio\selection


- Now open “PatchEditor” and pick “File -> New Sample”:


- A new window will appear click the “Browse…” button and find your audio file (bulbasaur.wav in my case):


-Next I simply save it in the same folder as my “Bulbasaur.wav” audio file with the same name:


- Now with “bulbasaur.wav” and “bulbasaur.smp” ready, we can copy the “.PAT” file of the original creature of which we wish to replace the selection sound of, to the same folder:


- This is the limitation with “order” and “selection” vocal sounds, the main “.PAT” files must keep their original names.

- Using the “PatchEditor” open the “.PAT” file:


- You might receive this error message, you can simply click “OK” and ignore it (it can’t find the original zebra “.SMP” file):


- Once your “.PAT” file is open select the existing “.SMP” reference and “Remove” it:


- Next click “Add..” button and find your new “.SMP” file:


- Now the meaning of the next few actions I am not entirely sure of, but I simply copy the same information that was set for the original “.SMP” file.

- First I select the “.SMP” file from the Sample list and click “Edit Params…”, enter “5” in the weight field, and click apply:


- Then I select the “.SMP” file from the Sample list again and click “Edit Sample…”. Here I enter the same values the original “.SMP” file had, and click “Apply” and save the “SMP.” file:


-Now all that’s left is to save the “.PAT” file, with its original name. Now you can close the “PatchEditor”.

- Now you can place these 3 files in your mods directory here “…\testmod\data\audio\selection”:


- Now the original Zebra creature, and any other creature that has its vocal property set to “62” in its “.lua” file will sound like Bulbasaur upon selection.

- “Order” audio needs to be set up the same way. With the “.PAT” file keeping its original creatures name.

Changing creature audio - 5
- Now if you wish to add more creature sounds but wish to keep the originals as intact as possible, there are few things you can do to squeeze as much as possible out of the limited 77 audio spots for "order/selection" sounds.

- First of all we actually have one "free" spot that hast been used - "Beaver" as Nr.5.

- Apparently at one point beaver was considered as one of the stock creatures but was eventually cut. However its audio slot remains unused. So you simply need to create a "beaver.PAT" file and then you can reference any ".SMP" and ".WAV" file you wish just like I demonstrated.

- Next if you take a look, while all of the creatures have unique ".PAT" file names, audio source ".WAV" files of some creature pairs are actually one and the same. For example:
Archerfish - Piranha - Garfish
Ant - Dragonfly
Armadillo - Snapping turtle
Bull - Camel
Great white shark - Hammerhead shark
Grizzly bear - Polar bear
Killer whale - Sperm whale (only "selection .WAV")

- Since these creatures share literally the same sounds you could also reassign their vocal numbers in their ".lua" files to simply point to only one of the two or three audio slots. This way you can open up 8 new slots for other creatures.

- Now finally if you are really desperate, you can probably have somewhat similar creatures point to a common vocal audio number. For example a group of insects could just point to a obscure audio file, and you could free up more slots. In a similar manner the original developers already did with the few pairs of creatures, only expanding it more.
Restoring Texture blending in ComboTest
- If you are making your own creature for a mod, most likely you will use "ComboTest" at some point


- However in steam version for some reason some files are not extracted or installed by default, as a result "ComboTest" does not perform the torso texture blending in the spots where the limbs of the second creature connect to it.


- To restore this in steam version, you need the files extracted from one of the archive files "Engine.sga". Use "ModPackager" to extract the files from this archive.


- Next, in the extracted files you need to find a folder called "combiner" and copy it into your installed game folder in this directory:
D:\SteamLibrary\steamapps\common\Impossible Creatures\Data


-Now when you use "ComboTest" to preview your creatures, you will see the texture blending take action:
Ranged attack on any limb -1
- By default, when you modify your mods creature ".lua" stat files you can only have ranged attack on the creatures head, frontal limbs or tail.

- However you can copy "attrcombiner.lua" file over to your mods "data" folder and change some values inside of it, to enable you to put ranged attacks any other limb - for example torso.


- In IC ".lua" files in some places limbs are designated using numbers:
1 – I think this means body as a whole, like “pack hunter” applies even if no parts of the creature are used in the final combination;
2–Front legs;
3–Back legs;
4–Head;
5–Tail;
6–Torso;
7–Wings;
8–Arms.

- So in essence we will simply copy the existing "code lines" that refer to head for example, and simply replace the number "4" with "6".

- Once you have opened the "attrcombiner.lua" file you will need to perform new additions in 5 spots.

- First find this place:
AttributeData = { -- { attribute name, zero ok, min, max, rank list, ui attribute name, game->ui scale factor } { "hitpoints", nil, 1, 2000, {0.0, 90.0, 160.0, 240.0}, "health", 1 }, { "armour", 1, 0, 0.9, {0.0, 0.15, 0.20, 0.35}, "armour", 100 }, { "speed_max", 1, 8, 50, {0.0, 25.0, 35.0, 45.0}, "landspeed", 1 }, { "waterspeed_max", 1, 8, 40, {0.0, 4.0, 6.0, 8.5}, "waterspeed", 1 }, { "airspeed_max", 1, 8, 50, {0.0, 5.0, 15.0, 20.0}, "airspeed", 1 }, { "sight_radius1", nil, 10, 1000, {0.0, 25.0, 35.0, 45.0}, "sightradius", 1 }, { "size", nil, 1, 10, {0, 3, 6, 9}, "size", 1 }, { "melee_damage", 1, 0, 1000, {0.0, 5.0, 9.0, 11.5}, "damage", 1 }, --{ "range2_damage", 1, 0, 1000, {0.0, 1.0, 2.0, 3.0}, "range2_damage", 1 }, --{ "range4_damage", 1, 0, 1000, {0.0, 1.0, 2.0, 3.0}, "range4_damage", 1 }, --{ "range5_damage", 1, 0, 1000, {0.0, 1.0, 2.0, 3.0}, "range5_damage", 1 }, { "range2_max", 1, 0, 35, {0.0, 5.0, 9.0, 16.0}, "range2_max", 1 }, { "range4_max", 1, 0, 35, {0.0, 5.0, 9.0, 16.0}, "range4_max", 1 }, { "range5_max", 1, 0, 200, {0.0, 5.0, 9.0, 16.0}, "range5_max", 1 }, };

- And add "{ "range6_max", 1, 0, 35, {0.0, 5.0, 9.0, 16.0}, "range6_max", 1 }," at the end of it:
AttributeData = { -- { attribute name, zero ok, min, max, rank list, ui attribute name, game->ui scale factor } { "hitpoints", nil, 1, 2000, {0.0, 90.0, 160.0, 240.0}, "health", 1 }, { "armour", 1, 0, 0.9, {0.0, 0.15, 0.20, 0.35}, "armour", 100 }, { "speed_max", 1, 8, 50, {0.0, 25.0, 35.0, 45.0}, "landspeed", 1 }, { "waterspeed_max", 1, 8, 40, {0.0, 4.0, 6.0, 8.5}, "waterspeed", 1 }, { "airspeed_max", 1, 8, 50, {0.0, 5.0, 15.0, 20.0}, "airspeed", 1 }, { "sight_radius1", nil, 10, 1000, {0.0, 25.0, 35.0, 45.0}, "sightradius", 1 }, { "size", nil, 1, 10, {0, 3, 6, 9}, "size", 1 }, { "melee_damage", 1, 0, 1000, {0.0, 5.0, 9.0, 11.5}, "damage", 1 }, --{ "range2_damage", 1, 0, 1000, {0.0, 1.0, 2.0, 3.0}, "range2_damage", 1 }, --{ "range4_damage", 1, 0, 1000, {0.0, 1.0, 2.0, 3.0}, "range4_damage", 1 }, --{ "range5_damage", 1, 0, 1000, {0.0, 1.0, 2.0, 3.0}, "range5_damage", 1 }, { "range2_max", 1, 0, 35, {0.0, 5.0, 9.0, 16.0}, "range2_max", 1 }, { "range4_max", 1, 0, 35, {0.0, 5.0, 9.0, 16.0}, "range4_max", 1 }, { "range5_max", 1, 0, 200, {0.0, 5.0, 9.0, 16.0}, "range5_max", 1 }, { "range6_max", 1, 0, 35, {0.0, 5.0, 9.0, 16.0}, "range6_max", 1 }, };

- The second spot you need to find is this:
if checkgameattribute( "range4_damage" ) == 1 then val = getgameattribute( "range4_damage" ); if (val and val > 0) then -- if this is artillyer --if (getgameattribute( "range4_special" ) > 0) then -- rating = Rank( val, {0.0,4.0,8.0,13.5} ); -- setattribute( "range4_damage_rating", rating - 1 ); -- this is direct range --else rating = Rank( val, {0.0,12.0,20.0,26.0} ); setattribute( "range4_damage_rating", rating - 1 ); --end setattribute( "range4_damage_val", val ); end end -- Tail ranged attacks (chem spray) if checkgameattribute( "range5_damage" ) == 1 then val = getgameattribute( "range5_damage" ); if (val and val > 0) then -- if this is artillery --if (getgameattribute( "range5_special" ) > 0) then -- rating = Rank( val, {0.0,4.0,8.0,13.5} ); -- setattribute( "range5_damage_rating", rating - 1 ); -- this is direct range --else rating = Rank( val, {0.0,12.0,20.0,26.0} ); setattribute( "range5_damage_rating", rating - 1 ); --end setattribute( "range5_damage_val", val ); end end

- Simply copy the section that talks about "4" (the head) range attack, add it at the end of this section and change the "4" number to "6":
if checkgameattribute( "range4_damage" ) == 1 then val = getgameattribute( "range4_damage" ); if (val and val > 0) then -- if this is artillyer --if (getgameattribute( "range4_special" ) > 0) then -- rating = Rank( val, {0.0,4.0,8.0,13.5} ); -- setattribute( "range4_damage_rating", rating - 1 ); -- this is direct range --else rating = Rank( val, {0.0,12.0,20.0,26.0} ); setattribute( "range4_damage_rating", rating - 1 ); --end setattribute( "range4_damage_val", val ); end end -- Tail ranged attacks (chem spray) if checkgameattribute( "range5_damage" ) == 1 then val = getgameattribute( "range5_damage" ); if (val and val > 0) then -- if this is artillery --if (getgameattribute( "range5_special" ) > 0) then -- rating = Rank( val, {0.0,4.0,8.0,13.5} ); -- setattribute( "range5_damage_rating", rating - 1 ); -- this is direct range --else rating = Rank( val, {0.0,12.0,20.0,26.0} ); setattribute( "range5_damage_rating", rating - 1 ); --end setattribute( "range5_damage_val", val ); end end if checkgameattribute( "range6_damage" ) == 1 then val = getgameattribute( "range6_damage" ); if (val and val > 0) then -- if this is artillyer --if (getgameattribute( "range6_special" ) > 0) then -- rating = Rank( val, {0.0,4.0,8.0,13.5} ); -- setattribute( "range6_damage_rating", rating - 1 ); -- this is direct range --else rating = Rank( val, {0.0,12.0,20.0,26.0} ); setattribute( "range6_damage_rating", rating - 1 ); --end setattribute( "range6_damage_val", val ); end end
Ranged attack on any limb - 2
- The third spot you need to find is this:
-- range4 damage damage4 = getgameattribute( "range4_damage" ); -- tweak the ranking of damage from range units damage4rank = damage4 * rangeRankModifier; if (getgameattribute( "range4_special" ) > 0) then -- make artillery units cost a bit more damage4 = damage4 * artilleryCostModifier; else -- make direct range units cost a bit more damage4 = damage4 * directCostModifier; end -- range5 damage damage5 = getgameattribute( "range5_damage" ); -- tweak the ranking of damage from range units damage5rank = damage5 * longrangeRankModifier; if (getgameattribute( "range5_special" ) > 0) then -- make artillery units cost a bit more damage5 = damage5 * artilleryCostModifier; else -- make direct range units cost a bit more damage5 = damage5 * directCostModifier; end

- Just like we did before we copy the entire section that talks about range attack on 4 (head) copy it and add it at the end, and replace the "4" with "6":
-- range4 damage damage4 = getgameattribute( "range4_damage" ); -- tweak the ranking of damage from range units damage4rank = damage4 * rangeRankModifier; if (getgameattribute( "range4_special" ) > 0) then -- make artillery units cost a bit more damage4 = damage4 * artilleryCostModifier; else -- make direct range units cost a bit more damage4 = damage4 * directCostModifier; end -- range5 damage damage5 = getgameattribute( "range5_damage" ); -- tweak the ranking of damage from range units damage5rank = damage5 * longrangeRankModifier; if (getgameattribute( "range5_special" ) > 0) then -- make artillery units cost a bit more damage5 = damage5 * artilleryCostModifier; else -- make direct range units cost a bit more damage5 = damage5 * directCostModifier; end -- range6 damage damage6 = getgameattribute( "range6_damage" ); -- tweak the ranking of damage from range units damage6rank = damage6 * rangeRankModifier; if (getgameattribute( "range6_special" ) > 0) then -- make artillery units cost a bit more damage6 = damage6 * artilleryCostModifier; else -- make direct range units cost a bit more damage6 = damage6 * directCostModifier; end

- The fourth spot you need to find is this:
BodyPartsThatCanHaveRange = { 2, 4, 5 };

- Simply add "6" to the list
BodyPartsThatCanHaveRange = { 2, 4, 5, 6 };

- The fifth spot you need to find is this:
if ( getgameattribute("is_flyer") == 1 ) then for index, part in BodyPartsThatCanHaveRange do if ( getgameattribute( "range" .. part .. "_special" ) > 0 ) then CostGather = CostGather * 1.2; if (getgameattribute("range2_max") > 24) then setattribute("range2_max",23.0); end if (getgameattribute("range4_max") > 24) then setattribute("range4_max",23.0); end if (getgameattribute("range5_max") > 24) then setattribute("range5_max",23.0); end end end end

- And yet again add a section about "6" (torso) by mimicking the other limb setups:
if ( getgameattribute("is_flyer") == 1 ) then for index, part in BodyPartsThatCanHaveRange do if ( getgameattribute( "range" .. part .. "_special" ) > 0 ) then CostGather = CostGather * 1.2; if (getgameattribute("range2_max") > 24) then setattribute("range2_max",23.0); end if (getgameattribute("range4_max") > 24) then setattribute("range4_max",23.0); end if (getgameattribute("range5_max") > 24) then setattribute("range5_max",23.0); end if (getgameattribute("range6_max") > 24) then setattribute("range6_max",23.0); end end end end

- And that's it, save your changes, now in your creature ".lua" stat files you may add range attack on that body part (6-torso) like you would for a head (4) for example:


-In game preview:
1 条留言
the2ndSign 3 月 4 日 上午 10:06 
I'd add that for hex values that take up multiple bytes, the byte order is reversed. For example, if you want to change the pop cap to 1000 (3E8), you'll actually need to input E803 into the editor (note the leading zero in front of the three).