Ok so,
I want to know if it is possible to make a unit production button (, in this case the Gondor Ranger's own, ) only usable when Faramir is present and the Archery Range is on Level 3? If so, how would I do this ? Thank You in advance !
Posted 29 April 2013 - 11:08 PM
Ok so,
I want to know if it is possible to make a unit production button (, in this case the Gondor Ranger's own, ) only usable when Faramir is present and the Archery Range is on Level 3? If so, how would I do this ? Thank You in advance !
Posted 30 April 2013 - 01:44 AM
Via scripting in WB it's quite easy, but other than that.. I can think of a way, but I'm not sure if it'll work:
faramir.ini:
Give him a Leadership power that only affects the GondorArcherRange object:
Behavior = AttributeModifierAuraUpdate ModuleTag_LeadershipArcheryRange StartsActive = Yes BonusName = GondorFaramirRangerRequirement RefreshDelay = 2000 Range = 200 ObjectFilter = NONE +GondorArcherRange End
Change the range as you see fit. I sometimes have troubles with the NONE filter, but I think it usually works when I use Object names as opposed to KindOfs.
attributemodifier.ini:
Well:
ModifierList GondorFaramirRangerRequirement ModelCondition = ALTERNATE_FORMATION Modifier = RESIST_FEAR 100% Modifier = PRODUCTION 500% End
I don't think you have to have a Modifier, but it doesn't hurt to have one just in case, especially since it's harmless (buildings don't have fear). Also, the PRODUCTION value is there for you to check if the leadership works in game at all. Archer would be coming out 5x as fast as usual if it does, so you can remove it after you confirm it.
commandbutton.ini:
Change the Ranger's build button by doing two things: Remove the line NeededUpgradeAny = Yes. Then add an aditional upgrade to the NeededUpgrade. Call it, Upgrade_GondorArcheryRangeFaramirNear. It should then look like this:
NeededUpgrade = Upgrade_GondorArcheryRangeLevel3 Upgrade_GondorArcheryRangeFaramirNear
archerrange.ini:
Here lies the fun part. You MAY have to add a dummy ModelConditionState, which is adressed in the attributemodifier. I'm not 100% sure if you need this, so you should save it for last. Alternativly, you could add it regardless, and make the Model a weird one to see if it works (the barracks model for instance). That's probably the best thing to do:
ModelConditionState = ALTERNATE_FORMATION Model = None End
In the AIUpdateInterface, add a AILuaEventsList, so it looks like this:
Behavior = AIUpdateInterface ModuleTag_SoWeCanUseWeapon AutoAcquireEnemiesWhenIdle = Yes MoodAttackCheckRate = 250 AILuaEventsList = GondorArcherRangeFunctions End
scriptevents.xml:
Add these where appropriate:
<ModelConditionEvent Name="FaramirNear"> <Conditions>+ALTERNATE_FORMATION</Conditions> </ModelConditionEvent> <ModelConditionEvent Name="FaramirAway"> <Conditions>-ALTERNATE_FORMATION</Conditions> </ModelConditionEvent>
<EventList Name="GondorArcherRangeFunctions" Inherit="BaseScriptFunctions"> <EventHandler EventName="OnCreated" ScriptFunctionName="OnGondorArcheryRangeCreated" DebugSingleStep="false"/> <EventHandler EventName="FaramirNear" ScriptFunctionName="OnGondorArcheryRangeFaramirNear" DebugSingleStep="false"/> <EventHandler EventName="FaramirAway" ScriptFunctionName="OnGondorArcheryRangeFaramirAway" DebugSingleStep="false"/> </EventList>
scripts.lua:
Add these:
function OnGondorArcheryRangeCreated(self) ObjectGrantUpgrade( self, "Upgrade_GondorArcheryRangeDefault" ) end function OnGondorArcheryRangeFaramirNear(self) ObjectRemoveUpgrade( self, "Upgrade_GondorArcheryRangeDefault" ) ObjectGrantUpgrade( self, "Upgrade_GondorArcheryRangeFaramirNear" ) end function OnGondorArcheryRangeFaramirAway(self) ObjectRemoveUpgrade( self, "Upgrade_GondorArcheryRangeFaramirNear" ) ObjectGrantUpgrade( self, "Upgrade_GondorArcheryRangeDefault" ) end
upgrade.ini:
Well, add all upgrades that we've talked about
Upgrade Upgrade_GondorArcheryRangeDefault Type = OBJECT End Upgrade Upgrade_GondorArcheryRangeFaramirNear Type = OBJECT End
I don't think I've forgotten anything, so you should try it out. I haven't tried myself, as I'm rather busy with a couple of exams this week. The only trouble I can guess would be to get the Archery Range to change it's ModelConditionState.
The 4th Age version 0.8 has been released: Link
0 members, 0 guests, 0 anonymous users