Edit: Yes. I managed to figure it out in 17 steps.
Edited by oblivionator, 02 December 2009 - 02:02 AM.
Posted 29 November 2009 - 06:10 AM
Edited by oblivionator, 02 December 2009 - 02:02 AM.
Posted 10 February 2010 - 12:27 PM
Hello, I'm back with a new, personal modding question. For a while now, I've been trying to make the heroes controlled by the AI to retreat back to their fortress when damaged, very much in a similar manner to the SEE mod. When a hero is badly damaged, an invisible One-Ring-like object is spawned over them, causing them to go and give this object to the fortress. This is really to buy the hero some time to heal. A neat way to use (or misuse...hehe) codes. So I've been closely following SEE's codes to see how they did it, and so far I've gotten a hero to retreat back to the fortress and deliver the invisible object, but when they do, it's like they get the One Ring upgrade and have that halo of words above their fortress. What I'm trying to do now is make the fortress not receive the One Ring upgrade when the AI-controlled hero delivers the object, but don't have a clue how to do it. What would need to be done? Thank you in advance for any of your help.
Edit: Yes. I managed to figure it out in 17 steps.
Posted 13 February 2010 - 05:01 PM
Posted 14 February 2010 - 01:51 PM
Axed Head and A.I. Coder for S.E.E. and ... stuff
".. coding is basically boring. What's fun is finding out how things work, take them apart and then put them together in ways that were not intended nor even conceived."
Posted 14 February 2010 - 02:09 PM
Check it out and post what you find. I am eager to see if you can figure out what i did to the codes.
Some advice:
1. Lua provides the upgrade which (along with the AI-upgrade i introduced) adds a ONE_RING variation.
2. Lua will remove the upgrade when the Hero is no longer BADLYDAMAGED.
3. The new status adds an Aura that provides any Fortress closeby a ModelCondition that ...
4. ... triggers the fortresses own Aura which forcebly removes the ONE_RING variation.
4a. --> The fortress won't get the RING.
4b. --> The hero will follow the AI command of entering the fortress no matter if the status has already been changed, but once coming out is again ready to receive AI orders.
5. A damaged AI hero is no longer able to carry/pick up the ring (it already has one) until entering and exiting a fortress.
Looks complicated, eh?
That's why i liked BfMe1's AI much better.
Posted 16 February 2010 - 07:56 PM
; #include "..\..\..\..\includes\HeroAIInjuredBehavior.inc" ;-------------------------------------------------------------------------- ;;; Return Home Behavior ;-------------------------------------------------------------------------- Behavior = OCLSpecialPower ModuleTag_MaketheHomingCall StartsPaused = No SpecialPowerTemplate = SpecialAbilityAIMaketheHomingCall OCL = OCL_AIMaketheHomingCall CreateLocation = CREATE_AT_LOCATION End Behavior = AISpecialPowerUpdate MaketheHomingCallAI CommandButtonName = Command_MaketheHomingCall_AI SpecialPowerAIType = AI_SPECIAL_POWER_STANCEBATTLE ;This seems to be used when the AI-controlled hero has around 1/4 health left. EndAdded new special power code for the "HeroAIInjuredBehavior.inc" file above.
SpecialPower SpecialAbilityAIMaketheHomingCall Enum = SPECIAL_GENERAL_TARGETLESS_THREE ReloadTime = 60000 EndAdded new OCL code for the "HeroAIInjuredBehavior.inc" file above.
ObjectCreationList OCL_AIMaketheHomingCall CreateObject ObjectNames = HeroHomingBeacon Count = 1 FadeIn = Yes FadeTime = 20 Offset = X:0 Y:0 Z:15 End EndAdded new object "HeroHomingBeacon". This will spawn over the hero. The AI will make the hero give this object to the fortress, much like the One Ring. It is invisible.
; 'Ping' for HeroHomingBeacon. Acts like an ring carrier until just before ; the fortress walls Object HeroHomingBeacon EvaEnemyObjectSightedEvent = None ; Not a real unit ; Draw = W3DScriptedModelDraw SpecialAnimStateFX ; DefaultModelConditionState ; Model = Icon ; End ; End ArmorSet Conditions = None Armor = PingArmor DamageFX = NormalDamageFX End ; ***DESIGN parameters *** EditorSorting = SYSTEM KindOf = NO_COLLIDE CREEP IGNORE_FOR_VICTORY IGNORE_FOR_EVA_SPEECH_POSITION;INERT ThreatLevel = 0.0 VisionRange = 0 ShroudClearingRange = 0 ; *** ENGINEERING Parameters *** Body = ActiveBody ModuleTag_Body;Can take damage, but won't die. Can only die from ::kill() or other unresistable damage MaxHealth = 1.0 End Behavior = DestroyDie ModuleTag_Die End Behavior = LifetimeUpdate ModuleTag_HatchTrigger MinLifetime = 60000.0 MaxLifetime = 60000.0 End Behavior = AttachUpdate ModuleTag_Attach ObjectFilter = ANY +HERO ScanRange = 20 ParentStatus = HOLDING_THE_RING AlwaysTeleport = No AnchorToTopOfGeometry = Yes End Behavior = AIUpdateInterface ModuleTag_AIUpdateInterface AutoAcquireEnemiesWhenIdle = No // MoodAttackCheckRate = 500 End LocomotorSet Locomotor = InvisiblePingLocomotor Condition = SET_NORMAL Speed = 1000 End Behavior = SlavedUpdate ModuleTag_Slave UseSlaverAsControlForEvaObjectSightedEvents = Yes DieOnMastersDeath = Yes //Die when my master dies! ; GuardPositionOffset = X:0 Y:0 Z:5 ; GuardMaxRange = 10 ;How far away from master I'm allowed when master is idle (doesn't wander) ; GuardWanderRange = 10 ;How far away I'm allowed to wander from master while guarding. ; ScoutRange = 10 ;How far away from master I'm allowed when master is moving. ; ScoutWanderRange = 0 ;How far I'm allowed to wander from scout point. End EndAdded new armor code for the "HeroHomingBeacon" object above.
Armor PingArmor Armor = DEFAULT 0% Armor = REFLECTED 100% EndAdded new locomotor code for the "HeroHomingBeacon" object above.
Locomotor InvisiblePingLocomotor Surfaces = AIR TurnTime = 0 TurnTimeDamaged = 0 TurnThreshold = 5 TurnThresholdHS = 30 SlowTurnRadius = 0.0; From a standing starts, 30 foot radius. FastTurnRadius = 0.0; Once the catapult gets moving, still uses a 30 foot radius to turn. Acceleration = 2000 ; Instant accelerate to full speed. Braking = 2000 ; Instant brake from full speed. MinTurnSpeed = 0% ZAxisBehavior = NO_Z_MOTIVE_FORCE Appearance = HOVER StickToGround = Yes EndAdded new command button code. This command button was made only for the AI to use.
CommandButton Command_MaketheHomingCall_AI Command = SPECIAL_POWER SpecialPower = SpecialAbilityAIMaketheHomingCall TextLabel = CONTROLBAR:WoundingArrow DescriptLabel = CONTROLBAR:ToolTipWoundingArrow ButtonImage = HSFaramirWoundingArrow ButtonBorderType = ACTION InPalantir = Yes AutoAbility = Yes EndAdded the new command button above to every hero's command set, usually in a hidden slot, so that only the AI can use it. I'll use Faramir as an example.
CommandSet GondorFaramirCommandSet 1 = Command_ToggleStance 2 = Command_ToggleFaramirWeapon 3 = Command_SpecialAbilityWoundArrow 4 = Command_FaramirFakeLeadershipButton 5 = Command_SpecialAbilityCaptainOfGondor 6 = Command_ToggleFaramirMounted 7 = Command_MaketheHomingCall_AI ;added! 11 = Command_TransportEvacuateTheoden 12 = Command_CaptureBuilding 13 = Command_AttackMove 14 = Command_Stop 16 = Command_SetStanceBattle 17 = Command_SetStanceAggressive 18 = Command_SetStanceHoldGround EndAdded to every hero's INI file. I'll use Faramir as an example.
#include "..\..\..\..\includes\HeroAIInjuredBehavior.inc"Added new upgrade.
Upgrade Upgrade_FortressHasBeenEntered Type = OBJECT BuildTime = 0.0 BuildCost = 0 EndErmm... This piece of code is already present. "HeroHomingBeacon" has been added to the "ObjectToDestroyForRingEntry" line. "Upgrade_FortressHasBeenEntered" has been added to the "UpgradeForRingEntry" line and "Upgrade_FortressRingHero" has been removed.
Behavior = CitadelSlaughterHordeContain ModuleTag_SlaughterMe PassengerFilter = RJ_GENERIC_FACTION_SLAUGHTERABLE ObjectStatusOfContained = UNSELECTABLE ENCLOSED CashBackPercent = 200 ContainMax = 99; give it a huge capacity, just in case player sends his whole army in at once AllowEnemiesInside = No AllowAlliesInside = No AllowNeutralInside = No AllowOwnPlayerInsideOverride = Yes EnterSound = MordorSlaughterhouseEnterSound EntryOffset = X:125.0 Y:0.0 Z:0.0 EntryPosition = X:30.0 Y:0.0 Z:0.0 // entry position needs to be offset from the root transform, otherwise fortress obscures point. ExitOffset = X:125.0 Y:0.0 Z:0.0 StatusForRingEntry = HOLDING_THE_RING UpgradeForRingEntry = Upgrade_FortressHasBeenEntered Upgrade_RingHero;Upgrade_FortressRingHero;removed ObjectToDestroyForRingEntry = NONE +TheDroppedRing +HeroHomingBeacon ;added! FXForRingEntry = FX_OneRingFlare EndAdded this piece of code.
Behavior = ObjectCreationUpgrade RemoveEnteredStatus TriggeredBy = Upgrade_FortressHasBeenEntered ConflictsWith = Upgrade_FortressRingHero Delay = 50.0 ThingToSpawn = FortressEntryConditionTimer FadeInTime = 100 EndAdded new object "FortressEntryConditionTimer" below the "HeroHomingBeacon" object.
Object FortressEntryConditionTimer EvaEnemyObjectSightedEvent = None ; Not a real unit ; Draw = W3DScriptedModelDraw SpecialAnimStateFX ; DefaultModelConditionState ; Model = Icon ; End ; End ; ***DESIGN parameters *** EditorSorting = SYSTEM KindOf = NO_COLLIDE CREEP IGNORE_FOR_VICTORY IGNORE_FOR_EVA_SPEECH_POSITION;INERT ThreatLevel = 0.0 VisionRange = 0 ShroudClearingRange = 0 ; *** ENGINEERING Parameters *** Body = HighlanderBody ModuleTag_Body;Can take damage, but won't die. Can only die from ::kill() or other unresistable damage MaxHealth = 1.0 End Behavior = DestroyDie ModuleTag_Die End Behavior = LifetimeUpdate ModuleTag_HatchTrigger MinLifetime = 1000.0 MaxLifetime = 1000.0 End // Fortress no longer has the 'has been entered' Flag. Behavior = RemoveUpgradeUpgrade ModuleTag_RemoveEnteredStatus TriggeredBy = Upgrade_AllFactionUpgrade UpgradeToRemove = Upgrade_RingHero Upgrade_FortressHasBeenEntered RemoveFromAllPlayerObjects = Yes SuppressEvaEventForRemoval = Yes; Hack -- this is to avoid the Eva event about 'Gollum stole our ring' //when we are actually losing the upgrade because we built the ring hero End Behavior = AIUpdateInterface ModuleTag_AIUpdateInterface AutoAcquireEnemiesWhenIdle = No // MoodAttackCheckRate = 500 End LocomotorSet Locomotor = InvisiblePingLocomotor Condition = SET_NORMAL Speed = 1000 End Behavior = SlavedUpdate ModuleTag_Slave UseSlaverAsControlForEvaObjectSightedEvents = Yes DieOnMastersDeath = Yes //Die when my master dies! End EndAdded these codes to the "TheDroppedRing" object.
Behavior = AttributeModifierAuraUpdate ModuleTag_RegisteratFortress1 StartsActive = Yes BonusName = PrepareFortressForRing RefreshDelay = 500 Range = 100 TargetEnemy = Yes ObjectFilter = ANY +COMMANDCENTER End Behavior = AttributeModifierAuraUpdate ModuleTag_RegisteratFortress2 StartsActive = Yes BonusName = PrepareFortressForRing RefreshDelay = 500 Range = 100 ; TargetEnemy = Yes ObjectFilter = ANY +COMMANDCENTER EndAdded new attribute modifier code for the codes above.
ModifierList PrepareFortressForRing Category = WEAPON Duration = 3000 Upgrade = Upgrade_FortressRingHero Delay:1 EndThis upgrade code is already present. 3 EvaEvent things below have been removed from the Upgrade_RingHero upgrade.
Upgrade Upgrade_RingHero DisplayName = CONTROLBAR:RingHero Type = PLAYER ; Announce it when people get the ring, and when they lose it... ;LocalPlayerGainsUpgradeEvaEvent = LocalPlayerGainsRing ;removed ;AlliedPlayerGainsUpgradeEvaEvent = AlliedPlayerGainsRing ;removed ;EnemyPlayerGainsUpgradeEvaEvent = EnemyPlayerGainsRing ;removed ; LocalPlayerLosesUpgradeEvaEvent = LocalPlayerLosesRing ; Ring mechanics have changed and this no longer makes sense - iby AlliedPlayerLosesUpgradeEvaEvent = None ; For now EnemyPlayerLosesUpgradeEvaEvent = None ; For now EndAdded new FX for when the "TheDroppedRing" is held and not a "HeroHomingBeacon." There would be an announcement everytime the AI made a hero retreat back to the fortress.
FXList FX_AnnounceFortressAcquiredRing EvaEvent EvaEventOwner = LocalPlayerGainsRing EvaEventAlly = AlliedPlayerGainsRing EvaEventEnemy = EnemyPlayerGainsRing RequiredSourceModelConditions = ONE_RING End EndI relied on SEE's codes heavily for this, with a few changes here and there, and it seems to work just fine. When an AI-controlled hero's health is low, they will activate the hidden command button. An invisible object will then spawn over them and they will grab and take it back to the fortress, like the One Ring. Except they don't get the One Ring. This is really meant to make the AI-controlled hero retreat from battle and have some time to heal. Makes them seem a little smarter.
Posted 17 February 2010 - 07:27 AM
0 members, 0 guests, 0 anonymous users