Problem with tower shooting and ammo

Started by TheTiconTech, March 18, 2015, 05:06:35 AM

Previous topic - Next topic

TheTiconTech

Well, that'd look strange, but here's the question:


if ("X" GetKeyDown)
if (Self "CONST_AMMO" GetUnitAttribute 5 gte)
SetUnitAttribute(Self "CONST_AMMO" sub(GetUnitAttribute(Self "CONST_AMMO") 5))
1 CellToPixel(<-x <-y) -1 1 1 0.05 CreateEffect
endif
endif


I want the unit's ammo to lower by 5 and do sth when pressing X. It does sth, but instead of lowering ammo by 5 it seems to lower X coordinate (in cells) of itself by 5! What's the deal? Anyone knows? x and y in the code are mouse position.

UPD: it seems to take every "CONST_AMMO" for "CONST_COORDX"...

UPD: sorry everyone! Just deleted quotes and it worked!

TheTiconTech