April 30, 2024, 05:50:39 PM

Username
Password

Pages: 1 [2] 3 4 ... 6   Go Down
Print
Author Topic: Enemy units in Campaign  (Read 49570 times)
0 Members and 1 Guest are viewing this topic.
cuthalion
Campaign Creator
*
Offline Offline

Posts: 385


View Profile
« Reply #15 on: March 19, 2012, 10:07:04 AM »

1st Mission, an extract from 2nd NG Regiment script (unit id = 132)

    init_teleport 24
    teleport_to2

This code transfers them to right-top corner (subchunk 24)
If there a way to write an if-then-else construction, with checking unit_id, like:
if (unit_id == 132) - transfer to 24
else if (unit_id == 133) - transfer to 25
else transfer to 26
?
so far didn't fully understand how to check unit id.

Or is the logic of the script "1 Unit ID <=> 1 Script'? Then I would probably have to copy-paste script for NG-2 append it to the end of .ctl file and assign it to unit 133 that may appear in B1_01.btb?



Logged
Ghabry
Developer
*
Offline Offline

Posts: 1020



View Profile
« Reply #16 on: March 19, 2012, 05:15:53 PM »

I will upload a 32bit version of BTB Edit later, must be a mistake in the build settings.
Btw, when you select the X-coordinate in the treeview and click on the map it will assign the values to X and Y, the same applies for Regions. Not documented anywhere, but quite useful.


For the initialisation of a unit it's recommended to assign an unique script function:

Quote
When you open the b101.txt you will see functions. All regiments start with the function defined by the value in <13> in their deployment zone circle. All regions are defined in <6000> in the BTB Editor. The deployment zones are assigned via the Unit Id (check in Wh32Edit), you can find the Id in <12>. <13> is the number of the script function that gets executed on start. Human controlled regiments always execute func 100 (can be altered), in multiplayer all regiments always execute func 100, <13> is ignored.

We don't really know how the initialisation works, but it seams that the following functions are usually called:

.func 2
    init_unit 128
    clear_ctrl_flag 32768
    set_label 43970 <-- Change this to a unique label
    set_event_handler 15 <-- Remove or write your own handler (but we don't really know what most events mean...)
    #3e 13, 31 <-- Looks like the 31 is incremented by 1 for any unit, but dunno
    wait_for_deploy
    saveip


The unique label you assigned can then be checked with test_unit_label 43970 followed by a conditional like iftrue or iffalse.

The Dark Omen Devs usually use the functions unique for one unit. Often with lots of copy paste. Only the event handlers are sometimes shared.
Logged

cuthalion
Campaign Creator
*
Offline Offline

Posts: 385


View Profile
« Reply #17 on: March 19, 2012, 06:30:48 PM »

32bit BTBEditor would be great!

Yes it's better to assign 1 script to 1 unit. Just so far I didn't notice bugs when I assign the same behaviour script to different units. Probably for the sake of time it's ok to do it.

What I failed to do is I failed to force shaman cast Sad

I copy-pasted a shaman script from a mission where he repops at start - like B2_02 ambush by goblins.
Adjusted what values I knew in the script, and didnt' touch 90% of main part. The shaman did pop but he behaved like an ordinary infantry unit.
Logged
cuthalion
Campaign Creator
*
Offline Offline

Posts: 385


View Profile
« Reply #18 on: March 19, 2012, 06:59:56 PM »

#9d looks like a spells set for a mage.

For 1 of 4 mages in B5_01b we have:

    #9d 50
    #9d 55
    #9d 48
    #9d 54

A combo like this always goes 3-4 lines in a row, and is met only for mage scripts, never for other units.
Tomorrow I will try to pick up values for fire and ice mage.
If my assumption is true and the values are decimal, necro has range 48-55 (I counted 8 spells for them except Dispel), values for Orc shamans go around 42-47 or something.

Update:
Looked into db.xml for the Army editor, the spell numbers there coincide with these values. So if I fail to insert a mage into 'empty space', I will at least try to play with mages on the maps where they exist by default. My dream is to kill Luther and hear his thin squeky sriek Smiley

1 more update.
2 Conflagrations and Mr Schepke is fleeing alone leaving 19 of his boys burnt out on the ground. I liked it.
The only thing I doubt is that ice mage will have enough intellegence to use death frost + cloak in melee...but anyways.
« Last Edit: March 19, 2012, 07:30:31 PM by cuthalion » Logged
olly
Global Spokesperson
*
Offline Offline

Posts: 2275



View Profile
« Reply #19 on: March 19, 2012, 07:45:13 PM »

Good progress, well done!

Smiley
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: 385


View Profile
« Reply #20 on: March 20, 2012, 03:25:38 PM »

Pity neither BTBEditor nor BTB-XML are indexing Subchunks in any way. It's pain in the ass to find say subchunk 34 in the list of 60 subchunks   Sad and ther are a lot of such occasions even for 1 map.
Logged
cuthalion
Campaign Creator
*
Offline Offline

Posts: 385


View Profile
« Reply #21 on: March 22, 2012, 12:30:34 PM »

I managed to place an artillery on a mission where it's not by default.

It happened so that my Unit-1 attacked that artillery, and the fight was going on for 40 mins: 1st minute artillery crew became 2/4, the next 39 minutes none died.

I referred it to some bug because of incorrectly transferred artillery ctl script.
I forced my unit to flee, and another bug occured: artillery remained in 'pursue' mode with red arrow even though my unit was far away. That kind of justified some bug with the artillery.

But then I reduced Artillery toughness from 7 to 3, and replayed. The artillery died alright within 2 minutes. My unit Str was 4, and I used 'here we go' and 'boost unit strength'.

I wonder if such things occured in the default campaign: I mean that sometimes artillery is too tough for units to break through it...does anyone know what's it about?
Logged
Darkmancer
Developer
*
Offline Offline

Posts: 406



View Profile
« Reply #22 on: March 22, 2012, 11:07:54 PM »

Leader sprites are immune to all forms of damage whilst there are squad mates alive.  Normally this is not noticable, but artilery has a v.large leader sprite (the machine itself).  Plus the leader has no attack.  So when attacking if your squad doesn't deploy itself correctly, it can end up with no contact with the arty crew and your unit.  In which case all attacks are lost, no one dies.

A possible work around is giving the artillery the skeleton flag.

It is possible to make units too tough to hurt, and generally its best to keep to 6 or below toughness.

I dunno about the arty chasing bug, maybe its unit type was wrong?
Logged

Cry woe, destruction, ruin, and decay:
The worst is death, and death will have his day.

[23:04:33] <*Ghabry> The internal design of Darkmancer is just strange
olly
Global Spokesperson
*
Offline Offline

Posts: 2275



View Profile
« Reply #23 on: March 22, 2012, 11:14:17 PM »

I agree with Darkmancer's advice on leader etc but could you document/post your CTL/BTB/WH32edit additions so I can follow and replicate them, to try and locate possible bug, as really interested about making a guide for adding more ai etc.. for future references.

Smiley

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: 385


View Profile
« Reply #24 on: March 23, 2012, 08:17:05 AM »

Thank you very much for replies, I will pack and send you the files when I get back home.

By the way, Artillery can be destroyed prior to all its crew: it mayhap that the connon is down and 1-2 cannoneers flee but then can return and act as an infantry regiment. And what confused me is it was indestructible with toughness 7 but when I set toughness to 3 the artillery was destroyed alright...But maybe it's just a coincidence.
Logged
cuthalion
Campaign Creator
*
Offline Offline

Posts: 385


View Profile
« Reply #25 on: March 23, 2012, 08:31:51 AM »

I started a new campaign with modified btb/ctl files, and encountered a nasty bug that spoils all the fun from the work.
Pretty please, help me to track it down or maybe someone already knows the answer. It is very important for the campaign.
Let me try to describe it in brief but with details.

1. It doesn't seem to occur on missions B101, B102, B104, but occurs on B103, B105, B107...maybe conneted to undead.
2. Let's take B107 (it has a regiment of enemy horsemen)
3. In Army Editor: overwrite 1st zombie regiment (that raises from the ground when you advance north) with those horsemen and adjust unit ID.
4. When you start playing the mission, the horsemen appear but they don't have a banner, and though they charge your units, combat doesn't start and you just 'pass through' each other.
5. It's almost certain the problem is in CTL. it can't be a bug with army unit, and the btb instructions are transparent and simple as well.
6. I tried to compare ctl scripts for buggy zombie-horsemen and non-buggy horsemen that appear later.
   They differ at a few points but I failed to adjust the script so that it worked alright. At some point the banner appeared but they anyway couldn't attack my regiments, and I couldn't attack them.

7. Now, the same happens if I substitute zombies with any cavalry - undead or alive, and unfortunately with majority other infantry as well, except for: mercenary infantry, imperial greatswords, skeleton warriors, maybe something else.
If I set Halberdiers, Dwarfs, Flagellants or whatever, the same bug occurs as with horsemen.

8. I believe it is connected to unit sprite types: what else differs imperial halberdiers and greatswords? their sprites have slightly different structure like having 5 'battle' movements vs 3, and something else.
Meanwhile, greatswords work alright as a substritution to any zombie, skeleon warrior or ghoul, while halberdiers provide that nasty bug I am talking about.

9. But be it sprites or not, I failed to adjust the script perfectly. I will try more as I can't advance in campaign building w/o it being fixxed, but I appretiate your help very much. Please.
Logged
cuthalion
Campaign Creator
*
Offline Offline

Posts: 385


View Profile
« Reply #26 on: March 23, 2012, 09:28:09 AM »

Partially solved the problem. Why partially? because it is blind-walking and I am not sure if I didn't break anything else.

So there were 2 problems: 1) Inability to enter Melee combat with Horsemen 2) Absense of Banner on Horsemen

1) replace teleport_to with teleport_to2 helped to solve it. Horsemen attacked my defence line and the melee combat did start. A back-change in Army File horsemen->zombies: zombies can't work with teleport_to2, they behaved the same way as horsemen with teleport_to

2)     set_unit_flag1 536870912         /* = 2^29 */
       After I removed this instruction, the horsemen received the banner. I don't know what's checked in bit with sequence number 29, maybe there is something else important...
Let's see what happens further.
Logged
Darkmancer
Developer
*
Offline Offline

Posts: 406



View Profile
« Reply #27 on: March 23, 2012, 04:54:44 PM »

Are you sure the bug doesnt occur with Ghouls?  All the troops you listed it works with have 95 frames of animation.

Ghouls and all the others you listed have other amounts.

Also yes your correct the cannon can be destroyed before losing its crew, it's the fleeing thats the important part and that only occurs when the crew get hit, the cannon itself remains immune to damage.
« Last Edit: March 23, 2012, 05:16:55 PM by Darkmancer » Logged

Cry woe, destruction, ruin, and decay:
The worst is death, and death will have his day.

[23:04:33] <*Ghabry> The internal design of Darkmancer is just strange
cuthalion
Campaign Creator
*
Offline Offline

Posts: 385


View Profile
« Reply #28 on: March 23, 2012, 05:39:42 PM »

Sure about Zombies and Skeletons, not sure about Ghouls - just I remember I had similar problems on mission b103.
Logged
cuthalion
Campaign Creator
*
Offline Offline

Posts: 385


View Profile
« Reply #29 on: March 25, 2012, 06:49:50 AM »

Hi, I have a few questions.

1. Is there a known way to edit phrases units exchange during the missions? Like "Protect your flag, undead horsen chariots approach!" or others?

2. I didn't find enough information where to look for inter-mission scripts, but I have a specific question:
   Is there a known way to remove or change artifacts that drop from buildings, like Book of Ashur or Horn of Urgok.
   The problem is that having the full set of "building" artifacts vs not having them influences the balance crucially, and I want all who may try my upcoming campaign not depend on whether they remember everything or not.

3. Speaking again of those phrases during the missions. Though in default campaign all units speak with their own voices, after I change both my and enemy units, they seem to speak the phrases with random voices instead of their own.
Except for undead maybe...Is there a way to specify it? sounds funny when Treemen speak with squeaky goblin voices. Smiley
Logged
Pages: 1 [2] 3 4 ... 6   Go Up
Print
Jump to: