Jump to content


Photo

How do I edit unit upgrades in map.ini?

map.ini error bfme2

Best Answer Gannicus, 15 March 2017 - 11:27 AM

I forgot to try shooting, but you can fix it by giving the original upgrade after the new one is purchased. Here is one way to fix it:

 

Add new ModifierList:

 

ModifierList Silverthorn
    Category = SPELL
    Duration = 0
    Upgrade  = Upgrade_ElvenSilverthornArrows Delay:10
End
 
Then add this module to LorienArcher:
 
AddModule
         Behavior = AttributeModifierUpgrade ModuleTag_Reinforced
                      TriggeredBy = Upgrade_ElvenSilverthornArrowsNEW
                      AttributeModifier = Silverthorn
         End
End
 
Since you end up giving the original upgrade as well in the end, you wouldn't have to replace the modules within LorienArcher that are triggered by the original upgrade. 
 
 
Go to the full post


  • Please log in to reply
13 replies to this topic

#1 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 11 March 2017 - 04:43 AM

So I'm making this map.ini in which I'm trying to change the cost and build time for the Elven Silverthorn arrows upgrade. At first I assumed it would be as simple as just changing "Buildcost" and "Buildtime" for "Upgrade Upgrade_TechnologyElvenSilverthornArrows" and "Upgrade Upgrade_ElvenSilverthornArrows", but after reading a bunch of stuff such as this, this and this, I realized I had to create a new upgrade and replace it with the old.

 

So I did this:

Spoiler

 

I then went into elvenlorienarcher.ini to find the modules to replace. With a quick search I found:

Spoiler

 

Since I'm not quite sure what they all do, I decided to just replace all of them like so:

Spoiler

 

However, this caused the game to crash with the error "ReplaceModule ModuleTag_WeaponSetUpgradeTag was not found for ElvenLorienArcher". I was very confused about this since the module clearly exists in the elvenlorienarcher.ini, but I decided to leave it out from the object testing with just the remaining two modules.

 

This time the map started, the cost and time for the forge silverthorn upgrade worked just fine and the cost of silverthorns for the Lorien archer horde had been changed.... but now I'm left with another problem. It's grayed out with the "You need the Eregion Forge silverthorn upgrade blahblah" text and I simply cannot press it.

 

I've spent the whole night trying to fix it but I'm out of ideas. What am I doing wrong?

 

Thanks :)

 

* ini layout is 1.Upgrades 2.Commandbuttons 3.Commandsets 4.Objects

* I have not yet tried to edit any other upgrades, so there might just be some issued with silverthorns

* I have tried to replace the lorienarcherhorde module from elvenhordes.ini with no luck.

 

I am sorry if this belongs among the WB threads and I have posted it in the wrong section but it made more sense to post it here to me.


Edited by Jokuc, 15 March 2017 - 01:06 PM.


#2 Gannicus

Gannicus
  • Members
  • 24 posts

Posted 11 March 2017 - 11:17 PM

You misspelled the module name ModueTag_WeaponSetUpgradeTag.


Edited by Gannicus, 11 March 2017 - 11:23 PM.


#3 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 12 March 2017 - 03:48 PM

You misspelled the module name ModueTag_WeaponSetUpgradeTag.

 

Thank you! Such a small thing is hard to notice.

 

The game now launches fine with that module replaced but it still doesn't work:ermm: The Silverthorn arrow upgrade for my unit is replaced but just like before I cannot press it.

 

I decided to see if the problem is me not changing the correct modules for the units, but after some testing I found out that it is not. I kept the changes I had made to PurchaseTechnologyElvenSilverthornArrows and removed my upgrade from PurchaseUpgradeElvenSilverthornArrows (only keeping the "NeededUpgrade") like so:

 

Spoiler

 

but the button was still grayed out, so I believe the problem has to be something about the game not recognizing that I have purchased my new TechnologyElvenSilverthornArrowsNEW upgrade. I just tried to change the EregionForgeLevel2 and 3 upgrades, same thing. I change everything as I'm supposed to but I can't press the buttons cause it says "This unit cannot recieve this upgrade".

 

Any ideas?


Edited by Jokuc, 12 March 2017 - 05:16 PM.


#4 Gannicus

Gannicus
  • Members
  • 24 posts

Posted 13 March 2017 - 03:51 AM

I assume you've made new commandsets for LorienArcherHorde and EregionForge, because otherwise the game won't read the commandbutton changes. Additionally in map.ini you can't have specific object names in object filters. You can get around it by adding some practically unused KindOf like AIRCRAFT to EregionForge and replacing the line in your upgrade RequiredObjectFilter    = NONE +AIRCRAFT.

 

P.S. I tried it this time and it worked for me  :smile2ap: 



#5 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 13 March 2017 - 12:37 PM

I assume you've made new commandsets for LorienArcherHorde and EregionForge, because otherwise the game won't read the commandbutton changes. Additionally in map.ini you can't have specific object names in object filters. You can get around it by adding some practically unused KindOf like AIRCRAFT to EregionForge and replacing the line in your upgrade RequiredObjectFilter    = NONE +AIRCRAFT.

 

P.S. I tried it this time and it worked for me  :smile2ap:

 

Thank you for helping me, I assumed I wouldn't get any answers for a game this old.

 

Anyway, yes, I made new commandsets for them both. I just tried to add aircraft but that didn't work either :( I doubt it matters, but I'm running bfme2 ver 1.00 since WorldBuilder stops working when I use the update switcher. Since there's probably something small I'm missing, I'll just post all relevant code.

 

Spoiler

 

I can't see any errors though :/ Could you post the code you used?


Edited by Jokuc, 13 March 2017 - 01:04 PM.


#6 Gannicus

Gannicus
  • Members
  • 24 posts

Posted 13 March 2017 - 01:57 PM

At least for me the NeededUpgrade line of commandbutton doesn't always work so I escape it by creating a new commandset, where the silverthorn upgrade doesn't require any upgrades, which is initiated by the research of the technology. Also the AIRCRAFT only works after restarting the game.

 

Spoiler

 


Edited by Gannicus, 13 March 2017 - 01:59 PM.


#7 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 13 March 2017 - 07:24 PM

At least for me the NeededUpgrade line of commandbutton doesn't always work so I escape it by creating a new commandset, where the silverthorn upgrade doesn't require any upgrades, which is initiated by the research of the technology. Also the AIRCRAFT only works after restarting the game.

 

Spoiler

 

 

Awesome! :thumbsuphappy: The upgrade is now clickable and successfully upgrades the units once I purchase it... But now I've run into another problem  :ermm:

 

The units don't get the new weapon. As in, once I purchase the upgrade the arrows glow as if they had Silverthorns, but when they shoot at enemies they shoot normal arrows with normal damage. I tried to add

 

Spoiler

 

but it made no difference. Did you try shooting on enemies? If not, what's up now? I can't find anything more about silverthorns in the unit and unithorde files.


Edited by Jokuc, 13 March 2017 - 09:45 PM.


#8 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 14 March 2017 - 06:09 PM

Bad news, I've looked through all the maps I have with map.ini files and none of them have a change to a projectile-type weapon. I did some more digging on the site and found this thread

 

https://forums.revor...jectile-nugget/

 

which leads me to believe it might be impossible to do in map.ini :sad: I feel like there has to be some sort of way around it but to be honest I'm not really sure if it's worth the trouble. I tried to change the cost of the fire arrow upgrade for battle towers and the same thing happened. Upgrade worked but the tower still shoots the normal arrow projectile.



#9 Gannicus

Gannicus
  • Members
  • 24 posts

Posted 15 March 2017 - 11:27 AM   Best Answer

I forgot to try shooting, but you can fix it by giving the original upgrade after the new one is purchased. Here is one way to fix it:

 

Add new ModifierList:

 

ModifierList Silverthorn
    Category = SPELL
    Duration = 0
    Upgrade  = Upgrade_ElvenSilverthornArrows Delay:10
End
 
Then add this module to LorienArcher:
 
AddModule
         Behavior = AttributeModifierUpgrade ModuleTag_Reinforced
                      TriggeredBy = Upgrade_ElvenSilverthornArrowsNEW
                      AttributeModifier = Silverthorn
         End
End
 
Since you end up giving the original upgrade as well in the end, you wouldn't have to replace the modules within LorienArcher that are triggered by the original upgrade. 
 
 

Edited by Gannicus, 15 March 2017 - 11:30 AM.


#10 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 15 March 2017 - 02:32 PM

You can fix it by giving the original upgrade after the new one is purchased. Since you end up giving the original upgrade as well in the end, you wouldn't have to replace the modules within LorienArcher that are triggered by the original upgrade. 

 

Yes! Finally it works perfectly! :good:

 

Good thing I could get rid of those pesky little ReplaceModuleses clustering up my file, this already takes a ridiculous amount of lines for such a minor change lol.

 

I've solved many problems by reading old topics so for anyone reading this thread, here's the final code:

 

Spoiler

 

I learned a lot by asking this and now I know how to activate stuff when something is bought too! Awesome :grad: Since it works now, the only question I have left is wtf is AutoResolveWeapon and WorldMapArmoryUpgradesAllowed? Nothing seems to be affected when I change them. But whatever. Thanks man!


Edited by Jokuc, 15 March 2017 - 02:57 PM.


#11 Gannicus

Gannicus
  • Members
  • 24 posts

Posted 15 March 2017 - 02:50 PM

AutoResolveWeapon and WorldMapArmoryUpgradesAllowed are for war of the ring. Also for EregionForge would be enough if you only changed the lvl3 commandset.


Edited by Gannicus, 15 March 2017 - 02:55 PM.


#12 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 15 March 2017 - 03:03 PM

AutoResolveWeapon and WorldMapArmoryUpgradesAllowed are for war of the ring. Also for EregionForge would be enough if you only changed the lvl3 commandset.

 

Ah. Okay, I see. I know I could just change the level 3 set but I wanted to get rid of heavy armor and forgot to edit it out from the post. It's unrelated to the topic :p



#13 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 21 March 2017 - 05:25 PM

-

 

Hey again, I recently did some testing of my map and I noticed a really strange problem with the silverthorns. The upgrade works fine but the problem occurs when I put an archer unit which is getting their upgrade inside a battle tower. What happens is that they never start using their silverthorns and keep shooting regular arrows even when the upgrade has finished. If I take them out of the tower (or wait until the upgrade finishes before I put them inside) they will use silverthorn arrows and if I put them back into the tower again they'll start using the new weapon. At first I thought it was a bug in the bfme2 v1.0 but I tested it without the map.ini and it is not. I took a look the inside single unit files, horde and elvenbattletower.ini for something that could cause the bug but I couldn't find anything and now I'm out of ideas.

 

Sorry for asking again but do you or anyone else have any idea what's causing this problem? It's quite annoying. 


Edited by Jokuc, 22 March 2017 - 02:03 PM.


#14 Gannicus

Gannicus
  • Members
  • 24 posts

Posted 28 March 2017 - 02:18 PM

It's because attribute modifiers don't work inside towers. You could try to find different way of giving the old upgrade or just make the upgrade build time fast so it's done before they go back inside.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users