- Joined
- Aug 13, 2007
- Messages
- 309
I'm having some problems with my weapons system:
1. The projectiles sometimes go through a unit without colliding. This is especially a big problem for my fast projectiles. Projectiles script:
2. Knockback. I have a working system but I use fail math.
3. Spray. I currently just use RandomFixed and don't do a proper spray; I also can't increase/decrease spray such as should be the case with a minigun.
4. I can't stop the muzzle-flash & weapon-sound from playing when a unit with no ammo takes a shot because I have that all attached to the weapon in the data manager since I can't script sounds/animations in a way that works. When I just play a sound through scripting any sounds being played via the normal game such as zerg death sounds will play instead of the scripted sound, which will only play when there's no other noise to conflict with it. I don't even know if there's a way to make the muzzle flashes appear correctly.
5. I have a hard time deciding what damage weapon projectile should do... right now I just try to balance all the guns currently existing but I think I should do this some other way then just guessing.
1. The projectiles sometimes go through a unit without colliding. This is especially a big problem for my fast projectiles. Projectiles script:
JASS:
//--------------------------------------------------------------------------------------------------
// Trigger: Projectiles
//--------------------------------------------------------------------------------------------------
bool gt_Projectiles_Func (bool testConds, bool runActions) {
// Variable Declarations
unit lv_u;
fixed lv_angle;
int lv_cv;
// Variable Initialization
lv_u = null;
lv_angle = 270.0;
lv_cv = 0;
// Actions
if (!runActions) {
return true;
}
UnitGroupLoopBegin(gv_projectileUG);
while (!UnitGroupLoopDone()) {
lv_u = UnitGroupLoopCurrent();
lv_cv = FixedToInt(UnitGetCustomValue(lv_u, gv_CVS));
UnitSetPosition(lv_u, PointWithOffsetPolar(UnitGetPosition(lv_u), gv_projSpeed[lv_cv], gv_projDirection[lv_cv]), true);
UnitGroupLoopStep();
}
UnitGroupLoopEnd();
return true;
}
//--------------------------------------------------------------------------------------------------
void gt_Projectiles_Init () {
gt_Projectiles = TriggerCreate("gt_Projectiles_Func");
TriggerAddEventTimePeriodic(gt_Projectiles, 0.02, c_timeReal);
}
JASS:
gv_projSpeed[lv_cv2] = gv_projKnockback[lv_cv] - gv_uMass[lv_cv2];
JASS:
UnitCreate(1, "Projectile", 0, lv_p, lv_projstartpt, lv_angle + RandomFixed(-11.5, 11.5));
5. I have a hard time deciding what damage weapon projectile should do... right now I just try to balance all the guns currently existing but I think I should do this some other way then just guessing.
-
Weapon Damage
- DMG Flamethrower = 0.1 <Real (Constant)>
- DMG Assault Rifle = 4.2 <Real (Constant)>
- DMG Shotgun = 2.35 <Real (Constant)>
- DMG Rifle = 35.0 <Real (Constant)>
- DMG Micro Uzi = 1.33 <Real (Constant)>