Jump to content


Photo

making AI use new units


  • Please log in to reply
7 replies to this topic

#1 Ruthrelad

Ruthrelad
  • Members
  • 22 posts

Posted 24 May 2015 - 01:30 AM

Hello, I am working on a map ini file and want to make the arnor (i am using a mod which adds it) race make elf units out of their barracks. I know how to make a player make them when I add them there since a player sees the options and clicks them but the AI only makes units corresponding to his race. I tried searching for an answer but I couldn't find one.

 

This is what I tried after digging around in the skirmishai file:

 

ArmyDefinition ArnorArmy
 
ArmyMemberDefinition ElvenMithlondSentryHorde_Member
Unit = ElvenMithlondSentryHorde ;pikeman
PercentageOfArmyPhase1 = 20.0
PercentageOfArmyPhase2 = 30.0
PercentageOfArmyPhase3 = 25.0
End
 
        ArmyMemberDefinition MirkwoodwarriorHorde_Member
Unit = MirkwoodwarriorHorde ;super elite infantry/archers
PercentageOfArmyPhase1 = 35.0
PercentageOfArmyPhase2 = 35.0
PercentageOfArmyPhase3 = 25.0
End
 
HeroBuildOrder = ElvenThranduil ElvenLegolas ElvenGilGalad
End
 
This doesn't seem to work. The units are in the building as they should be but the AI refuses to produce them.

Is it possible to force the AI to use non-native units just using the map ini file? 


#2 -SilverBane-

-SilverBane-

    Inactive Noob

  • Project Team
  • 474 posts
  • Location:Bucharest
  • Projects:Life
  •  Mapper & Coder

Posted 24 May 2015 - 07:49 AM

No, I have tried this in the past, there are several modding options that don't cause game crash if added in a map.ini but they don't work either.

Especially the AI related ones.


Edited by -SilverBane-, 24 May 2015 - 07:49 AM.

2qm3dd5.jpg


#3 Ruthrelad

Ruthrelad
  • Members
  • 22 posts

Posted 24 May 2015 - 01:27 PM

Thanks for the reply!

I think one of the other options that just doesn't work on map inis is increases horde size as it too resulted for me with neither a crash nor it actually working.

I followed this tutorial lhttp://www.the3rdage...?apage=274#page and it seems that it's 'limitations to map ini' is incomplete as it doesn't mention these things. Is there somewhere where I can find a more complete list for the limitations of using map inis?



#4 -SilverBane-

-SilverBane-

    Inactive Noob

  • Project Team
  • 474 posts
  • Location:Bucharest
  • Projects:Life
  •  Mapper & Coder

Posted 24 May 2015 - 02:39 PM

Limitations and Tricks to a map.ini file

Although there are many benefits to using a map.ini file, there are some limations for it. Below is a list of things you can't do with a map.ini file.

1. I found out that if you want to change anything in an existing upgrade, you must make a new one and name it something else. This can be a real pain for big map.ini files since you have to change all the units affected by the upgrade also :( I did find, however, that you do not need to change the names of special abilities for the game to read the changes made in it.

2. You can't change the name of commandbuttons. If you try to make your own with a unique name, the button images will not show in-game no matter what. So what you have to do is go through the commandbutton.ini, find one with the button image you want, and change everything else (except the name) for it. This can be annoying at times.

3. You can't edit projectile type weapons. If you try to, the damage will change correctly but the projectile will not show up in-game. All you can do with projectile weapons is change the range of them. Make sure you don't change the name of the weapon though or you'll get the projectile error. Melee weapons are not affected by any of this.

4. To change a commandset, you must make a new one and name it something different.

5. You can't create new objects. You must use an existing object from the game. You can, however, change almost everything with the object and give it a new model, etc...

6. You can't change the 'RequiredExperience' and 'ExperienceAward' part for the Experience Levels. What this means is that you can't change the amount it takes for a unit or hero to gain a level. You can however, add new upgrades in it.

7. You can't add any new art into the game except for fx. You are allowed to make your own custom fx and swap textures for a unit but nothing else.

8. With larger map.ini files, the order you put your code in does matter. So if you are having trouble with the game not reading the code you want, try changing the order in which your file is arranged.

9. Out-Of-Sync errors are sometimes major problems with map.ini files. If you play Online, whenever you finish playing a map with a custom map.ini file, you must restart the game to clean it out.

1 - true

2 - true, but i found a way to change the image shown on existing commandbuttons (its my little contribution to the mapping society X), but i keep it secret)

3 - there is actually a way to increase the damage dealt by ranged weapons

4 - true

5 - you  actually can. I almost always make new ones to prevent bugs and to be able to use others for other purposes. Also if you create ChildObjects, you will be able to change/add behaviors without all that AddModule --behavior stuff--- End or ReplaceModule.

6 - you can but it will sometimes result in gamedat crash (if you get past some values of exp), so better don't mess with it without a good reason. Also if the difference between required exp for levels is too small (like for ex level 1 = 40 , lvl2 = 50), the experience bar for the unit will sometimes glitch and show like its the max level.

7 - yes, but you can check out all the unused art chunks left in the game, some of them can be useful

8 - i have trouble with this ; i have a map that haves an 100kb map.ini and it always goes OoS after a few minutes :/ - i suspect its the order of the code causing oos (even though i never experienced the same issue)

9 - ^^  :(

 

;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Now my list:

1 - The AISpecialPowerUpdate behavior, when used for stances, makes no effect in a map.ini, but works if in a mod
2 - You can't get rid of MISSING on DisplayName if you want a new name, the game wont read it from map.str
3 - You can't change the build cost or time for heroes, but you can change their revive cost/time.
4 - The game will crash if you try to edit AudioEvents
5 - If you try to make a new ranged weapon, nothing will happen
6 - If you want new spellbook powers with a proper requirments system (so you cant buy 25pp if u havent bought first the 15pp one), you are forced to create new sciences (same as with upgrades)
7 - You can't make the AI build a certain unit or hero just through coding (your problem^^) in map.ini
8 - The RequiredUpgradeNames and ForbiddenUpgradeNames for weapon nuggets won't work in a map.ini
9 - You can't create new ENUMS or DAMAGE TYPES (not even in a mod)

and there are more, but can't recall them now

 

@About your problem, I can warranty that you can change horde size in map.ini. Could you please post your code?

 

Also some tips:

*If you get game.dat crash while loading map or doing a specific action (ex clicking on a commandbutton), check the special powers for typos, these ones usually make those nasty errors (along with experiencelevels).

*It's best to create new weapons/armors instead of editing existing ones, but if you are forced to keep them (especially for the ones with RequiredUpgradeNames stuff, such as CAH weapon), here's a tip: the existing nuggets in original ini will be there, if you add new ones they will just be extra damage ( so for example if you wanna keep poison attack for CAH, but increase his base damage, just give him a little extra damage nugget). You can also use ClearNuggets (inside the weapon) to clear existing nuggets of damage.


Edited by -SilverBane-, 24 May 2015 - 02:49 PM.

2qm3dd5.jpg


#5 Ruthrelad

Ruthrelad
  • Members
  • 22 posts

Posted 24 May 2015 - 03:59 PM

Sure I used this but I only changed the slots, initial payload, and the rankinfo. I figured to post the rest of the section as initially my code didn't work although that didn't help either (the original horde has only 10 members, I try to make it 18):
 

Object ImladrisWarriorHorde
 
ReplaceModule ModuleTag_HordeContain
    Behavior = HordeContain MTag_HordeContain
        ObjectStatusOfContained = 
        InitialPayload = ImladrisWarrior 18
        Slots = 18
        PassengerFilter = NONE +INFANTRY
        ShowPips = No
        ThisFormationIsTheMainFormation = Yes    ;Used to determine which armorset to use (and anything else we want!)
        RandomOffset = X:1 Y:1
        AlternateFormation = LAElvenWarriorLineFormation
        
        ; Banner Carrier info        
        BannerCarriersAllowed    = ElvenMirkwoodArcherBanner                                        ; types of units that are allowed as banner carriers
        BannerCarrierPosition    = UnitType:ImladrisWarrior    Pos:X:70.0 Y:0.0    ; (DEFAULT) position of banner carrier for elven warrior horde
        
        ; Positions for 5
        RankInfo = RankNumber:1 UnitType:ImladrisWarrior Position:X:50 Y:0            Position:X:50 Y:20        Position:X:50 Y:-20        Position:X:50 Y:40        Position:X:50 Y:-40        Position:X:50 Y:-60 
        RankInfo = RankNumber:2 UnitType:ImladrisWarrior Position:X:30 Y:0 Leader 1 0    Position:X:30 Y:20 Leader 1 1    Position:X:30 Y:-20 Leader 1 2    Position:X:30 Y:40 Leader 1 3    Position:X:30 Y:-40 Leader 1 4    Position:X:30 Y:-60 Leader 1 5
        RankInfo = RankNumber:3 UnitType:ImladrisWarrior Position:X:10 Y:0 Leader 1 0    Position:X:10 Y:20 Leader 1 1    Position:X:10 Y:-20 Leader 1 2    Position:X:10 Y:40 Leader 1 3    Position:X:10 Y:-40 Leader 1 4    Position:X:10 Y:-60 Leader 1 5        
        RanksToReleaseWhenAttacking = 1 2 3
    End
End
End

Edited by Ruthrelad, 24 May 2015 - 04:02 PM.


#6 -SilverBane-

-SilverBane-

    Inactive Noob

  • Project Team
  • 474 posts
  • Location:Bucharest
  • Projects:Life
  •  Mapper & Coder

Posted 25 May 2015 - 04:47 AM

Are you using a mod? Because this seems like an archer horde for me


2qm3dd5.jpg


#7 Ruthrelad

Ruthrelad
  • Members
  • 22 posts

Posted 25 May 2015 - 08:36 AM

Yes, I am using the THOA 1.3.7.1 mod to be precise. This horde is indeed an archer horde although it does have a special ability to switch to melee. Does them being ranged horde impact the needed code?

Also, just tried today changing the commandbutton neededupgrade field and it doesn't seem to work either.

Since there is no module tag I just copied to code for the specific unit in question and changed the neededupgrade field (this did nothing).


Edited by Ruthrelad, 25 May 2015 - 10:40 AM.


#8 -SilverBane-

-SilverBane-

    Inactive Noob

  • Project Team
  • 474 posts
  • Location:Bucharest
  • Projects:Life
  •  Mapper & Coder

Posted 25 May 2015 - 11:09 AM

oh this is rotwk.... well i have rotwk but never made maps for it... maybe the bug occurs only in rotwk.... both of your problems do not appear in bfme2


2qm3dd5.jpg





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users