It wasn't even coming close and the problem was a bug with the interface. It was showing my copy+pasted variable resets but they weren't actually in the script. When I deleted and remade them exactly how they were it worked.
That sounds extremely odd. Compare all fields on your ability to the
original, especially Stats: Flags and Cost. The Cost has 2 "Link"
fields, which can be used to implement shared cooldowns between
abilities etc.
Also make sure your weapon isn't doing anything fancy like running a
channeled attack. Basic test, replace custom weapon with default Marine
one and see if the problem persists.
So I've copied a weapon and its corresponding effect and added it to the unit it is from. The weapon I've copied only targets air units. I made the copy only target ground units, and I changed its damage.
When I look in game at the unit, everything appears fine. The air weapon targets air and does X damage, the ground weapon targets ground and does Y damage. But when it comes to actually attacking, the ground weapon does X damage to units.
@Tudentau: Go If its a one time upgrade to the unit, you should actually
change how the ability works, and make the button disappear after use.
At least that's how I'd make it.
It does disappear. For normal gameplay, Generate Creep disappears as well, but Stop Generating Creep appears. When you use Stop Generating Creep, Generate Creep reappears.
I might just end up making a new ability and trying to start from scratch, but there's so much going on in the data editor.
What is your point though? That it requires more work? That it causes
more overhead?
In general it's just nicer.
When I'm looking over my code, it stands out better to me. The conditions are indented out from the start and the actions indented out from the conditions, whereas a for loop has the conditions in the same line with only the actions indented out. When I look at it under script, it looks ridiculously better. When I want to add an additional condition, it doesn't require using an if-then statement. In terms of resources, there are two less variables being used and no need to redeclare my counter variable unless I'm using another loop with the same variable.
So what I've done is copy the Overlord's generate creep ability, but removed the disable validators, the delay, and increased the period. I've also made it reference different footprints so the creep generated is a particular size. I then added a 75 mineral cost.
The intention was to have the unit have a 1-time purchasable upgrade that makes it generate a creep field, and it works, except if the unit has attacked, the ability will no longer be usable. It become white similar to how stop does on stationary units. If it attacks after already having used the ability, it still retains its creep field.
Also I can't go back and add an extra condition to a 'for loop'. In general I never use for loops because of this reason, as they're restricted to an integer and nothing more.
Before each while block you need to reset the respective loopCounter to
0. Otherwise once it does the first player, loopCounter 2 will still =
40. And once it does the first unit, loopcounter 3 will still be 9.
E.g.
Set loopCounter = 0
General - While (Conditions) are true, do (Actions)
Conditions
loopCounter < 9
Actions
Set loopCounter 2 = 0
General - While (Conditions) are true, do (Actions)
Conditions
loopCounter 2 < 40
Actions
Set loopCounter 3 = 0
General - While (Conditions) are true, do (Actions)
Conditions
loopCounter 3 < 7
P.S. Why don't you just use FOR loops? Then you wouldn't have to do that
reset to 0 thing because it does it automatically.
Ok, so I'm not sure how this didn't copy, but I am resetting the loop counters outside themselves.
I use while loops because they're generally just better in terms of programming and I can also visualize them the same anyway.
Alright, so I guess them not copying was because they weren't actually there even though they were. I deleted and remade the loops exactly how they were and now it works as expected.
0
@BasharTeg: Go
It wasn't even coming close and the problem was a bug with the interface. It was showing my copy+pasted variable resets but they weren't actually in the script. When I deleted and remade them exactly how they were it worked.
0
It returns a point. So you can make a point variable and set it using Find Placement.
0
@Photoloss: Go
Well the only other flag that I turned on was toggle, which doesn't seem like it should have any effect, either.
0
It was the flags, transient I'm guessing.
0
@Photoloss: Go
Yeah I forgot to change the launch missile. I've named them very similarly and the name goes off the field.
Works now, thanks.
0
So I've copied a weapon and its corresponding effect and added it to the unit it is from. The weapon I've copied only targets air units. I made the copy only target ground units, and I changed its damage.
When I look in game at the unit, everything appears fine. The air weapon targets air and does X damage, the ground weapon targets ground and does Y damage. But when it comes to actually attacking, the ground weapon does X damage to units.
0
It does disappear. For normal gameplay, Generate Creep disappears as well, but Stop Generating Creep appears. When you use Stop Generating Creep, Generate Creep reappears.
I might just end up making a new ability and trying to start from scratch, but there's so much going on in the data editor.
0
In general it's just nicer.
When I'm looking over my code, it stands out better to me. The conditions are indented out from the start and the actions indented out from the conditions, whereas a for loop has the conditions in the same line with only the actions indented out. When I look at it under script, it looks ridiculously better. When I want to add an additional condition, it doesn't require using an if-then statement. In terms of resources, there are two less variables being used and no need to redeclare my counter variable unless I'm using another loop with the same variable.
vs
0
So what I've done is copy the Overlord's generate creep ability, but removed the disable validators, the delay, and increased the period. I've also made it reference different footprints so the creep generated is a particular size. I then added a 75 mineral cost.
The intention was to have the unit have a 1-time purchasable upgrade that makes it generate a creep field, and it works, except if the unit has attacked, the ability will no longer be usable. It become white similar to how stop does on stationary units. If it attacks after already having used the ability, it still retains its creep field.
0
Splitting hairs. The point remains the same.
0
@Mille25: Go
'easily'
That requires two additional functions as well as the condition. With a while loop I just add the condition.
0
Nevermind I had accidentally pulled my if then statement out of my loop.
0
@Mille25: Go
For other code as well.
Also I can't go back and add an extra condition to a 'for loop'. In general I never use for loops because of this reason, as they're restricted to an integer and nothing more.
0
Ok, so I'm not sure how this didn't copy, but I am resetting the loop counters outside themselves.
I use while loops because they're generally just better in terms of programming and I can also visualize them the same anyway.
Alright, so I guess them not copying was because they weren't actually there even though they were. I deleted and remade the loops exactly how they were and now it works as expected.
0
@joemart06: Go
It seems SC2Galaxy takes the absolute value of numbers with mod. So continuing down that line,
z = (5 - (4 - 1)) mod 6) = 2 mod 6 = 2 (x2 =4)
z = (5 - (5 - 1)) mod 6) = 1 mod 6 = 1 (x2 =2)
z = (5 - (6 - 1)) mod 6) = 0 mod 6 = 0 (x2 =0)
z = (5 - (7 - 1)) mod 6) = -1 mod 6 = -1 (x2 =-2)
z = (5 - (8 - 1)) mod 6) = -2 mod 6 = -2 (x2 =-4)
z = (5 - (9 - 1)) mod 6) = -3 mod 6 = -3 (x2 =-6)
z = (5 - (10 - 1)) mod 6) = -4 mod 6 = -4 (x2 =-8)
z = (5 - (11 - 1)) mod 6) = -5 mod 6 = -5 (x2 =-10)
z = (5 - (12 - 1)) mod 6) = -6 mod 6 = 0 (x2 =0)
z = (5 - (13 - 1)) mod 6) = -7 mod 6 = -1 (x2 =-2)
etc.
If you want a sequence of 10/8/6/4/2/0 why not do
var1 = 12 (global)
if (var1 - (cw * 2 ) < 0 then modify var1 + 10
z = var1 - (cw * 2)