Jump to content


Photo

Ganon's Coding Questions


  • Please log in to reply
67 replies to this topic

#41 modboy451

modboy451

    A small Big-time Modder!

  • Project Team
  • 783 posts
  • Location:U.S.A
  •  Experienced INI Coder, Advanced Rigger/Binder.

Posted 08 January 2011 - 01:54 AM

TO YOUR AI POST

A LONGER but efficient way is Lurtzy's Article

just add a
TriggeredBy	   =	Upgrade_HardAIMultiPlayer
to each module...EX: Isengard Forged blades

Behavior = GrantUpgradeCreate ModuleTag_Grantxxxxxxx			;xxxxxxx can be anything unique
TriggeredBy	   =	Upgrade_HardAIMultiPlayer
UpgradeToGrant = Upgrade_IsengardForgedBlades
End

should work

you would have to add it to every unit you want it to apply to

Edited by modboy451, 08 January 2011 - 02:03 AM.

John 3:16 (NIV)
For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.


Psalm 23:1 (ESV)
A Psalm of David.
The LORD is my shepherd; I shall not want.


Posted Image
Posted Image
Posted Image
Posted Image

#42 Gfire

Gfire

    Nuju

  • Project Team
  • 2,173 posts
  • Location:I have returned from the depths
  • Projects:Finding My Way
  •  The Perfectionist

Posted 08 January 2011 - 02:07 AM

I don't think you can use the GrantUpgradeCreate module for that. It's something else, like GrantUpgradeUpgrade. GrantUpgradeCreate only works for adding an upgrade on creation, you have to do something else for one upgrade to trigger another.
Greetings, community.

#43 Ganon

Ganon

    What's this?

  • Project Team
  • 967 posts
  • Location:Ohio, United States
  • Projects:My Link Mod
  •  Code Scientist

Posted 08 January 2011 - 02:14 AM

Yes, I know about Lurtzy's article.
Read the first few posts of this thread and you'll see that I've already done exactly the thing you're trying to explain to me. ;)
And Gfire is correct, you can't use GrantUpgradeCreate behaviors like that.

....

This time around I wanted to actually tackle the AI. And I have.
ALL Hard Army units buy ALL upgrades now. And I have Ridder Geel to thank for that, as he showed me which files I would need to tweak.


But, thanks anyway. :D

//////////////////////////////////////////////////////////////////////////////////////////////////


Oh, and nevermind about this, I found a better way.

I got another question.

Is there an AI script, that tells your team that a hero is nearby?

I'm trying to optimize hero abilities, and here is my current generic script for One-Shot abilities, like Wounding Arrow:

*** IF ***
	 Player '<This Player>''s Team '<This Team>' are ready to use Ability 'Command_GondorGandalfIstariLight' (at least one member).
*** THEN ***
   Team '<This Team>' use Ability 'Command_GondorGandalfIstariLight'  on nearest enemy with Kind is 'HERO'

I want my heroes to see that a hero is nearby and use their ability on them. Instead of wasting it on a random orc. ;)

The above script works fine, but one problem is that once the ability is ready, the hero goes running off to attack the nearest random enemy hero on the map that isn't neccessarily all that close. :) (i.e. Lurtz runs across the map to cripple strike some random hero)

...

Any suggestions?


Edited by Ganon, 18 September 2011 - 12:40 PM.


#44 modboy451

modboy451

    A small Big-time Modder!

  • Project Team
  • 783 posts
  • Location:U.S.A
  •  Experienced INI Coder, Advanced Rigger/Binder.

Posted 08 January 2011 - 02:51 AM

its good that you got it covered

just to clear my name...

you could use the do command upgrade and trigger the command

Command_PurchaseUpgradeIsengardHeavyArmor

See MY post HERE

I know you fixed it but just wanted to put it out there!

LET ME KNOW IF IT DOSENT WORK SO I CAN TAKE IT OFF IF IT DOSENT WORK!!!

John 3:16 (NIV)
For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.


Psalm 23:1 (ESV)
A Psalm of David.
The LORD is my shepherd; I shall not want.


Posted Image
Posted Image
Posted Image
Posted Image

#45 Ridder Geel

Ridder Geel

    Master Yelloh

  • T3A Staff
  • 10,852 posts
  • Location:The Netherlands (AKA: Holland)
  • Projects:RC Mod + SEE + RTS Engine
  •  The Dangerous T3A Team Chamber Member
  • Division:BFME
  • Job:T3A Staff

Posted 08 January 2011 - 10:10 AM

It works in BFME 2, I think it should work in BFME 1 too then, in theory that is if it does not crash the game. Lurtzy used it for his old "Beasts" faction in the RC Mod :D

Edited by Ridder Geel, 08 January 2011 - 10:11 AM.

Ridder Geel

#46 Gfire

Gfire

    Nuju

  • Project Team
  • 2,173 posts
  • Location:I have returned from the depths
  • Projects:Finding My Way
  •  The Perfectionist

Posted 08 January 2011 - 07:58 PM

Well, you can also use lua scripts to grant upgrades, that usually works if you can't find an appropriate module.
Greetings, community.

#47 Ridder Geel

Ridder Geel

    Master Yelloh

  • T3A Staff
  • 10,852 posts
  • Location:The Netherlands (AKA: Holland)
  • Projects:RC Mod + SEE + RTS Engine
  •  The Dangerous T3A Team Chamber Member
  • Division:BFME
  • Job:T3A Staff

Posted 08 January 2011 - 08:06 PM

Ah ok, so those work in BFME 1 too ;)
Didn't know that :D
(I dont really mod bfme 1)

Edited by Ridder Geel, 08 January 2011 - 08:06 PM.

Ridder Geel

#48 Ganon

Ganon

    What's this?

  • Project Team
  • 967 posts
  • Location:Ohio, United States
  • Projects:My Link Mod
  •  Code Scientist

Posted 29 January 2011 - 01:41 PM

Is there any way to change the AIUpdateInterface on a unit with an Upgrade, or model state condition?
If you're wondering what I mean, here's a couple examples:
Behavior = AIUpdateInterface ModuleTag_03
        AutoAcquireEnemiesWhenIdle = Yes ATTACK_BUILDINGS
        MoodAttackCheckRate        = 500    
    End
Behavior = GiantBirdAIUpdate ModuleTag_GiantBirdAI
       AutoAcquireEnemiesWhenIdle    =    Yes ATTACK_BUILDINGS
       MoodAttackCheckRate            =    500
       AILuaEventsList                =    FellBeastFunctions    
       FollowThroughDistance        =    200
       FollowThroughCheckStep        =    50
       FollowThroughGradient        =    1.0
       
       GrabTossTimeTrigger            =    2.5
       GrabTossHeightTrigger        =   100.0
       TossFX                = FX_DiebyFalling
       SpecialContactPoints        = Swoop
       
       AttackPriority = AttackPriority_FellBeast
    End

Edited by Ganon, 29 January 2011 - 01:43 PM.


#49 Lauri

Lauri

    Old man Lauri

  • Hosted
  • 10,436 posts
  • Location:Norway
  • Projects:The 4th Age
  •  The very worst T3A Team Chamber Member

Posted 29 January 2011 - 07:24 PM

Pretty sure there isn't, no :lol:

T4A_Logo_-_article.png

The 4th Age version 0.8 has been released: Link


#50 Nertea

Nertea

    ...lo sa raptor!

  • Hosted
  • 3,349 posts
  • Location:Vancouver, Canada
  • Projects:Star Villains and Space heroes, The Dwarf Holds
  •  T3A Chamber Member
  • Division:BFME/Unity

Posted 29 January 2011 - 08:40 PM

Ched did some extensive research and pretty much concluded no.

sig.png
I really don't do requests and my Arnor Soldier is not fit for BFME. Don't ask me for either.


#51 Ganon

Ganon

    What's this?

  • Project Team
  • 967 posts
  • Location:Ohio, United States
  • Projects:My Link Mod
  •  Code Scientist

Posted 16 September 2011 - 03:39 PM

I've been trying to figure out how to change the texture for a Tainted Land type of power, but I can't find where in the code, I would do that.

I found what I think is the tainted land's texture in the Art folder, then I used Notepad++'s search feature to search the entire Data folder for the name of the texture, and it came up with nothing.

This is in gamedata.ini though:
TaintOn = Yes
  TaintColor = R:120 G:90 B:80
  TaintAlpha = 0


Edit: I went snooping around in the game.dat, and now I know without a doubt, that it's hard-coded to use a particular texture.

...

So does anyone know of a viable work-around to get a different texture on the ground?

Edited by Ganon, 22 September 2011 - 05:15 AM.


#52 Elric

Elric

    Designer

  • Hosted
  • 2,857 posts
  • Projects:Middle-Earth Expanded
  •  Coder
  • Donated

Posted 20 September 2011 - 12:21 AM

You can do ground textures through FX coding.

#53 Ganon

Ganon

    What's this?

  • Project Team
  • 967 posts
  • Location:Ohio, United States
  • Projects:My Link Mod
  •  Code Scientist

Posted 20 September 2011 - 01:17 AM

That's what I have, currently. My biggest problem with that, is that FX Decals are still considered FX, so it disappears as soon as you lose line-of-sight in the area. Then when I bring units back into the area, it appears again in my current setup. And that's really not ideal.

Edited by Ganon, 22 September 2011 - 04:16 AM.


#54 Elric

Elric

    Designer

  • Hosted
  • 2,857 posts
  • Projects:Middle-Earth Expanded
  •  Coder
  • Donated

Posted 20 September 2011 - 01:41 AM

hmm. Get on MSN!

#55 Ganon

Ganon

    What's this?

  • Project Team
  • 967 posts
  • Location:Ohio, United States
  • Projects:My Link Mod
  •  Code Scientist

Posted 20 September 2011 - 10:31 AM

Nevermind, I got it fixed.

#56 DeeZire

DeeZire
  • Members
  • 140 posts

Posted 21 September 2011 - 10:09 PM

You're correct, the game is hardcoded to use TSTaintMed.tga for the TaintSpecialPower (Elven Wood is also hardwired to TSEvenMed.tga for ElvenWoodSpecialPower). The lines you refer to in GameData.INI control whether or not those areas appear on the radar (mini-map) and if so specify their colors. If you got it fixed - and your power works correctly by superimposing other such powers - would you care to share your fix?

#57 Ganon

Ganon

    What's this?

  • Project Team
  • 967 posts
  • Location:Ohio, United States
  • Projects:My Link Mod
  •  Code Scientist

Posted 22 September 2011 - 04:15 AM

Well, vanilla taint and elven wood, when fired, cast an invisible object.

If you look in Data\ini\object\evilfaction\evilfactionbuildings.ini. Search for an object named "TaintLand"
That's where all the attribute modifier auras are, for the power.

I created my own object for my power. Then i gave it a spawn behavior, much like a creep lair.
The spawned object has this code: (I had to tweak the lifetime and destruction delay to match my FX.)
Object FrozenWastelandLandEgg    Draw = W3DScriptedModelDraw ModuleTag_Draw        DefaultModelConditionState            Model = None        End    End    KindOf = INERT IMMOBILE UNATTACKABLE NO_COLLIDE        Body = ActiveBody ModuleTag_MakesKillWork        MaxHealth = 1    End    Behavior = LifetimeUpdate ModuleTag_HatchTrigger        MinLifetime = 3000        MaxLifetime = 3000    End	Behavior = SlowDeathBehavior ModuleTag_HatchProcess		DestructionDelay = 1000		FX = INITIAL FX_FrzWastelandGround	EndEnd

The death FX is what lays down a Decal. You don't want the decal to have too long of a lifetime, in case someone casts Elven Wood and replaces your power.

Also if you look closely, at the elven wood and taint textures, ingame, placed by the power. They have a hexagonal shape and actually snap to an unseen grid. So if you use an FX decal it's rarely, perfectly in the center of the tainted land texture. I was able to tweak my offset just a little bit to make it better, but in the end I had to make my decal a little bit bigger than the actual Taint texture.

In the FXList for the decal, you just need this little line of code:
PlayEvenIfShrouded = Yes

You don't want to make the Taint texture underneath your Decal smaller, because then if you use the power to replace another similar power. It doesn't replace the entire texture of the other power, it turns it into a "doughnut" shape.

Now, the only bug left is kinda minor. My power is based on Taint right? Well if you place the power somewhere, and an ally places the actual taint power in the same spot later, your taint "Object" doesn't disappear because it's a similar power....SO, your object keeps firing the FX Decal, and it looks like your power is still in effect, but if you place units there, they would only get the Taint bonus. It's a minor bug, IMO, and I don't think I'm going to be able to fix it. I'm actually pretty happy with what I have so far, so I'm satisfied. :p

Here's the finalized power: Clicky (The first picture, in the first post.)

Edited by Ganon, 22 September 2011 - 08:06 AM.


#58 Ganon

Ganon

    What's this?

  • Project Team
  • 967 posts
  • Location:Ohio, United States
  • Projects:My Link Mod
  •  Code Scientist

Posted 22 September 2011 - 06:35 AM

So I was doing a little maintenance coding today, and I found something really interesting.

Behavior = UpgradeDie  UpgradeDieModuleTag
		;This frees the object based upgrade for the producer object.
		DeathTypes = ALL
		UpgradeToRemove     = Upgrade_TestBuilding BaseUpgradeTag_01
	End


I've never seen this behavior before, and I was wondering if anyone knows what it does, or how it works?
I have a hunch, and if I'm right, this could be put to good use.

#59 DeeZire

DeeZire
  • Members
  • 140 posts

Posted 22 September 2011 - 05:02 PM

Nice spot, I did it differently and cloned the entire taint power and added the decal to the FX so it displays over the hardcoded taint texture but has the same lifetime, you can still see the taint texture slightly but its no biggie.

The UpgradeDie module does what the comment says - when the object with this module is destroyed, it removes the upgrade specified (with it's module tag name) from the object that granted the upgrade in the first place, so the producer object can build the upgrade again (object upgrades are usually a one-time deal). In this example, the MordorBase object grants a BaseUpgrade (Behavior = BaseUpgrade BaseUpgradeTag_01) which is triggered by Upgrade_TestBuilding. The upgrade adds a MordorTent object to the base, which has the code you quoted, so when the tent dies the Upgrade_TestBuilding is removed from the MordorBase object thus allowing it to purchase it again. If you use the code properly, you can use it to fix the bug where players still get the benefits of the Grand Harvest upgrade even after the Marketplace has been destroyed ;)

Edited by DeeZire, 22 September 2011 - 05:03 PM.


#60 Ganon

Ganon

    What's this?

  • Project Team
  • 967 posts
  • Location:Ohio, United States
  • Projects:My Link Mod
  •  Code Scientist

Posted 22 September 2011 - 05:17 PM

Nice spot, I did it differently and cloned the entire taint power and added the decal to the FX so it displays over the hardcoded taint texture but has the same lifetime, you can still see the taint texture slightly but its no biggie.


That's what I did. I cloned the entire power, but I needed a different texture so I used an FX Decal, same as you. :p

The only reason I have a dummy object spawn and die constantly is so I can get the texture to disappear very shortly after it's replaced by another similar power. I can't just put a short timer on it because sometimes those powers may stay on the ground, un-disturbed, for the full length of the game.

Edited by Ganon, 22 September 2011 - 05:24 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users