That's alot of code to sort through to find that nasty divide by zero, on the skybox issue, make sure your farclipping on the camera is a really high or it'll clip and you can't see the skybox.
Honestly now, can YOU look at your posted code and identify ANYTHING?
Please either use code tags to make it easier to read or post the entire map here. It's a complicated system and hard to just overlook to find a nasty division error.
Have you changed anything on the map you uploaded? I don't get any division error (I don't get any errors at all), but the screen resets everytime I try to fire.
hmm. I did change one thing but i thought it would help more then harm. heres an earlier map. it only errors when you try to shoot something so ill place a unit near you to shoot.
hopefully that works
Alright, let's see... I've tracked the error down to the gf_Traceline function.
The code is confusing, but could it be that you forgot to set-up all the animals? Because there's no problem shooting at a marine ( if(UnitGetType(lv_closestUnit) == "Marine") ) but all other units cause errors.
When shooting any unit I get an error related to this trigger. Something about a "Divide by zero".
Wait(0.05, c_timeGame);
CameraSetValue(1, c_cameraValuePitch, CameraGetPitch(1) - 0.5, 0.0, -1, 10);
Wait(0.05, c_timeGame);}
else {if((gv_ammo > 0) && (gv_weapon == 0)) {
gv_pitch = CameraGetPitch(1);
UnitSetFacing(gv_mainUnit, CameraGetYaw(1), 0.1);
CameraShakeStart(1, c_cameraPositionEye, c_cameraDirectionZ, 0.0125, 1.0, 100.0, 18.0);
CameraShakeStart(1, c_cameraPositionEye, c_cameraDirectionX, 0.0125, 1.0, 100.0, 18.0);
gv_rapidFire = 1;
TriggerExecute(gt_Animation, true, false);}
while((gv_repfire == 1) && (UnitIsAlive(gv_mainUnit) == true) && (gv_ammo > 0)) {
UnitSetFacing(gv_mainUnit, CameraGetYaw(1), 0.1);
gv_ammo -= 1;
Wait(0.025, c_timeGame);
gf_Traceline(UnitGetPosition(gv_cameraFollow), (WorldHeight(c_heightMapGround, UnitGetPosition(gv_cameraFollow)) + 0.75), 1);
SoundPlayOnUnit(SoundLink("Marine_AttackLaunch", -1), PlayerGroupAll(), gv_mainUnit, 0.9, 100.0, 0.0);
libNtve_gf_AttachModelToUnit(gv_mainUnit, "MarineAttackLaunch", "Weapon");
CameraSetValue(1, c_cameraValuePitch, CameraGetPitch(1) - 0.125, 0.0, -1, 10); }
gv_repfire = 0;
CameraShakeStop(1);}
if((gv_fuel > 0) && (gv_weapon == 2)) {
UnitSetFacing(gv_mainUnit, CameraGetYaw(1), 0.1);
gv_repfire = 1;
TriggerExecute(gt_Animation, true, false);
while((gv_repfire == 1) && (UnitIsAlive(gv_mainUnit) == true) && (gv_fuel > 0)) {
gv_gas -= 1;
gf_TracelineFlamer(UnitGetPosition(gv_cameraFollow), (WorldHeight(c_heightMapGround, UnitGetPosition(gv_cameraFollow)) + 0.75), 1);
Wait(0.05, c_timeGame); }
gv_repfire = 0;}
if((gv_sniper > 0) && (gv_weapon == 3) && (UnitIsAlive(gv_mainUnit) == true)) {
UnitSetFacing(gv_mainUnit, CameraGetYaw(1), 0.1);
gv_pitch = CameraGetPitch(1);
TriggerExecute(gt_Animation, true, false);
Wait(0.2, c_timeGame);
gv_sniper -= 1;
gf_TracelineSniper(UnitGetPosition(gv_cameraFollow), (WorldHeight(c_heightMapGround, UnitGetPosition(gv_cameraFollow)) + 0.75), 1);
libNtve_gf_AttachModelToUnit(gv_mainUnit, "MarineAttackLaunch", "Weapon");
SoundPlayOnUnit(SoundLink("Ghost_AttackLaunch", -1), PlayerGroupAll(), gv_mainUnit, 0.375, 100.0, 0.0);
CameraSetValue(1, c_cameraValuePitch, CameraGetPitch(1) - 0.30, 0.0, -1, 10);
Wait(0.05, c_timeGame);
CameraSetValue(1, c_cameraValuePitch, CameraGetPitch(1) - 0.30, 0.0, -1, 10);
Wait(0.1, c_timeGame);
libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(gv_mainUnit), c_animNameDefault, "Stand", 0, c_animTimeDefault); }
gv_rapidFire = 0;
if((gv_pitch > 180 && CameraGetPitch(1) > 180) || (gv_pitch < 180 && CameraGetPitch(1) < 180) && ((gv_weapon == 0) || (gv_item == 1) || (gv_item == 3))) {
CameraSetValue(1, c_cameraValuePitch, CameraGetPitch(1) + ((gv_pitch - CameraGetPitch(1)) / 2), 0.0, -1, 10); }
else if((gv_pitch < 180) && (CameraGetPitch(1) > 180) && ((gv_item == 0) || (gv_item == 1) || (gv_item == 3))) {CameraSetValue(1, c_cameraValuePitch, CameraGetPitch(1) + ((gv_pitch + (360 - CameraGetPitch(1))) / 2), 0.0, -1, 10); }
if(gv_item == 1) {Wait(0.5, c_timeGame); }
Wait(0.100, c_timeGame);
libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(gv_mainUnit), c_animNameDefault, "Stand", 0, 0.0);
TriggerEnable(gt_AttackDown, true);
TriggerEnable(gt_KeyDown, true);
TriggerEnable(gt_KeyUp, true);
gv_reloadEnable = 1;}
I have another, perhaps simpler question to add.
In my FPS whenever I try to add a skybox it stays black. Halp.
@Mutacion:
That's alot of code to sort through to find that nasty divide by zero, on the skybox issue, make sure your farclipping on the camera is a really high or it'll clip and you can't see the skybox.
CameraSetValue(1, c_cameraValuePitch, CameraGetPitch(1) + ((gv_pitch - CameraGetPitch(1)) / 2), 0.0, -1, 10); }
else if((gv_pitch < 180) && (CameraGetPitch(1) > 180) && ((gv_item == 0) || (gv_item == 1) || (gv_item == 3))) {CameraSetValue(1, c_cameraValuePitch, CameraGetPitch(1) + ((gv_pitch + (360 - CameraGetPitch(1))) / 2), 0.0, -1, 10); }
CameraGetPitch(1)) / 2 <-- Looks like that might be where it's happening, maybe your pitch is registering at 0?
PointGetX [Value:0]
divide by zero
is what its saying.
Skybox works now but still cannot figure out the problem :S
bumpitiy
bump
Could be source of problem.
lv_leftBottom = lp_pointTwo;} else{ lv_rightBottom = lp_pointTwo; lv_leftBottom = lp_pointOne;} if(PointGetY(lp_pointOne) < PointGetY(lp_pointTwo)) { lv_lowY = lp_pointOne;} else { lv_lowY = lp_pointTwo;}}}
if((PointGetX(lp_pointOne)) >= (PointGetX(lp_pointTwo)) && (PointGetX(lp_pointOne)) >= (PointGetX(lp_pointThree)) && (PointGetX(lp_pointOne)) >= (PointGetX(lp_pointFour))) { lv_highX = lp_pointOne; }
if((PointGetX(lp_pointOne)) <= (PointGetX(lp_pointTwo)) && (PointGetX(lp_pointOne)) <= (PointGetX(lp_pointThree)) && (PointGetX(lp_pointOne)) <= (PointGetX(lp_pointFour))) { lv_lowX = lp_pointOne; }
if((PointGetX(lp_pointTwo)) >= (PointGetX(lp_pointOne)) && (PointGetX(lp_pointTwo)) >= (PointGetX(lp_pointThree)) && (PointGetX(lp_pointTwo)) >= (PointGetX(lp_pointFour))) { lv_highX = lp_pointTwo; }
if((PointGetX(lp_pointTwo)) <= (PointGetX(lp_pointOne)) && (PointGetX(lp_pointTwo)) <= (PointGetX(lp_pointThree)) && (PointGetX(lp_pointTwo)) <= (PointGetX(lp_pointFour))) { lv_lowX = lp_pointTwo; }
if((PointGetX(lp_pointThree)) >= (PointGetX(lp_pointOne)) && (PointGetX(lp_pointThree)) >= (PointGetX(lp_pointTwo)) && (PointGetX(lp_pointThree)) >= (PointGetX(lp_pointFour))) { lv_highX = lp_pointThree; }
if((PointGetX(lp_pointThree)) <= (PointGetX(lp_pointOne)) && (PointGetX(lp_pointThree)) <= (PointGetX(lp_pointTwo)) && (PointGetX(lp_pointThree)) <= (PointGetX(lp_pointFour))) { lv_lowX = lp_pointThree; }
if((PointGetX(lp_pointFour)) >= (PointGetX(lp_pointOne)) && (PointGetX(lp_pointFour)) >= (PointGetX(lp_pointTwo)) && (PointGetX(lp_pointFour)) >= (PointGetX(lp_pointThree))) { lv_highX = lp_pointFour; }
if((PointGetX(lp_pointFour)) <= (PointGetX(lp_pointOne)) && (PointGetX(lp_pointFour)) <= (PointGetX(lp_pointTwo)) && (PointGetX(lp_pointFour)) <= (PointGetX(lp_pointThree))) { lv_lowX = lp_pointFour; } lv_leaningCurve = (PointGetY(lv_lowX) - PointGetY(lv_highX)) / (PointGetX(lv_lowX) - PointGetX(lv_highX)); if(lv_leaningCurve > 0) { lv_curveTop = (PointGetY(lv_leftTop) - PointGetY(lv_leftBottom)) / (PointGetX(lv_leftTop) - PointGetX(lv_leftBottom)); lv_curveBottom = (PointGetY(lv_rightTop) - PointGetY(lv_rightBottom)) / (PointGetX(lv_rightTop) - PointGetX(lv_rightBottom)); lv_lowBottomPoint = lv_rightBottom; lv_lowTopPoint = lv_leftBottom;} if(lv_leaningCurve < 0) { lv_curveTop = (PointGetY(lv_rightBottom) - PointGetY(lv_rightTop)) / (PointGetX(lv_rightBottom) - PointGetX(lv_rightTop)); lv_curveBottom = (PointGetY(lv_leftBottom) - PointGetY(lv_leftTop)) / (PointGetX(lv_leftBottom) - PointGetX(lv_leftTop)); lv_lowBottomPoint = lv_leftTop; lv_lowTopPoint = lv_rightTop;} if(PointGetX(lp_pointCheck) >= PointGetX(lv_leftTop) && PointGetX(lp_pointCheck) <= PointGetX(lv_rightTop)) { lv_curveTop = (PointGetY(lv_leftTop) - PointGetY(lv_rightTop)) / (PointGetX(lv_leftTop) - PointGetX(lv_rightTop)); lv_lowTopPoint = lv_leftTop;} if(PointGetX(lp_pointCheck) >= PointGetX(lv_leftBottom) && PointGetX(lp_pointCheck) <= PointGetX(lv_rightBottom)) { lv_curveBottom = (PointGetY(lv_leftBottom) - PointGetY(lv_rightBottom)) / (PointGetX(lv_leftBottom) - PointGetX(lv_rightBottom)); lv_lowBottomPoint = lv_leftBottom;} if((PointGetY(lp_pointCheck) <= PointGetY(lv_lowTopPoint) + ((PointGetX(lp_pointCheck) - PointGetX(lv_lowTopPoint)) * lv_curveTop)) && (PointGetY(lp_pointCheck) >= PointGetY(lv_lowBottomPoint) + ((PointGetX(lp_pointCheck) - PointGetX(lv_lowBottomPoint)) * lv_curveBottom)) && (PointGetX(lp_pointCheck) <= PointGetX(lv_highX)) && (PointGetX(lp_pointCheck) >= PointGetX(lv_lowX))) { gv_pointInRegion = true;} else{ gv_pointInRegion = false;}
@Mutacion: Go
Honestly now, can YOU look at your posted code and identify ANYTHING?
Please either use code tags to make it easier to read or post the entire map here. It's a complicated system and hard to just overlook to find a nasty division error.
The problem seems to be when shooting any unit I get an error. I'm sorta new to this so I'm having troubles.
Have you changed anything on the map you uploaded? I don't get any division error (I don't get any errors at all), but the screen resets everytime I try to fire.
hmm. I did change one thing but i thought it would help more then harm. heres an earlier map. it only errors when you try to shoot something so ill place a unit near you to shoot. hopefully that works
Oh. I see what you meant now XD. You have to press ctrl to get to the right gun :/. Forgot to mention
Alright, let's see... I've tracked the error down to the gf_Traceline function.
The code is confusing, but could it be that you forgot to set-up all the animals? Because there's no problem shooting at a marine ( if(UnitGetType(lv_closestUnit) == "Marine") ) but all other units cause errors.
The error occurs in this chunk:
I don't see any place it could divide by zero.. maybe it's somewhere in the libNtve.
I simply cannot make more then one shootable unit for some reason. (else if doesnt seem to work.)
bump