This method of adding spells has limitations:
1. Only spells that use weapons can be added.
2. It can be given only to unit that does NOT use spell casting animation.
Spells that do not use spell casting animations are:
a) Recall
b) Hallucination
c) Feedback
d) Defense Matrix
e) Mind Control
f) All special abilities like cloak, burrow, stimpack etc.
You can give any of this spells to your unit.
3. Shares energy cost & target restriction with base spell.
For example, if you want to give the Grenade Launcher spell to Terran Marine.
1st. You must choose a 'base spell'. I used Optical Flare. | ||||
This spell must be 'already researched'. If it is a spell of another race, it also must be available for all races. Optical Flare is a Terran spell, so you need only enable 'already researched' flag in Arsenal III or II. Your Grenade Launcher will use same energy cost, range and target restrictions (units only for Optical Flare) as the base spell - Optical Flare. | ||||
2nd. You must add spell casting animation for Terran Marine by iscript.bin editing. Use ICE or do it by hex-editing. | ||||
3rd. Create the weapon that your spell will use. Use Arsenal III or II for this. | ||||
4th. Now replace the 0x27 opcode in the spell casting animation by 0x28 or 0x25 opcode. | ||||
If your spell weapon has the 'Appears on target' behavior, then you can use the 0x28 %1 opcode (%1 is pointer to weapon in weapons.dat, 2 bytes). If not, use the 0x25 %1 opcode (if %1 = 1 uses ground weapon, if >1 uses air). | ||||
If you use the 0x25 opcode then you must give your spell weapon to your unit as air or ground weapon. I gave the Grenade Launcher to Marine as an air weapon. Here we have another limitation of this method: a spell with the usage of 0x25 opcode can be only given to units with both air & ground weapons. This weapons must be same. Attack animation of the unit must use ground weapon against ground AND air targets, and this weapon must be able to attack both air and ground. So you can use air weapon for spell. If you use 0x28 opcode then you have no such limitation, but you must use the 'appears on target' behavior for your spell weapon. | ||||
5th. You must use 2 of unused spell entries: one for Optical Flare (so it will be researchable instead of already researched) and one for Grenade Launcher. | ||||
For example, use entry 36 for Optical Flare and 37 for Grenade Launcher. | ||||
In this entries you set research time, cost etc. | ||||
Energy cost for both spells you set in old Optical Flare entry (30). | ||||
6th. In StarGraft, modify tech section, change the requirements for Optical Flare: | ||||
add Terran Marine and REMOVE 'must have technology' flag. | ||||
7th. Create requirements for entries 36 and 37 | ||||
(first two unused entries after Healing). | ||||
These requirements MUST have the 'must have technology' flag. | ||||
8th. Modify the Optical Flare button for Medic: | ||||
Req Var: 36 (New Optical Flare entry) | ||||
Act Var: 30 (Old Optical Flare entry) | ||||
9th. Add the Grenade Launcher button for the Terran Marine: | ||||
Req Var: 37 (Grenade Launcher entry) | ||||
Act Var: 30 (Old Optical Flare entry) | ||||
10th. Modify Optical Flare Research button at the Academy. | ||||
It must be research tech #36 instead of #30. | ||||
11th. Add the Grenade Launcher research button at Academy | ||||
(research tech #37). |