Jump to content


Photo

[BFME1] Special Powers


  • Please log in to reply
18 replies to this topic

#1 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 11 September 2006 - 01:49 PM

Welcome to my tutorial about the logic of SpecialPower-Behaviors (not anims or weapons that are used)...

This tutorial is for those slightly advanced coders who want to know how the basic tags of a specialpower are set up.
So you should know the very basics about inis and how they work.

Note: This tutorial is for BFME1, but I think it applies also to BFME2.
Besides, this is a theoretical tutorial, so no files are required (although it may help to see how they are used in the game)
And yes, there are always exceptions to the rules, I am just explaining the way that is used the most...

So let's get started:

The basic layout of any special power consists of three parts. Though you mostly don't need all three,
it's just the maximum you'll need.


The first part
is the "UnpauseSpecialPowerUpgrade"-behavior. It could look like that:

Behavior = UnpauseSpecialPowerUpgrade ModuleTag_AragornOathbreakersEnabler
		SpecialPowerTemplate = SuperweaponSpawnOathbreakers
		TriggeredBy = Upgrade_AragornOathbreakers
End
As you can see from the title, this behavior is required to "unpause", to activate the specialpower,
so that you can use it afterwards (click the button and launch it).

- The first tag defines the specialpower which is also used by the two following modules. This points to specialpower.ini,
where you should have your power defined.
- The second tag tells the game which upgrade is needed to unpause the ability. Normally this upgrade is given
in epxeriencelevels.ini.

This behavior is unique, so there are no variations with similar or the same functions.

Note: This module is only required if you have "StartsPaused = Yes" in the next module (SpecialPowerModule).


The second part is the "SpecialPowerModule". Examples:

Behavior = SpecialPowerModule ModuleTag_FireballStarter					  
	SpecialPowerTemplate		= SpecialAbilitySarumanFireball
	UpdateModuleStartsAttack	= Yes
	StartsPaused			= Yes
	InitiateSound			= SarumanVoiceAttackFireball
End
Or:

Behavior = SpecialPowerModule ModuleTag_ShieldMaidenUpdate   
	SpecialPowerTemplate	  = SpecialAbilityEowynShieldMaiden
	UpdateModuleStartsAttack  = No
	StartsPaused = Yes
	AttributeModifier = EowynShieldMaidenBonus
	AttributeModifierRange = 1
	AttributeModifierAffectsSelf = Yes
	AttributeModifierAffects = ANY +CAVALRY +INFANTRY
	AttributeModifierFX = FX_EowynShieldMaiden
End
This module is required for any specialpower to work. If you lack this module, the power will not work.
Though you may encounter powers where a vatiation of this module is used, more on that topic below.

As you can see, I've listed two examples. The above one is the shape where you have the third behavior, a SpecialAbilityUpdate,
the second is the shape a SpecialPowerModule could have when it does not have a following update-behavior.

- The first tag is again, the reference to specialpower.ini.
- The second, "UpdateModuleStartsAttack", tells the game if it should look for another behavior (the update)
with the same specialpower.ini-reference. Depending on what you have use "Yes" or "No" (pretty simple).
- The third tag here, "StartsPaused", is the one I was referring to above, if you have "Yes" you might want to
unpause it in order to make the power available.

All the following tags are custom. Many of them affect the AttributeModifiers, but you can also set ModelConditions,
trigger FX events or play sounds. Have a look at the different powers for examples.


The third part is the so-called "SpecialAbilityUpdate".

An example:

Behavior = SpecialAbilityUpdate ModuleTag_GloriousChargeAnimation
	SpecialPowerTemplate	= SpecialAbilityTheodenGloriousCharge
	
	UnpackTime			  = 1000
 	PreparationTime		 = 0  
 	PersistentPrepTime	  = 0
 	PackTime				= 1330
	
	UnpackingVariation		= 1
End
In general, this module will set specific animations for your power.
But if you look through some inis, you'll notice that this plain version isn't used very often.
Most of the time, certain variations are used, but I'll explain some of them further below.

Now to the different tags (I've reorganised the code a bit):

- The first one is, as usual, the specialpower.ini reference
- the following four control the animations. They can link to a special animation flag:

UnpackTime --> UNPACKING (e.g. "UNPACKING PACKING_TYPE_1")
PreparationTime --> PREPARING (e.g. "PREPARING PACKING_TYPE_1")
PersistentPrepTime --> empty (e.g. "PACKING_TYPE_1")
PackTime --> PACKING (e.g. "PACKING PACKING_TYPE_1")

The amount of time for the different tags is very different, always depending on the type of the power.
Also there aren't always all animations referenced.

The last tag is a special animation marker. If you have more than one special power with SpecialAbilityUpdate,
you need to tell the game which animation belongs to which power. One example to handle this is the "UnpackingVariation",
a tag which will lead to the Anim flag "PACKING_TYPE_x" (x being the number you specify).
Other possibilites for this are "WhichSpecialPower" (which leads to SPECIAL_POWER_x) and "WhichSpecialWeapon"
(which leads to SPECIAL_WEAPON_y, y being ONE, TWO or THREE). Please notice that you only have
3 different possibilities each. Besides, using all of them may lead to certain problems... [lua/xml scripts].

Now as I told you, this plain version isn't used often, the common variations are:

WeaponFireSpecialAbilityUpdate - used for almost any special weapon
ModelConditionSpecialAbilityUpdate - used for special animation-based abilites (Boromir's Horn, Frodo's Phial)
ToggleMountedSpecialAbilityUpdate - used for mounting
HeroModeSpecialAbilityUpdate - used for a hero mode ability, like Aragorn's Blademaster

Check out some of them yourself to see what additional tags they offer...

I hope that this tutorial helps someone on his way towards advanced coding. If you have any questions or tips, just post and I'll edit this tutorial.

Well that's it, have a nice day.

Edited by Dark Lord of the Sith, 11 September 2006 - 01:55 PM.

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#2 Aron

Aron
  • Members
  • 48 posts
  • Location:Hong Kong
  • Projects:The Rise of the Good, King of the West
  •  a Good INI coder,a skinner

Posted 11 September 2006 - 02:56 PM

Good job man! :thumbsup:
(although l know how to make a new power.... :) )
it can easy to know how to make a power :p
good work :thumbsup:

Edited by Aron, 11 September 2006 - 03:54 PM.


#3 Hard_Sander

Hard_Sander
  • Members
  • 244 posts

Posted 11 September 2006 - 04:07 PM

Now I have the feeling that I know what I'm copying and pasting! :p

Nice tutorial! :)

#4 Bart

Bart

  • Network Admins
  • 8,524 posts
  • Location:The Netherlands
  • Division:Revora
  • Job:Network Leader

Posted 11 September 2006 - 06:48 PM

good stuff. about time someone wrote this :)
bartvh | Join me, make your signature small!
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."

#5 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 11 September 2006 - 06:51 PM

Nice tutorial. I had picked up a lot of this on the way, but your explanations certainly make it clearer :)
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#6 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 11 September 2006 - 07:01 PM

Thanks guys... any tips how to improve it? Any wishes?

If not, then I'll eventually start with my XML/Lua script tutorial...

Edited by Dark Lord of the Sith, 11 September 2006 - 07:06 PM.

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#7 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 11 September 2006 - 07:05 PM

Maybe cover the use of enums and radius cursors a bit? I don't really understand them too much
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#8 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 11 September 2006 - 07:09 PM

Good idea. What exactly do you want to know about radius cursors? I don't know what I could tell you there...

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#9 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 11 September 2006 - 07:12 PM

Well I've seen some mods add new radius cursors for powers, and I'd like to know how to do that :)
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#10 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 11 September 2006 - 07:17 PM

Actually there already is a tutorial about that in this section... and I even added all the possibilities...

EDIT: Spell Cursors

Edited by Dark Lord of the Sith, 11 September 2006 - 07:19 PM.

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#11 zimoo

zimoo

    Ecthelion of the Fountain

  • Project Team
  • 2,009 posts
  • Location:Devon, England
  • Projects:Lurking until the off topic begins...
  •  Guardian of the Books

Posted 11 September 2006 - 07:30 PM

*Bangs head against the wall*

That's been there over a year, how did I not see it? :)

Anyway, thanks for the link DLotS :p
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image
Posted Image

Playing games? Ah, you'll never be a good modder if you get involved in actually playing them!


#12 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 11 September 2006 - 07:44 PM

No problem... I'm always there to help a fellow coder :)

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#13 Fingulfin

Fingulfin

    I Like Pi3. Do you?

  • Hosted
  • 1,752 posts
  • Location:California, USA
  • Projects:Staying Alive.
  •  This place looks familiar. I can't remember why.

Posted 11 September 2006 - 10:12 PM

I would LOVE an in depth Tutorial on ENUMS. I understand all I need to about them, and know which ones to use to make my special powers work, but still I do not have a real, true understanding of them. One thing that truly puzzles me is why you can only use a certain Enum once per faction, and yet you can use some as many times as you want :) It still puzzles me to this day... On the other hand, Nice tutorial! Should help coders better their understanding of specialpower modules. Good work!
Posted Image
--------------------------------------
"You look like a ghost of your former self..."

#14 IthronAiwendil

IthronAiwendil

    Retired modder

  • Hosted
  • 1,452 posts
  • Location:Finland
  • Projects:None
  •  Coder, skinner, modeler, art guy

Posted 12 September 2006 - 12:09 PM

Well I've seen some mods add new radius cursors for powers, and I'd like to know how to do that :p

I have managed to put new radius cursors into the game (but for BfME II) and I don't fin dit that hard...

#15 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 12 September 2006 - 02:58 PM

Uhm, dude, zimoo is a very experienced coder... do you really think he would find it hard if he had read the tutorial? No, I'm sure he wouldn't. But he didn't read it, so it's just normal that he asked.

Edited by Dark Lord of the Sith, 12 September 2006 - 03:05 PM.

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#16 IthronAiwendil

IthronAiwendil

    Retired modder

  • Hosted
  • 1,452 posts
  • Location:Finland
  • Projects:None
  •  Coder, skinner, modeler, art guy

Posted 12 September 2006 - 03:00 PM

Uhm, dude you're messing with a very experienced coder here.. do you really think he would find it hard if he had read the tutorial? No, I'm sure he wouldn't. But actually it is hard if noone gives you the slightest hint...

Yeah I know he's a really good coder... I just overlooked the post where he said he had figured it out.

#17 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 12 September 2006 - 03:05 PM

No problem... just sounded kinda... meh forget it :p

I edited the above post... sounds a bit less annoyed (which wasn't my intention)

Edited by Dark Lord of the Sith, 12 September 2006 - 03:06 PM.

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.


#18 Bart

Bart

  • Network Admins
  • 8,524 posts
  • Location:The Netherlands
  • Division:Revora
  • Job:Network Leader

Posted 13 September 2006 - 05:57 PM

what has xml/lua to do with bfme (2) ? i mean, we can only hopy that they switch to xml in cnc3, but as far as i know bfme has nothing to do with it
bartvh | Join me, make your signature small!
Einstein: "We can’t solve problems by using the same kind of thinking we used when we created them."

#19 Phil

Phil

    Force Majeure

  • Network Leaders
  • 7,976 posts
  • Location:Switzerland
  • Projects:Revora, C&C:Online
  •  Thought Police
  • Division:Revora
  • Job:Network Leader
  • Donated
  • Association

Posted 13 September 2006 - 06:08 PM

Some few things are done via those scripts though... PM me if you want to know more.

Edited by Dark Lord of the Sith, 13 September 2006 - 06:09 PM.

revorapresident.jpg
My Political Compass

Sieben Elefanten hatte Herr Dschin
Und da war dann noch der achte.
Sieben waren wild und der achte war zahm
Und der achte war's, der sie bewachte.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users