Staredit Network > Forums > Modding Assistance > Topic: Making attaking buildings
Making attaking buildings
Mar 10 2009, 2:18 pm
By: Yawgmoth  

Mar 10 2009, 2:18 pm Yawgmoth Post #1



I want that the Xel'Naga Temple and the Overmind with shell have weapons.

I made the following:
- Changes in the units.dat to give them weapons and the attack(building) order and the no movement/auto attack option.
- Changes in the script to give them an attack animation
- Changes in Firegraft to give them the buttons and change the status preset, and the dat requirements to the orders Tower Attack and Tower Guard.

But the buildings don't attack even when the Attack button becomes highlighted....
In other words, they appear to be attacking but they don't use the weapon, no sprite, no damage, nothing.

What do you think is happening? Maybe that buildings can't attack??

Thank for answering.

Post has been edited 1 time(s), last time on Mar 14 2009, 2:24 am by Yawgmoth.



None.

Mar 10 2009, 2:46 pm Symmetry Post #2

Dungeon Master

What weapon are they using? If the attack angle is not set to 128, they cannot attack in most directions (as buildings do not turn).



:voy: :jaff: :voy: :jaff:

Mar 10 2009, 2:53 pm Yawgmoth Post #3



Quote from name:Killer_Kow
What weapon are they using? If the attack angle is not set to 128, they cannot attack in most directions (as buildings do not turn).

mmm i didn't change that!!

gonna try and report back.....



None.

Mar 10 2009, 11:20 pm ShadowFlare Post #4



Quote from name:Killer_Kow
What weapon are they using? If the attack angle is not set to 128, they cannot attack in most directions (as buildings do not turn).
Buildings just don't turn by default, but they can be made to do so if you really want to. :)



None.

Mar 11 2009, 1:33 pm Yawgmoth Post #5



Success!!

But i'm still getting some crashes with the animation. Also, I realized that I've changed the images.dat entries for both sprites and selected the "Graphic turns" option....so the buildings apparently turned...but it didn't worked until I changed the attack angle of the weapons to 128.

Now i've made an Overmind with omnidirectional lurkerlike attack but i'm getting some crashes....and same with the Xel'Naga Temple. The weapons I used are configured like the lurker's and are from the "Unused" group, with the "Go to Max Range" behavior. So I made the attack animation with the "turncwise/attack" opcodes, and a very long cooldown for the weapon.

But i'm getting some crashes after two or three attacks. What could be wrong?? I've tried successfully that with some units. Maybe that can't be done with buildings...??



None.

Mar 11 2009, 1:48 pm Symmetry Post #6

Dungeon Master

Did you give the buildings turning frames? When a unit turns, it calls on the 17 directional frames for each frameset, so if you haven't added them, the building would crash for that reason.



:voy: :jaff: :voy: :jaff:

Mar 11 2009, 2:16 pm Yawgmoth Post #7



Quote from name:Killer_Kow
Did you give the buildings turning frames? When a unit turns, it calls on the 17 directional frames for each frameset, so if you haven't added them, the building would crash for that reason.

The "Graphic Turns" option of the images.dat does that dynamically. The building attacks, even omnidirectionally. The crash occurs after two or three attack repeats, I don't know why....



None.

Mar 11 2009, 2:28 pm Symmetry Post #8

Dungeon Master

Quote from Yawgmoth
Quote from name:Killer_Kow
Did you give the buildings turning frames? When a unit turns, it calls on the 17 directional frames for each frameset, so if you haven't added them, the building would crash for that reason.

The "Graphic Turns" option of the images.dat does that dynamically. The building attacks, even omnidirectionally. The crash occurs after two or three attack repeats, I don't know why....

This is really hard to explain, but I'm going to try and voice my theory here.

When the building is built, it is facing upwards. It is therefore playing frame 0 of frameset 0x00. When your building attacks the first time, your iscript is telling it to rotate and attack in every direction without waits, meaning that when the animation is complete, it is facing upwards again (and it is still playing frame 0). Thusly, if your building kills the unit it attacks (or if the unit is directly above it) it will work fine. However, if the building has to attack the unit again, or finds a new target during its cooldown, it will naturally try and face its target. When it does this, it has to play a different frame, for example frame 8 of frameset 0x00. If you didn't edit the grp, frame 8 doesn't exist, so the game crashes due to a null pointer.

I hope that was understandable.



:voy: :jaff: :voy: :jaff:

Mar 11 2009, 2:51 pm Yawgmoth Post #9



Quote
This is really hard to explain, but I'm going to try and voice my theory here.

When the building is built, it is facing upwards. It is therefore playing frame 0 of frameset 0x00. When your building attacks the first time, your iscript is telling it to rotate and attack in every direction without waits, meaning that when the animation is complete, it is facing upwards again (and it is still playing frame 0). Thusly, if your building kills the unit it attacks (or if the unit is directly above it) it will work fine. However, if the building has to attack the unit again, or finds a new target during its cooldown, it will naturally try and face its target. When it does this, it has to play a different frame, for example frame 8 of frameset 0x00. If you didn't edit the grp, frame 8 doesn't exist, so the game crashes due to a null pointer.

I hope that was understandable.

Yes, indeed.

It's so logical. I'm going to add the 16 frames the Xel'Naga's grp lack. To the Overmind, I guess I'll assign it as an overlay or something for aesthetic purposes.....
The rare thing is that I've made an unit that acts in that way. It's like a flying building with one frame and attacks to 8 directions.....and it doesn't have the "Graphic Turns" option selected.....

I'll go to review that and report back



None.

Mar 11 2009, 2:53 pm Symmetry Post #10

Dungeon Master

Quote from Yawgmoth
The rare thing is that I've made an unit that acts in that manner. It's like a flying building with one frame and attacks to 8 directions.....and it doesn't have the "Graphic Turns" option selected...

My guess is that the unit/building can turn without its graphic needing to. Interesting. If that's the case, you could just uncheck 'graphic turns' for your other buildings.



:voy: :jaff: :voy: :jaff:

Mar 12 2009, 12:29 am ShadowFlare Post #11



You actually don't need to have it turn graphically (through images.dat) to have it change direction internally. To be able to change direction, it simply needs its entry in flingy.dat set up properly.



None.

Mar 13 2009, 1:04 pm Yawgmoth Post #12



OK, I've made some changes and I'm still feel uneasy with the results...

1.- Changed the images.dat entries deselecting the "Graphic Turns" option

2.- Changed the script quitting the "AlmostBuilt" animation that crashed when I click repeatedly the "Stop" button in the game (don't understand why), and worked well.

3.- Changed the fingy.dat (not sure if i did it well).... putting Top Speed 1, Acceleration 1, Hal Distance 1 and Turn Radius 127 in the options.

4.- Xel'Naga's Temple GRP with one frame. It worked very well. It crashed after some attacks when i used the 17 frames GRP.

With all of this, I'm still getting a late crash with the Xel'Naga's Temple. When it attacks for a while (two, three minutes), and then i go to other part of the map, letting it stop when there are no more enemies, the crash occurs when I try to return at the vision of the building.....I think that's a curious thing. Maybe there is a little hardcode between that units ID (I don't think so, however).

So I need to know if I modified wrong the flingy, or another stuff......

Thanks



None.

Mar 13 2009, 1:52 pm Symmetry Post #13

Dungeon Master

Sounds like an iscript issue. Post the attack script so we can diagnose it for you?



:voy: :jaff: :voy: :jaff:

Mar 13 2009, 3:09 pm Yawgmoth Post #14



Code
# ----------------------------------------------------------------------------- #
# This header is used by images.dat entries:
# 937 XelNagaTemple (protoss\XelTempl.grp)
.headerstart
IsId               410
Type               20
Init               XelNagaTempleInit
Death               XelNagaTempleDeath
GndAttkInit         XelNagaTempleGndAttkInit
AirAttkInit         XelNagaTempleGndAttkInit
Unused1             [NONE]
GndAttkRpt         XelNagaTempleGndAttkRpt
AirAttkRpt         XelNagaTempleGndAttkRpt
CastSpell           [NONE]
GndAttkToIdle       [NONE]
AirAttkToIdle       [NONE]
Unused2             [NONE]
Walking             [NONE]
WalkingToIdle       [NONE]
SpecialState1       [NONE]
SpecialState2       [NONE]
AlmostBuilt         [NONE]
Built               XelNagaTempleBuilt
Landing             [NONE]
LiftOff             [NONE]
IsWorking           XelNagaTempleIsWorking
WorkingToIdle       XelNagaTempleWorkingToIdle
WarpIn             [NONE]
.headerend
# ----------------------------------------------------------------------------- #

XelNagaTempleInit:
    imgul               938 0 0     # XelNagaTempleShad (protoss\pxtShad.grp)
    playfram           0
    goto               XelNagaTempleLocal00
   
XelNagaTempleLocal00:
    wait               125
    goto               XelNagaTempleLocal00

XelNagaTempleGndAttkInit:
    playfram     0
    wait         2
XelNagaTempleGndAttkRpt:
    wait         4
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    attack
    turncwise     1
    wait         4

XelNagaTempleDeath:
    playsnd             7     # Misc\ExploLrg.wav
    imgol               215 0 0     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 64 64     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 -64 64     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 64 -64     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 -64 -64     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         4
    playsnd             7     # Misc\ExploLrg.wav
    imgol               215 0 0     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 0 80     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 80 0     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 -80 0     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 0 -80     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    wait         4
    playsnd             7     # Misc\ExploLrg.wav
    imgol               215 0 0     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 64 64     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 -64 64     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 64 -64     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    imgol               215 -64 -64     # ProtossBuildingExplosionLarge (thingy\tBangX.grp)
    wait         1
    lowsprul           224 0 0     # ProtossBuildingRubbleLarge (thingy\PRubbleL.grp)
    wait               1
    end                

XelNagaTempleBuilt:
    goto               XelNagaTempleLocal00

XelNagaTempleIsWorking:
    playfram           0
    goto               XelNagaTempleIsWorking

XelNagaTempleWorkingToIdle:
    wait         1
    goto         XelNagaTempleLocal00


There you are. The Overmind's script doesn't have any problem. The crash occurs only with the Xel'Naga Temple.
The death is elaborated because I made a bigger Xel'Naga Temple by scaling the normal to 252x252 pixels. It's huge.

Maybe I have another script problem so I posted the whole Xel'Naga's script....

Post has been edited 1 time(s), last time on Mar 13 2009, 7:49 pm by Killer_Kow.



None.

Mar 13 2009, 6:57 pm Biophysicist Post #15



This is just a guess, but it might not like that there isn't a gotorepeatattk at the end of your attack routine. Try adding one. While your at it, you might want to put "goto XelNagaTempleLocal00" after the gotorepeattk.



None.

Mar 13 2009, 7:06 pm Yawgmoth Post #16



Quote from name:James Buchanan
This is just a guess, but it might not like that there isn't a gotorepeatattk at the end of your attack routine. Try adding one. While your at it, you might want to put "goto XelNagaTempleLocal00" after the gotorepeattk.

lol I forget add the final two lines.....
I wrote the attack script today and fast because I were at my job.....the other animations were written some days ago.

the lines were "gotorepeatattk" and then a "ignorerest". There wasn't the "goto label".....

Is that right? Or must I add that line and erase the ignorerest?



None.

Mar 13 2009, 7:51 pm Symmetry Post #17

Dungeon Master

Quote from Yawgmoth
Quote from name:James Buchanan
This is just a guess, but it might not like that there isn't a gotorepeatattk at the end of your attack routine. Try adding one. While your at it, you might want to put "goto XelNagaTempleLocal00" after the gotorepeattk.

lol I forget add the final two lines.....
I wrote the attack script today and fast because I were at my job.....the other animations were written some days ago.

the lines were "gotorepeatattk" and then a "ignorerest". There wasn't the "goto label".....

You need those, and you need to create a GndAttkToIdle header after it. Look at other units as examples.



:voy: :jaff: :voy: :jaff:

Mar 14 2009, 2:23 am Yawgmoth Post #18



Quote
You need those, and you need to create a GndAttkToIdle header after it. Look at other units as examples.
Quote from name:Killer_Kow
Quote from Yawgmoth
Quote from name:James Buchanan
This is just a guess, but it might not like that there isn't a gotorepeatattk at the end of your attack routine. Try adding one. While your at it, you might want to put "goto XelNagaTempleLocal00" after the gotorepeattk.

lol I forget add the final two lines.....
I wrote the attack script today and fast because I were at my job.....the other animations were written some days ago.

the lines were "gotorepeatattk" and then a "ignorerest". There wasn't the "goto label".....

You need those, and you need to create a GndAttkToIdle header after it. Look at other units as examples.

Yep, you are right..... it worked well until now. I think the bugs where there in the lack f the "goto label" sentence.

The rare thing is that I forget also to put tht lines in the Overmind's script, and it never gave me any crash when I fixed the 128 attack angle for buildings.......

Thank you!



None.

Mar 14 2009, 2:05 pm Biophysicist Post #19



You should still add them to the Overmind, just in case.



None.

Mar 14 2009, 9:12 pm ShadowFlare Post #20



If you don't have a goto after an animation, then when it reaches the end of it, it will just continue on to the code you have directly below it. In this case, it was continuing on to the death animation you have there, which I'm sure isn't what you want. Remember, unless you specifically want it to continue further down in the code, you need a goto. Nearly everything eventually needs to reach a goto, unless it is an end command to end the animation (like the death animation). ;)

I don't know if I should or should not sometime rename gotorepeatattk. Many people don't realize at first that they still need a goto after it, that it is not a replacement for a goto. I should probably at least add an additional note on it sometime in the opcode list.

It is probably a good idea to use another unit's iscript as a reference whenever you are adding a new animation, to see what you might need in the animation and to see if you might need any additional animations to go with it.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:18 am]
Sylph-Of-Space -- No complaints here, i'm just curious!
[11:05 pm]
Ultraviolet -- :wob:
[03:55 pm]
Zoan -- :wob:
[10:34 am]
NudeRaider -- SEN doesn't rely on spammers initiate its sleep cycle. It hat fully automated rest and clean-up phases. Please understand that this is necessary for the smooth operation of the site. Thank you.
[2024-5-18. : 3:45 am]
Sylph-Of-Space -- Does the shoutbox get disabled when there's spammers?
[2024-5-17. : 6:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[2024-5-17. : 5:41 am]
Ultraviolet -- 🤔 so inf is in you?
[2024-5-17. : 4:57 am]
O)FaRTy1billion[MM] -- my name is mud
[2024-5-17. : 4:35 am]
Ultraviolet -- mud, meet my friend, the stick
[2024-5-16. : 10:07 pm]
lil-Inferno -- nah
Please log in to shout.


Members Online: dextereaustin, Roy