View Full Version : Troublesome Tank
U-238
03-10-2006, 11:35 AM
Ok, I'm trying to make the siege tank be able to fire the arclite cannon as normal but if a melee unit gets too close the it unleeshes a barage of machinegun fire. I've done everything I know how to do to get this to work but I'm haveing problems getting the weapon to fire. Any help?[/COLOR]
U-238
What's the problem? Just give the turret two weapons, make the air one affect ground, and have a max range that is equal to the minimum range of the arclite cannon minus 1... that should do it...
Been there done that. It still doesn't work.
King_Critter
03-10-2006, 6:03 PM
You need to use the... >.< Crap, I forgot the command in iceCC. I'll be right back with an answer.
EDIT:
trgtrangecondjmp <num> <label> − If target within range of <1> (pixels?) goto label <2>: This is used
in certain attack animations (such as the regular archon’s). Basically, when the animation gets to this point, if the
sprite’s target is within range of <1> pixels (maybe different unit of measurement), then goto offset <2>.
Otherwise if the target is not within range then ignore this instruction. This is useful if you want a unit (like the
archon) to have different attack animations for units that are at different distances away (at different distances, for
example, the archon’s energy attack has a different length tail). You can use a little logic and combine these as
well for attacks at many different distances (e.g., If target within 5 then goto X, else if unit is within 10 goto Y,
else if unit is within 15 goto Z, else... etc.).
Taken straight from the IceCC manual.
Seen it and done it. Next idea please...
King_Critter
03-10-2006, 6:21 PM
Seen it and done it. Next idea please...
You've tried the "trgtrangecondjmp"? Because that should work.
Yep. (Where is BSTRhino when you need him?)
King_Critter
03-10-2006, 6:41 PM
I've used it before, and it's worked for me... But that's not really helpfull, is it? :)
Holocaust
03-10-2006, 6:59 PM
No it's not, so why did you post it anyways? >_>
Let's see,
You could give the Siege tank (Turret) the machine guns for an air attack but only set the machine guns to hit ground.
So then in the Tank's turret attack script, you would have something like
attack25 1
wait 1
trgtrangecondjmp ## Machineguns
then in your machine gun script, maybe something like
wait 1
attack25 2
wait 1
gotorepeatattack
etc...
That way, your tank turret would use it's air weapon (Machine guns that only set for ground) when units get to close.
Or just post your script and let's take a more indepth look
King_Critter
03-10-2006, 7:16 PM
No it's not, so why did you post it anyways? >_>
Because I wrote the first part, then added on the second part as an afterthought.
U-238
03-11-2006, 10:35 AM
Because I wrote the first part, then added on the second part as an afterthought
You know there IS such a thing as EDITING! Ever heard of it?
Or just post your script and let's take a more indepth look
The scripts onn its way. Hang on a sec...
EDIT(see critter? Editing!) Okay here's the script. at last check I left it trying the range condjmp one (trgtrangecondjmp) so if anyone knows what the problem is by all means tell me!
Holocaust
03-11-2006, 11:59 AM
Maybe the problem is because you put two scripts into one large one instead of 2 seperate ones.
I've tried decompiling multiple scripts and putting into one before and it didn't work.
Try seperating them into two
U-238
03-13-2006, 12:06 PM
Okay I seaperated them and then compiled them but that still didn't work. Any other ideas?
Okay I'm getting a little impateint here. Anyone else? BSTRhino? Holo? Any one?
Holocaust
03-15-2006, 1:24 PM
Here's a suggestion
Try looking at the Doom Dragoon's script from Doom Dragoon
The unit does have a melee range attack, so it wouldn't hurt to open it
If you can that is
Get that thing open? I've tried that with all of his iscripts and not one of them open for me.
Holocaust
03-15-2006, 2:15 PM
Well, list step by step what you did, in A3 and IceCC
I may be able to pinpoint what you're missing or have done wrong
mongoose41
03-15-2006, 2:57 PM
MarineGndAttkInit:
playfram 0x00 # frame set 0
wait 1
playfram 0x11 # frame set 1
wait 1
playfram 0x22 # frame set 2
MarineGndAttkRpt:
wait 1
trgtrangecondjmp 32 GUNWHACK
nobrkcodestart
playsnd 69 # Bullet\TMaFir00.wav
useweapon 0
playfram 0x33 # frame set 3
wait 1
playfram 0x22 # frame set 2
wait 1
playfram 0x33 # frame set 3
wait 1
playfram 0x22 # frame set 2
wait 1
playfram 0x33 # frame set 3
wait 1
playfram 0x22 # frame set 2
wait 1
nobrkcodeend
gotorepeatattk
ignorerest
GUNWHACK:
nobrkcodestart
playfram 0x11
wait 1
playfram 0x00
wait 1
playfram 0x22
wait 1
turncwise 1
attackwith 1
wait 1
turncwise 1
attackwith 1
turnccwise 2
attackwith 1
turnccwise 1
attackwith 1
turnccwise 1
attackwith 1
turncwise 2
attackwith 1
playfram 0x00
wait 1
nobrkcodeend
gotorepeatattk
goto MarineGndAttkToIdle
I got my marine to hit zerglings and zealots with the end of his gun! Maybe try something similar. EDIT:This was done using an IceCC fix from stareditnet... It has different opcodes than the original!
Well, list step by step what you did, in A3 and IceCC
I may be able to pinpoint what you're missing or have done wrong
Okay, I used DatEdit and gave the tank turrets (both of them) "Unused Guass Rifle2" as an air weapon.
2. I saved and exited.
3. I went into IceCC and decompiled the two turrets.
4. Im used the trgtrangecondjmp to jump to "TankGunInit" when the target got in a range of 8
5. In the "TankGunInit" I simply put
nobrkcodestart
Wait 1
Attack25 2
gotorepeateattk
goto SeigeTankTankTurretGndAttkToIdle.
nobrkcodeend
Thats what I did. Substituteing the appropriate names of course.
mongoose41
03-15-2006, 3:44 PM
Okay, I used DatEdit and gave the tank turrets (both of them) "Unused Guass Rifle2" as an air weapon.
2. I saved and exited.
3. I went into IceCC and decompiled the two turrets.
4. Im used the trgtrangecondjmp to jump to "TankGunInit" when the target got in a range of 8
5. In the "TankGunInit" I simply put
nobrkcodestart
Wait 1
Attack25 2
gotorepeateattk
goto SeigeTankTankTurretGndAttkToIdle.
nobrkcodeend
Thats what I did. Substituteing the appropriate names of course.Both your ground and your air attack MUST have the same range and cooldown for this attack code to work.
You sure? I've done it before and haven't had them match and it worked.
BSTRhino
03-17-2006, 6:22 PM
Hi! Thanks for pointing me to this thread, I saw it but the first time I saw it I didn't have the time to reply. Here's what I think.
First, trgtrangecondjmp uses pixels, and there are 16 pixels to each Arsenal III range unit. At the moment your range is set to 8 pixels in your iscript. So that's 0.5 Arsenal III range units (8 / 16). I'm not sure if you know how small that is, but basically what that means is, the unit will have to be standing on top of the Siege Tank before the machine gun would fire. Since that's not actually possible, your machine gun probably never fires. Try a longer range. The Firebat has a range of 2 Arsenal III range units, which is 32 (2 * 16) pixels, if you don't know what to put, try that number.
Also, I think you should use the script that you originally posted before in the attachment. The second script fragment you posted up there would stop the Siege Tank firing after one shot. If we look at it, you might see how that happens:
nobrkcodestart
Wait 1
Attack25 2
gotorepeateattk
goto SeigeTankTankTurretGndAttkToIdle.
nobrkcodeend
It's just because nobrkcodeend is after goto SiegeTankTurretGndAttkToIdle. As soon as StarCraft sees the goto, it'll jump to SiegeTankTurretGndAttkToIdle and it will never reach the line that says nobrkcodeend, and so the Siege Tank will be stuck in a nobrkcode section where the player can't order the Siege Tank to do anything.
Another thing is, you've set the Machine Gun to your air weapon, right? Because the tank now has an air weapon, it's going to try to shoot air targets now, so make sure you've got an air attack animation in there. If that's not what you want, use the useweapon command to fire the machine gun.
Finally, the ground and air weapon don't have to have the same range and cooldown for your code to work. It's a bit counter-intuitive, I know, but the target range or cooldown is not checked when you use a weapon in the iscript.
Okay thanks Rhino. I'll try that. The reason for the air weapon is I want it to display as an icon in game. I know It'll try to hit air but oh well. Besides, it won't affect me. Just other mod users
INcuBI-wolfgang
03-18-2006, 3:21 AM
this is a very interesting thread, your marine and tank sound really cool, id love to see them in a mod. ive always wanted the same thing for my units, lol.
U-238
03-18-2006, 11:08 AM
ARGHHH! IT"S STILL NOT WORKING! Hmmmm. Hey Rhino, If your still looking at this thread do this. I'll post up my iscript and you take a look at it. Then if I'm doing anything wrong tell me what it is. By all acounts it sould be right but it still isn't working.
EDIT okay here's the script. Take a look.
this is a very interesting thread, your marine and tank sound really cool, id love to see them in a mod. ive always wanted the same thing for my units, lol.
Thanks, I'm actually putting all of this into my mod Starcraft-X
As for the tank and marine. Wiat till you see the wraith. Wraith=Godlike:D
mongoose41
03-19-2006, 4:02 PM
Finally, the ground and air weapon don't have to have the same range and cooldown for your code to work. It's a bit counter-intuitive, I know, but the target range or cooldown is not checked when you use a weapon in the iscript.If you set the range of a weapon (machinegun) to say, 3, then it will only fire it's shock cannon at units that are 2-3 or it won't fire at all. Starcraft only tells it to run its grdattkanimation when the target is IN RANGE OF THE APROPRIATE WEAPON. <end experianced remark>
BSTRhino
03-19-2006, 4:24 PM
That's true, but I meant using a weapon with useweapon or doing attack25 2 in a ground attack animation when I said using a weapon in the iscript, so I think we're talking about different things.
Can you define "not working" U-238? It'd help me work out what might be wrong.
Looking at your script, it looks like what you want the Siege Tank to do is to shoot a machine gun repeatedly if the target is close, right? In that case, I think you should do something like this:
SiegeTankTankTurretGndAttkInit:
trgtrangecondjmp 80 RoadkillTank
wait 1
nobrkcodestart
playsnd 68 # Bullet\TTaFir00.wav
imgol08 536 0 0 # Unknown536 (thingy\ettFlash.grp)
wait 2
attack25 1
nobrkcodeend
gotorepeatattk
wait 1
goto SiegeTankTankTurretGndAttkToIdle
RoadkillTank:
gotorepeatattk
wait 1
RoadkillTankRepeat:
nobrkcodestart
playsnd 69 # Bullet\TMAFir00.wav
wait 2
useweapon 119
nobrkcodeend
wait 1
trgtrangecondjmp 80 RoadkillTankRepeat
goto SiegeTankTankTurretGndAttkToIdle
The only real change I'm doing here is adding a gotorepeatattk at the start of the RoadkillTank block. That'll make sure StarCraft knows that it can go to the repeat attack animation if the cooldown runs out before the repeated machine gun weapon finishes. If an attack animation takes significantly longer than the cooldown to complete, StarCraft crashes. I haven't measured what significantly longer is yet though.
U-238
03-20-2006, 12:09 PM
Can you define "not working" U-238? It'd help me work out what might be wrong.
Well it's pretty simple. The machine gun doesn't shoot. However I will be as precise as possible so that we can get this thing worked out with no further problems.
When the tank is in tank mode and you order it to attack a unit, like the firebat for example, it'll shoot at the firebat untill it gets in the trgtrngcondjmp range. Then it'll move right up to the target and just sit there. It doesn't shoot the gun at all.
When the tank is in siege mode and you do the same thing as above it'll shoot at the firebat untill, once again, it gets in the trgtrngcondjmp range. Then it displays the error message: "Target Is To Close" and still will not shoot the machine gun.
Looking at your script, it looks like what you want the Siege Tank to do is to shoot a machine gun repeatedly if the target is close, right?
Right. I want that tank to BLAZE those zerglings down!
mongoose41
03-20-2006, 2:54 PM
what about a flamethrower overlay? (you did say BLAZE them down!) You could try setting the AIR attkrange to 0 and minrange to 1. That way it won't try to attack air units.
Oh and judging by your explanation, you need to remove the minimum range from the shock cannon
Lol no, no flame throwers please! Yea I suppose that could work but like I said I don't really care if it tries to attack air. And you need to have that min range on both cannons. otherwise it'll shoot both the cannon and the gun.
mongoose41
03-20-2006, 10:15 PM
Then it's your code.
BSTRhino
03-20-2006, 11:15 PM
Okay, hold on, you've got minimum range on your siege tank ground weapons? The minimum range defines what range the unit should pickup targets. So, if you've set the minimum range of your Tank mode weapon set to 5, then the Tank won't pickup targets that are closer than 5 range units, and so the tank won't shoot its machine gun because it can't lock on targets that are closer than 5 range units.
So, the minimum range of the tank mode weapon should be zero. When the target gets closer than 5 range units, the iscript will stop the unit from using its standard weapon. The iscript is already written well, so you don't need to change that, only the minimum range.
It doesn't actually matter what range you give to your machine gun weapon (weapon ID 119) because useweapon lets the weapon be used at any range because it doesn't check the range first.
mongoose41
03-21-2006, 1:02 AM
So, the minimum range of the tank mode weapon should be zero. When the target gets closer than 5 range units, the iscript will stop the unit from using its standard weapon. The iscript is already written well, so you don't need to change that, only the minimum range. Well, I pretty much said that, but in less detail. A LOT less detail.
Oh and judging by your explanation, you need to remove the minimum range from the shock cannon
BSTRhino
03-21-2006, 5:17 AM
Oh, yes you did say that, I see it now. Gosh mongoose, you're really onto it!
U-238
03-21-2006, 12:47 PM
Well thanks both of you. You know I had this feeling the whole time that it was something in the dats that was wrong. I'll give that a shot.
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.