- This guide assumes you are using Firegraft and PyMS (Python Modding Suite), know how to use these tools, and that you are directly modifying the existing Ion Cannon unit.

- Items beginning with a hashtag (#) stand for files which have a filename and/or entry ID intended to be user-selected. Substitute them with your chosen filenames/entries.


###############################################################################################################################

FIREGRAFT:
- Necessary first step.
	* Units:
		* [127] Ion Cannon:
			Button Set » Attacking Buildings
	----------------------------------------------------------------
- Optional to allow SCV to build Ion Cannon.
	* Button Sets:
		* [71] Basic Terran Buildings OR [72] Advanced Terran Buildings:
			* Visual Properties:
				Icon » 127 (Ion Cannon)

			* Strings:
				Choose suitable strings and modify them in PyTBL.

			* Settings:
				Condition » Can Create Unit\Building
				Condition Variable » 127 (Ion Cannon)
				Action » Create Building - Terran
				Action Variable » 127 (Ion Cannon)
	----------------------------------------------------------------
	* Dat Requirements:
		* Units:
			* [127] Ion Cannon:
				Current unit is...
				SCV
				==End of List==
	----------------------------------------------------------------
- Required to allow Ion Cannon to receive attack orders.
	* Dat Requirements:
		* Orders:
			* [18] Tower Guard AND [19] Tower Attack:
				[...]
				Or
				Current unit is...
				Ion Cannon
				==End of List==


###############################################################################################################################

PyDAT:
	* Units:
		* 127 Ion Cannon:
			* Basic:
				Weapons: #ioncannon_weapon
				Adjust other basic properties to your own liking.

			* Advanced:
				Building
				Animated Overlay
				Use Large Overlays
				Full Auto-Attack
				Mechanical

			* Graphics:
				Graphics » 99
				Construction » 325
				Elevation » 4
				Direction » 0

			* AI Actions:
				Computer Idle » 18
				Human Idle » 18
				Return to Idle » 18
				Attack Unit » 19
				Attack Move » 23
				Right Click Action » No movement/Normal Attack

	- Save as units.dat file.

	----------------------------------------------------------------
	* Weapons:
		* #ioncannon_weapon:
			* Weapon Display:
				Graphic: #ioncannon_projectile
				Icon: #ion_cmdbtns_weapon.bmp
				X Offset: 192
				Y Offset: 48
				Attack Angle: 16

			* Adjust other properties to your own liking.

	- Save as weapons.dat file.

	----------------------------------------------------------------
	* Flingy:
		* 99 Ion Cannon:
			Sprite » 257
			Top Speed » 0
			Acceleration » 0
			Halt Distance » 0
			Turn Radius » 3
			Move Control » Iscript.bin Control
			IScript Mask » 127

		--------
		* #ioncannon_projectile:
			Sprite » ?
			Top Speed » 0
			Acceleration » 0
			Halt Distance » 0
			Turn Radius » 3
			Move Control » Iscript.bin Control
			IScript Mask » 127

	- Save as flingy.dat file.

	----------------------------------------------------------------
	* Sprites:
		* 257 Ion Cannon:
			Image » 292
			Is Visible » YES
			Include in Vision » YES
			Sel. Circle » 7
			Health Bar » 108
			Vert. Position » 15

		--------
		* #ioncannon_attack_B:
			Image » #ioncannon_attack_B
			Is Visible » YES
			Include in Vision » NO
			Sel. Circle » 0
			Health Bar » 0
			Vert. Position » 0

		--------
		* #ioncannon_projectile:
			Image » #ioncannon_projectile
			Is Visible » YES
			Include in Vision » NO
			Sel. Circle » 0
			Health Bar » 0
			Vert. Position » 0

	- Save as sprites.dat file.

	----------------------------------------------------------------
	* Images:
		* 292 Ion Cannon:
			* Image:
				GRP » 312
				Iscript ID » 116

			* General Properties:
				Graphics Turns » YES
				Clickable » NO
				Draw if Cloaked » YES
				Use Full Iscript » YES

			* Drawing Properties:
				Function » 0 (Normal Draw)
				Remapping » 0 (No remapping)

			* Extra Overlay Placements:
				Attack » #ion_overlay.lol
				Special » #ion_overlay.lol

		--------
		* #ioncannon_underlay:
			* Image:
				GRP » #ion_underlay.grp
				Iscript ID » #ioncannon_underlay

			* General Properties:
				Graphics Turns » NO
				Clickable » YES
				Draw if Cloaked » YES
				Use Full Iscript » NO

			* Drawing Properties:
				Function » 0 (Normal Draw)
				Remapping » 0 (No remapping)

		--------
		* #ioncannon_shad:
			* Image:
				GRP » #ion_shad.grp
				Iscript ID » #ioncannon_underlay

			* General Properties:
				Graphics Turns » NO
				Clickable » NO
				Draw if Cloaked » NO
				Use Full Iscript » NO

			* Drawing Properties:
				Function » 10 (RLE_SHADOW)
				Remapping » 0 (No remapping)

		--------
		* #ioncannon_turret:
			* Image:
				GRP » #ion_turret.grp
				Iscript ID » #ioncannon_turret

			* General Properties:
				Graphics Turns » YES
				Clickable » NO
				Draw if Cloaked » YES
				Use Full Iscript » NO

			* Drawing Properties:
				Function » 0 (Normal Draw)
				Remapping » 0 (No remapping)

		--------
		* #ioncannon_overlay:
			* Image:
				GRP » #ion_overlay.grp

			* Iscript ID and all other properties are the same as #ioncannon_turret

		--------
		* #ioncannon_attack_A:
			* Image:
				GRP » #ion_attack.grp
				Iscript ID » #ioncannon_attack_A

			* General Properties:
				Graphics Turns » YES
				Clickable » NO
				Draw if Cloaked » YES
				Use Full Iscript » YES

			* Drawing Properties:
				Function » 9 (Use Remapping)
				Remapping » 4 (bexpl.pcx)

		--------
		* #ioncannon_attack_B:
			* Image:
				Iscript ID » #ioncannon_attack_B

			* General Properties:
				Use Full Iscript » NO

			* GRP File and all other properties are the same as #ioncannon_attack_A

		--------
		* #ioncannon_projectile:
			* Image:
				GRP » #ion_projectile.grp
				Iscript ID » #ioncannon_projectile

			* General Properties:
				Graphics Turns » YES
				Clickable » NO
				Draw if Cloaked » YES
				Use Full Iscript » YES

			* Drawing Properties:
				Function » 9 (Use Remapping)
				Remapping » 3 (bfire.pcx)

		--------
		* #ioncannon_hit:
			* Image:
				GRP » #ion_hit.grp
				Iscript ID » #ioncannon_hit

			* General Properties:
				Graphics Turns » NO
				Clickable » NO
				Draw if Cloaked » YES
				Use Full Iscript » NO

			* Drawing Properties:
				Function » 9 (Use Remapping)
				Remapping » 3 (bfire.pcx)

	- Save as images.dat file.

	----------------------------------------------------------------
	* Sfxdata:
		* #ion_charge:
			* Sound:
				Sound File » #ion_charge.wav

			* General Properties:
				Priority » 2
				Flags » 32
				Volume » 11

		* #ion_fire:
			* Sound:
				Sound File » #ion_fire.wav

			* General Properties:
				Priority » 2
				Flags » 0
				Volume » 11

		* #ion_hit:
			* Sound:
				Sound File » #ion_hit.wav

			* All other properties are the same as #ion_fire

	- Save as sfxdata.dat file.


###############################################################################################################################

PyICE:
	- Replace the appropriate scripts with those from !ion_scripts.txt, substitute the commented lines with the appropriate values, and save as iscript.bin file.


###############################################################################################################################

PyMPQ:
	- Add the grp, lo, dat, and iscript files to your mod exe and/or other MPQ with the correct file paths.


###############################################################################################################################

List of shortcomings:
	- The game updates imgol offset coordinates (from the overlay file) after the graphics are refreshed, which results in visual bugs with the turret's overlays when it rotates. This issue has been minimized as much as possible and only occur during the attack animation, but the overlay offsets are necessary to circumvent the 255x255 pixels graphic size limit.

	- Proper offsets for the projectile spawn point can't be implemented, since the "attack" overlay placement is already being used by the attack animation (sproluselo). The weapons.dat offsets are a passable subtitute, but the long X offset, combined with the angle the graphic was rendered in, means that the projectile spawn point won't exactly match visually.

	- Units south of the ion cannon will still appear on top of the gun. The gun could be its own separate graphic, but since image overlays inherit the parent graphic's elevation, the only option would be to make it a sprite with an iscript (that ends after 1 frame) and sproluselo the graphic on every frame (in order to refresh its facing direction). Aside from being awkward to implement, it would also be at the mercy of the sprite limit. Giving the actual ion cannon graphic a higher elevation would also be unsightly, but you can try it at your own discretion.

	- Ordering the ion cannon to attack or stop during the attack animation causes it to prematurely end the GndAttkToIdle animation, playing only the first frame of it. This is a result of nobrkcodestart and there doesn't seem to be any workaround besides simply omitting the opcodes, which would however allow the player to cancel the attack animation.