Written by: Ayden aka Shawn
-------------
Hello The3rdAge community.
I have had requests to make a guide that teachs you how to make a "Summon Allies" spell that heros can use once they reach a certian rank. Be prepared, this is a hard and complicated code and it took me many days to work flawlesly.
We will be editing the following .ini files in this tutorial:
Legolas.ini
Commandbutton.ini
Commandset.ini
Specialpower.ini
Objectcreationlist.ini
upgrade.ini
Experiencelevels.ini
1: (Legolas.ini)
First off, we are going to need to choose the Hero that you want the spell to be given too. I want everyone to be on the same page during this tutorial so I will pick a hero for you. Legolas.
We are going to give Legolas a ability to summon some elven allies to battle once he gets to rank 3. So lets open Legolas' .ini file in GoodFaction/Units/Rohan.
Scroll down until you find the abilitys he has already, such as the HawkEye behavior. Under that, we are going to add this paragraph of code:
Behavior = UnpauseSpecialPowerUpgrade ModuleTag_MirkwoodElvesEnabler
SpecialPowerTemplate = SuperweaponMirkwoodElves
TriggeredBy = Upgrade_LegolasMirkwoodElves
End
Behavior = OCLSpecialPower ModuleTag_OCLSpecialPower
SpecialPowerTemplate = SuperweaponMirkwoodElves
OCL = OCL_MirkwoodElves
CreateLocation = USE_OWNER_OBJECT
StartsPaused = yes
SetModelCondition = ModelConditionState:USER_1
SetModelConditionTime = 8.1
End
This code contains much information about the allies we will be summoning to our aid when the button on the hero's plantir is clicked.
2: (SpecialPower.ini)
This .ini has actions that the game uses when a spell is activated. We need to add our summon elves spell in here for the spell to work in the game. Copy and paste the following line in the bottom of the specialpower.ini file.
;------------------------------------------------------------------------------
SpecialPower SuperweaponMirkwoodElves
Enum = SPECIAL_SPAWN_ORCS
ReloadTime = 200000 ; in milliseconds
PublicTimer = No
InitiateAtLocationSound = SpellElvenSummon
RadiusCursorRadius = 100.0
End
There is something that you need to know that is VITAL to making any spell work in the game. A faction may only use a "Enum" ONCE! If you try to use the enum "SPECIAL_SPELL_BOOK_ELVEN_ALLIES" for this spell IT WILL NOT WORK. I spent days wondering why my spell was not working, and then I found out it was because I was using a enum that the good faction already uses.
3: (Upgrade.ini)
We don't want Legolas to start off with this ability, so we need to make him "Earn it" through rank levels. For that to work, we need to add a upgrade into this database so the game will know what it is. Add the following code to the bottom of the upgrade.ini file.
Upgrade Upgrade_LegolasMirkwoodElves
Type = OBJECT
End
3 1/2: (Break)
Ok, feel free to take a break now, and get something to drink, your looking thirsty.
4: (CommandButton.ini)
Now that we have the basis of our code layied out, we need to make the button it. If we don't have the button made, the spell will not show up in game and the hero will not be able to use it.
CommandButton Command_MirkwoodElves
Command = SPECIAL_POWER
SpecialPower = SuperweaponMirkwoodElves
TextLabel = CONTROLBAR:SummonElvenAllies
ButtonImage = SBGood_ElvenAllies
ButtonBorderType = ACTION ; Identifier for the User as to what kind of button this is
DescriptLabel = CONTROLBAR:TooltipSummonElvenAllies
InPalantir = Yes
End
The command button has all the information the game needs to make the button appear in the hero's plantir. You are allowed to change the buttonimage to whatever you like, but to avoid a headach I recomend you don't change anything in this tutorial until you have experienced the spell ingame.
5: (Experiencelevels.ini)
In this .ini we will be able to select what rank we want Legolas to be able to unleash this new power of the elves. Find Legolas' experience section, and under level3 look for the "Rank" string. Under that string, add this following code.
Upgrades = Upgrade_LegolasMirkwoodElves
6: (Objectcreationlist.ini)
Now we have this code almost finished but we still have to add the most important part. We have to tell the game what units we want made! open up the objectcreationlist.ini file and add this following code at the end of the file.
ObjectCreationList OCL_MirkwoodElves
CreateObject
ObjectNames = RohanElvenWarriorHorde_Summoned
Count = 1
SpreadFormation = Yes
MinDistanceAFormation = 0.0
MinDistanceBFormation = 0.0
MaxDistanceFormation = 5.0
FadeIn = Yes
FadeTime = 4000
IgnoreCommandPointLimit = Yes
End
End
You can change how many units you want to be created, or what unit you want to be created in this code. I set it to "Count = 1" so that only one horde of elvenwarriors are made, however feel free to change it to 2 or more.
7: (CommandSet.ini)
Now that we have all the information the game needs for the ability to work, lets give it to our hero. Add the following code to the commandset of the hero you added the behaviors into:
Command_MirkwoodElves
7: (Congradulations)
Congradulations! you have made a summon allies code for a hero instead of a spellbook. Give yourself a pat on the back and try out the new, awsome spell.
//Ayden
Edited by Ayden, 25 February 2005 - 02:47 AM.