Short script won't work as intended (problem with getangle)

Post » Thu Sep 06, 2012 7:07 am

Here's the script:

if(PGArrow07Skull1Ref.getangle z == 90 && PGArrow07Skull2Ref.getangle z == 180 && PGArrow07Skull3Ref.getangle z == 225)  if(PGArrow07Switch.getdisabled == 0)   PGArrow07Switch.disable   PGArrow07Switch1.setpos z, 24   PGArrow07Enemy1.enable  endifelse  if(PGArrow07Switch.getdisabled == 1)   PGArrow07Switch.enable   PGArrow07Switch1.setpos z, -100  endifendif

Now, the problem is that I can't seem to get the angle right. Even though I checked the angles of these three activators three times in game (via console) it still doesn't work. Instead, when I try disabling the switch the script reenables it, as if the activators weren't in the correct position. Is get angle imprecise? Should I use a scope of values (e.g. 80 < getangle z < 100)?

The idea is that once the activators are in the correct position you disable the switch (that does nothing), move the switch that lowers the gate in it's place and enable the enemy behind the gate. This is in a quest script, btw. I've made sure the angles are correct (90.00, 180.00, 225.00)
User avatar
Bedford White
 
Posts: 3307
Joined: Tue Jun 12, 2007 2:09 am

Post » Thu Sep 06, 2012 12:41 am

We don't know how the z-angles for those three skulls are being set. You are comparing three floats to a precise number. So, unless you are setting the z-angles to those exact numbers, and nothing else is possibly changing them, they won't match up (90.0000 != 90.0001).
User avatar
Sami Blackburn
 
Posts: 3306
Joined: Tue Jun 20, 2006 7:56 am

Post » Thu Sep 06, 2012 12:19 pm

Adding a slight scope solved the problem. Sorry for posting without thoroughly testing.
User avatar
Sara Lee
 
Posts: 3448
Joined: Mon Sep 25, 2006 1:40 pm


Return to IV - Oblivion