Jump to content


Photo

units has their Forged blade upgrade on from the start

modding

Best Answer Echo, 17 July 2020 - 02:28 PM

The object is displayed by default, you have to hide them with a lua function. I don't have my modding utility here, but I think you can find the required files in Data.big. Specifically you will need scriptevents.xml and scripts.lua (can be edited with notepad or other simple text editors). Then just take a look at the GondorFighter object. In the AIUpdateInterface module, it should have something called "AILuaEventsList = SomeFunctions". You can find that "SomeFunctions" in scriptevents.xml. That refers to a lua script in scripts.lua, among them a function that hides the forged blade of the GondorFighter. "EventName" refers to the condition, in your case "OnCreated", and ScriptFunctionName refers to the lua script that gets executed if the condition is met. If you could follow me until here, it should be fairly straightforward from here on, because it'll just be copy & paste and change names.

Copy the "SomeFunctions" block of the GondorFighter in scriptevents.xml, paste it below the "SomeFunctions" block, change the name to something else ( I'll call it "YourUnitFunctions" here), then go to lua, copy the function name that hides the forged blades, paste it below, change the name of the function to something unique that makes sense (generally used is "OnUnitXCreated", substitute the X), change the name of the forged blade subobject so you hide the correct object, and make sure that "YourUnitFunctions" calls the proper function OnCreated, in this case "OnUnitXCreated". Finally make sure to refer to "YourUnitFunctions" in AILuaEventsList in your units' object code.

 

It probably sounds more complicated than it actually is. If anything is unclear, just ask. I might be able to go more into detail. :)

Go to the full post


  • Please log in to reply
8 replies to this topic

#1 amit5530

amit5530
  • Members
  • 114 posts
  • Location:Israel

Posted 17 July 2020 - 10:49 AM

Hello everyone, Once again i require the help of the pros

 

i am adding rohan footman from return of shadow mod to rohan, the unit is all and well but has its forged blade upgrade on

 

i basically just used gondorFighter forged blade files with some modifications:

 

my rohaninfantry.ini:

	Behavior = WeaponSetUpgrade ModuleTag_Weaponpgrade
		TriggeredBy = Upgrade_RohanForgedBlades Upgrade_TechnologyRohanForgedBlades
		RequiresAllTriggers = Yes
	End
	;;;------the model's FORGED BLADE part called FB-----------
	Behavior = SubObjectsUpgrade ForgedBlade_Upgrade
		TriggeredBy		= Upgrade_RohanForgedBlades
		ShowSubObjects	= FB
	End

i have also attached a screenshot of the model's components

 

no idea what could make them go with the forged blades on (other than that the unit is fully functional and when i buy the forged blade upgrade for the unit their damage does increase)

 

 

Attached Thumbnails

  • FBscreenshot.jpg


#2 Echo

Echo

    T3A:Online

  • T3A Staff
  • 1,069 posts
  • Location:Germany
  • Projects:Lot3A
  •  ~~
  • Division:BFME
  • Job:T3A Moderator
  • Donated

Posted 17 July 2020 - 02:28 PM   Best Answer

The object is displayed by default, you have to hide them with a lua function. I don't have my modding utility here, but I think you can find the required files in Data.big. Specifically you will need scriptevents.xml and scripts.lua (can be edited with notepad or other simple text editors). Then just take a look at the GondorFighter object. In the AIUpdateInterface module, it should have something called "AILuaEventsList = SomeFunctions". You can find that "SomeFunctions" in scriptevents.xml. That refers to a lua script in scripts.lua, among them a function that hides the forged blade of the GondorFighter. "EventName" refers to the condition, in your case "OnCreated", and ScriptFunctionName refers to the lua script that gets executed if the condition is met. If you could follow me until here, it should be fairly straightforward from here on, because it'll just be copy & paste and change names.

Copy the "SomeFunctions" block of the GondorFighter in scriptevents.xml, paste it below the "SomeFunctions" block, change the name to something else ( I'll call it "YourUnitFunctions" here), then go to lua, copy the function name that hides the forged blades, paste it below, change the name of the function to something unique that makes sense (generally used is "OnUnitXCreated", substitute the X), change the name of the forged blade subobject so you hide the correct object, and make sure that "YourUnitFunctions" calls the proper function OnCreated, in this case "OnUnitXCreated". Finally make sure to refer to "YourUnitFunctions" in AILuaEventsList in your units' object code.

 

It probably sounds more complicated than it actually is. If anything is unclear, just ask. I might be able to go more into detail. :)


Edited by Echo, 17 July 2020 - 02:34 PM.

26285.png


#3 amit5530

amit5530
  • Members
  • 114 posts
  • Location:Israel

Posted 17 July 2020 - 02:30 PM

That's the first time i am changing the scripts files and indeed it was the solution. thank you!! 


Edited by amit5530, 17 July 2020 - 02:31 PM.


#4 Echo

Echo

    T3A:Online

  • T3A Staff
  • 1,069 posts
  • Location:Germany
  • Projects:Lot3A
  •  ~~
  • Division:BFME
  • Job:T3A Moderator
  • Donated

Posted 17 July 2020 - 02:58 PM

That's the first time i am changing the scripts files and indeed it was the solution. thank you!! 

Anytime! You can do more advanced stuff with LUA-Scripts (if you take a look at what EA did with them), but most of the time they are used to just instantly hide subobjects.


26285.png


#5 Kwen

Kwen

    Vileartist

  • T3A Staff
  • 4,865 posts
  • Location:Korea I wish
  • Projects:It'sa secreeet
  •  T3A's First N00b
  • Division:BFME
  • Job:T3A Expert
  • Donated

Posted 17 July 2020 - 08:51 PM

You can actually bypass the scripting by adding a behavior that hides subobjects.


                           https://www.twitch.tv/vileartist - Yes shameless self-promotion

          ----------------------------------------------------------------------------------------------------------------------

                            "Old modders never die, they just fade away" ~ Hostile


#6 Echo

Echo

    T3A:Online

  • T3A Staff
  • 1,069 posts
  • Location:Germany
  • Projects:Lot3A
  •  ~~
  • Division:BFME
  • Job:T3A Moderator
  • Donated

Posted 18 July 2020 - 02:36 AM

You can actually bypass the scripting by adding a behavior that hides subobjects.

True. It occured to me once (can't remember the details) that immediately after spawning an object, you would see the subobject for a few frames before it would be hidden, and I think it occured when I did it with a behavior. I've never had this issue occur with lua scripts. I might be wrong about this though.


26285.png


#7 Kwen

Kwen

    Vileartist

  • T3A Staff
  • 4,865 posts
  • Location:Korea I wish
  • Projects:It'sa secreeet
  •  T3A's First N00b
  • Division:BFME
  • Job:T3A Expert
  • Donated

Posted 19 July 2020 - 04:05 AM

 

You can actually bypass the scripting by adding a behavior that hides subobjects.

True. It occured to me once (can't remember the details) that immediately after spawning an object, you would see the subobject for a few frames before it would be hidden, and I think it occured when I did it with a behavior. I've never had this issue occur with lua scripts. I might be wrong about this though.

 

It's possible, though I cannot say that I've personally encountered this issue. Using lua to hide objects is certainly better, plus it also encourages people to dabble with lua which can have some really interesting and powerful effects overall.

 

But I will say that prior to using lua, I would use a simple hidesubobjects behavior to handle forged blades, fire arrows, and any other necessary objects (many buildings use this) without encountering any noticeable issues.


                           https://www.twitch.tv/vileartist - Yes shameless self-promotion

          ----------------------------------------------------------------------------------------------------------------------

                            "Old modders never die, they just fade away" ~ Hostile


#8 amit5530

amit5530
  • Members
  • 114 posts
  • Location:Israel

Posted 19 July 2020 - 10:48 AM

do you guys know how to determine the exp an horde gives to a building upon production?

 

I have added a new horde, and they instantly level up my building to level 3, they just give too much exp, where can i control the amount of exp it gives?



#9 Echo

Echo

    T3A:Online

  • T3A Staff
  • 1,069 posts
  • Location:Germany
  • Projects:Lot3A
  •  ~~
  • Division:BFME
  • Job:T3A Moderator
  • Donated

Posted 22 July 2020 - 03:45 PM

The amount of XP is determined by the build cost. 500 build cost -> 500 XP. In gamedata.ini or water.ini (depends on how you mod), every structure has an EXPERIENCE_REQUIRED_LVL_2 (or something similar) that controls the leveling. For instance Gondor soldiers cost 120 and grant 120 XP, and the barracks requires 400 XP for level 2. That means 4 soldiers -> level 2. Also, there is another multiplier in gamedata.ini that make buildings level twice as fast in 5+ player games.


26285.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users