November 19, 2017, 03:08:23 PM

Username
Password

Pages: [1]   Go Down
Print
Author Topic: Custom CTL OpCodes  (Read 644 times)
0 Members and 1 Guest are viewing this topic.
Ghabry
Developer
*
Offline Offline

Posts: 1008



View Profile
« on: April 30, 2017, 06:38:44 PM »

The latest version of the "Mod Selector" added support for custom CTL commands. To use them you need the latest version of ctldis, too.

Currently implemented commands:

set_deployment_limit n - Sets the deployment limit on this map to "n". Call before "wait_for_deploy" in .func 100.

Any ideas for further commands?
Logged

olly
Global Spokesperson
*
Offline Offline

Posts: 1833



View Profile
« Reply #1 on: May 01, 2017, 11:20:51 AM »

Not sure if it's possible but

1) could an enemy archer unit be instructed to attack closest player's unit, instead of whoever triggered his boundary
2) or stop following a unit it is after perhaps, to avoid being lured down the map.
3) could melee troops disengage after a certain amount of damage like archers on Trading Post


http://wiki.dark-omen.org/do/DO/CTL/OpCodes
« Last Edit: May 01, 2017, 11:26:47 AM by olly » Logged

and back in Nuln, the ageing Graf Berhardt smiled his secret smile of pride whenever he heard the latest tales of his eldest son's ever growing chain of glorious victories -(sothr manual)
cuthalion
Campaign Creator
*
Offline Offline

Posts: 370


View Profile
« Reply #2 on: May 01, 2017, 01:46:51 PM »

When editing CTL scripts in campaigns, I missed a few things badly.

1. A randomizer. It was needed in many occasions. Among them - enemy units popping in one of 2-3 places to reduce predictable scenarios. Also, random magic books for own troops. 2 spells set at random out of a list of 6, for example. Many other scenarios.

2. I missed ability to read a unit's race. I had to hardcode all skaven and dwarvish phrases based on unit's ID. It is very clumsy but at that time there was no better solution.

There maybe other things I will recall later...It has been quite a while since then so I almost forgot what CTL is in the first place Smiley
Logged
Ghabry
Developer
*
Offline Offline

Posts: 1008



View Profile
« Reply #3 on: May 01, 2017, 11:24:33 PM »

Olly your requests are probably too complex for single opcodes. That should be achievable through smart ctl usage I assume.

Cuthalion: proper random is easy to add Smiley
Guess I could also provide old opcodes which take a register argument instead of only constants, will add more flexibility (e.g. for addmagic)
How is the unit race specified in wh32edit?
Logged

cuthalion
Campaign Creator
*
Offline Offline

Posts: 370


View Profile
« Reply #4 on: May 04, 2017, 03:29:37 PM »

Unit type. last 3 bytes are responsible for race.

if Type mod 8 = 0 - it's a human race etc. Type mod 8 = 1 is elves I think, etc.
I do not have race order at hand, but I think you know it yourself, just you forgot.

Update.
Order is as follows:
   <unittype>
      <item value="0">(None)</item>
      <item value="8">Human infantry</item>
      <item value="9">Wood elf infantry</item>
      <item value="10">Dwarf infantry</item>
      <item value="11">Night goblin infantry</item>
      <item value="12">Orc infantry</item>
      <item value="13">Undead infantry</item>
      <item value="14">Townsfolk</item>
      <item value="15">Ogres</item>
      <item value="16">Human cavallry</item>
      <item value="20">Orc cavallry</item>
      <item value="21">Undead cavallry</item>
      <item value="24">Human archers</item>
      <item value="25">Wood elf archers</item>
      <item value="27">Night goblin archers</item>
      <item value="28">Orc archers</item>
      <item value="29">Skeleton archers</item>
      <item value="32">Human artillery</item>
      <item value="36">Orc artillery</item>
      <item value="37">Undead artillery</item>
      <item value="40">Human wizard</item>
      <item value="43">Night goblin shaman</item>
      <item value="44">Orc shaman</item>
      <item value="45">Evil wizard</item>
      <item value="61">Undead chariot</item>
      <item value="67">Fanatic</item>
      <item value="55">Monster</item>
      <item value="53">Dread King</item>
   </unittype>
Logged
Ghabry
Developer
*
Offline Offline

Posts: 1008



View Profile
« Reply #5 on: May 04, 2017, 04:52:43 PM »

Aaah, yeah. That stuff. Was documented here: http://wiki.dark-omen.org/do/Talk:DO/ARM#Unit_Type_Bitfield

Okay so CTL had only a unit type but no race check. good.
Logged

cuthalion
Campaign Creator
*
Offline Offline

Posts: 370


View Profile
« Reply #6 on: May 05, 2017, 11:29:25 AM »

One more thought related to race speech checks.

2 Years ago I had no better solution than to hardcode a set of unit ids that would talk dwarvish or skavenish, and do it for every of 25+ ctl mission files. Even if I had a simple race check at hand, I would still have to edit all 25+ ctl files.

Is it possible to upsert global functions starting with certain func id? Functions that would override (at your own risk) default local functions.
Logged
Ghabry
Developer
*
Offline Offline

Posts: 1008



View Profile
« Reply #7 on: May 05, 2017, 05:20:28 PM »

Global CTL functions sounds interesting. Conviniently Dark Omen has one function to do the function number -> address mapping so in theory it should be feasible to simply parse a 2nd CTL file which contains "global functions" and then to hook this lookup function... Will check how hard this is.
Logged

Pages: [1]   Go Up
Print
Jump to: