Attacking/Spellcasting Buildings

Post Reply
User avatar
JanuszPawulon
Terran Supply Depot Clerk
Terran Supply Depot Clerk
Posts: 17
Joined: Sat Aug 23, 2014 11:57 am

Attacking/Spellcasting Buildings

Post by JanuszPawulon »

I came up with a method for adding new simple spells for units which doesn't have any other spells. Example: I gave dragoon a button for ensnare, but changed its icon and label to let's say NewSkill. Then added a spellcasting animation for dragoon, but instead of using the castspell opcode I used:
useweapon 108
wait 20
useweapon 84
The result was that dragoon got a spell that maelstormed enemy units and psi stormed them after a while. The cons of this are that it doesn't create a bullet, it doesn't show the energy cost when you point on the spell icon an if you want to change its energy cost you have to change ensnare's energy cost.
It was ok until I tried to force a building to cast ANY spell. All I was able to do was to make a photon cannon cast ensnare only while the target had the same looking direction. Then I tried with Xelnaga Temple and realised that I can't even remake it into an attacking building. Tried replacing it's .dat entries and iscript with photon cannons' and it made it attack only when an enemy was in its range, so if I wanted to attack a friendly unit or just change the target from one enemy or another it wouldn't react to my orders. Are attacking buildings hardcoded or what? The furthest I got was to make SC freeze when target got in the same direction as the temple.

tl;dr I want my XelNaga Temple to cast spells.
User avatar
IskatuMesk
Xel'naga World Shaper
Xel'naga World Shaper
Posts: 8332
Joined: Sat Feb 07, 2009 1:40 pm
Location: M͈̙̞͍͞ͅE̹H̨͇̰͈͕͇̫Ì̩̳CO̼̩̤͖͘ జ్ఞ‌ా
Contact:

Re: Attacking/Spellcasting Buildings

Post by IskatuMesk »

The unit needs to be able to turn. Buildings technically aren't able to turn (I believe it's both images.dat and flingy.dat you need to change). Since their sprites and iscripts aren't set up to do that, they'll promptly crash when you change them.

Thus, the easiest way to change it would probably be to make their iscripts use a frameset instead of a single frame (0x00 as opposed to 0), edit their grps accordingly, and mess with the dats. Make note I can't actually remember if this is the case, and fire overlays tend to crash when you change building animations. Feel free to experiment.

The photon cannon calls frames the temple doesn't have. That's usually a pretty solid way to crash the game.

And yeah, Useweapon spawns the weapon onto its target. So does Attackprojangle (the target being the distance) iirc though I may be wrong.
Gameproc
Though we stand alone, stand we shall.
User avatar
JanuszPawulon
Terran Supply Depot Clerk
Terran Supply Depot Clerk
Posts: 17
Joined: Sat Aug 23, 2014 11:57 am

Re: Attacking/Spellcasting Buildings

Post by JanuszPawulon »

I added the framesets in iscript so it's not the issue. I think the problem is that buildings can't face other directions than initial. No idea how scanner sweep works then though.
User avatar
IskatuMesk
Xel'naga World Shaper
Xel'naga World Shaper
Posts: 8332
Joined: Sat Feb 07, 2009 1:40 pm
Location: M͈̙̞͍͞ͅE̹H̨͇̰͈͕͇̫Ì̩̳CO̼̩̤͖͘ జ్ఞ‌ా
Contact:

Re: Attacking/Spellcasting Buildings

Post by IskatuMesk »

Command centers are really weird in general. I remember trying to add an attack to one in UF, and it broke all kinds of shit. I'm sure I knew the exact specifics of how to get all this stuff working, but I've long forgotten.
Gameproc
Though we stand alone, stand we shall.
User avatar
JanuszPawulon
Terran Supply Depot Clerk
Terran Supply Depot Clerk
Posts: 17
Joined: Sat Aug 23, 2014 11:57 am

Re: Attacking/Spellcasting Buildings

Post by JanuszPawulon »

I'm too tired to experiment with this now, but I think the attack angle in weapon's properties is the issue. STS/STA Photon cannon has it set to 128. DatEdit:
Angle within which the weapon can be fired without waiting for the unit's graphics to turn. 128 = 180 degrees.
Ok, setting attack angle to 128 worked. All works fine now.
User avatar
IskatuMesk
Xel'naga World Shaper
Xel'naga World Shaper
Posts: 8332
Joined: Sat Feb 07, 2009 1:40 pm
Location: M͈̙̞͍͞ͅE̹H̨͇̰͈͕͇̫Ì̩̳CO̼̩̤͖͘ జ్ఞ‌ా
Contact:

Re: Attacking/Spellcasting Buildings

Post by IskatuMesk »

I thought that might have been the case, and I was going to suggest it, but then I thought "wait, did starcraft even have an option like that?"

Weird that fixed it, but whatevs.
Gameproc
Though we stand alone, stand we shall.
User avatar
mark_009_vn
Zerg Drone Masseur
Zerg Drone Masseur
Posts: 356
Joined: Fri Nov 04, 2011 5:56 am
Location: [[THIS USER, HE IS A CHAR]]

Re: Attacking/Spellcasting Buildings

Post by mark_009_vn »

Angle within which the weapon can be fired without waiting for the unit's graphics to turn. 128 = 180 degrees.
Pretty sure most defense buildings use this property, Sunkens in particular actually use a special iscript opcode that determine it's attack direction and play the according frameset, it doesn't turn at all.
Image

"I'm begging you, let me work!" - Osamu Tezuka
User avatar
NigelTittysh
Terran Refinery Attendant
Terran Refinery Attendant
Posts: 22
Joined: Tue Dec 23, 2014 11:37 am

Re: Attacking/Spellcasting Buildings

Post by NigelTittysh »

IIRC that's how the Hydralisk was in beta (remnants can still be seen in the fact that it's the only unit to get stuck in the middle of its attack animation because Blizzard was too retarded to clean up all the goatse bits after they swapped it back in favour of the updated iscript).
I am Nigel Tittysh, Indian intern from India!
Image
Post Reply