GETLOS command CTD issue

Post » Tue Feb 01, 2011 6:55 pm

The following GETLOS command in the following script will CTD EVERY TIME but only when I am using a particular mod that has a LOT of vampires in It.
I am doing some experiments now to try to find out why but has anyone seen this kind of thing happen before?
I do check if the subjects are disabled, so I THINK that s not the issue. If I comment out the GETLOS checks the script no longer CTD!

The CTD happens just at the moment two vampires that were previously disabled are ENABLED in the cell the player is in.
The quest mod I am playing waits for you to pick up a key off a table, as soon as the player picks up the key the vampires are enabled and then WHAM-O the game CTD.

Me is set to container and this script is on a token in the vampires inventory. Me is checked to see if ME is disabled at the top of the script and will issue a RETURN if me is disabled. so that the GETLOS is not run if ME is disabled.

However I have discovered that some commands will still CTD even if a return is issued before the offending command such as a division by zero in the script. I wonder if this is another example of that?



;;;;;;;;;;;;;Vamps can see, smell, and hear youif me == 0set me to GetContainerreturnendifif me != 0if me.getdisabled == 1returnendifendifset smell to -smellif smell < 0me.modav2 sneak smellendifset smell to 0if me.isincombat == 0 && me.GetSleeping != 3 && smelltimer <= 0 && me.GetInSameCell player == 1set smelltimer to 120endif;see you bonus if player moves around and vamp is faceing the player max range of 300 feet.if me.isincombat == 0 && me.getav aggression >= 70 && delaytimer <= 0      if player.iscasting == 1 || player.isattacking == 1 || player.IsDodging == 1 || player.IsMovingForward == 1 || player.IsMovingLeft == 1 || player.IsMovingRight == 1 || player.IsMovingBackward == 1 || player.IsJumping == 1 || player.IsTurningLeft == 1 || player.IsTurningRight == 1         ;if me.getlos player == 1 && smelltimer > 0  <----------------   This will not CTD is this is commented out like so.               if me.getdistance player <= 6000               me.say aDPVampAttack               me.startcombat player               set delaytimer to smelltimer               endif         ;endif     endifendif;smell you bonusif smelltimer > 0;if me.getlos player == 1 <----------------   This will not CTD is this is commented out like so.set smell to 600 - ( ( me.getdistance player / 2 ) );  60 foot max,  each foot takes away 10 points from the smell bonus;endifendifif smell > 0me.modav2 sneak smellendif;;;;timers need to stay here below the restif delaytimer > 0set delaytimer to delaytimer - getsecondspassedendifif smelltimer > 0set smelltimer to smelltimer - getsecondspassedendifif smelltimer <= 0 && onechance == 1set onechance to 0endif



Maybe I am using GETLOS too many times per second here. I have read that that GetLOS command is fast is used on actors and by actors (not objects, if objects then it is a slow command) but it can "get tired" if it is used too often in a short amount of time.
User avatar
cosmo valerga
 
Posts: 3477
Joined: Sat Oct 13, 2007 10:21 am

Post » Tue Feb 01, 2011 6:33 pm

Ok I found a solution to my issue but I am still not actually sure why my solution works.
What I did was put a FRAME delay to prevent the GETLOS command from being used until after 1000 frames after the vampire was enabled.
This completely stopped the CTD.

But why?

I think that I will do this in all my scripts from now on that are in tokens on Actors.
I.E will put a *1000 frame delay (starting after the tokens's container is enabled) on the token script before the script is allowed to run.
oh well..just another one of dozens of Oblivion script oddities I discovered from hours of tenacious trial and error. :wacko:

* may need less I will try 100 and see if that works, may even only take a few frames at the most...


I just updated the Wiki with this warning:

May CTD if called BY an actor that was disabled in the previous frame. A delay of a few frames after the actor is enabled will solve this issue.
User avatar
kasia
 
Posts: 3427
Joined: Sun Jun 18, 2006 10:46 pm

Post » Tue Feb 01, 2011 1:18 pm

Thanks! I wanted to look into using LOS functions lately and I need all the help I can get. I like Actors Can Miss now. Archery gameplay has had a lot of improvements and they really help.
User avatar
Mistress trades Melissa
 
Posts: 3464
Joined: Mon Jun 19, 2006 9:28 pm

Post » Tue Feb 01, 2011 5:18 pm

I am experiencing problems too, with this function and I was actually pulling my hair out of my head until I read this.
I'm using GetLos inside a loop, as the exit condition. Needless to say I've had endless problems, and getLos returning 0 when it should be 1. What was REALLY spooky is that a printc" blah blah "inside the loop made things a lot better, I would say perfect. if I removed or commented the printc line things would go chaotic again WTF ??!?!??!?!?

now I clearly see the reason behind this. Printc is a relatively big function, about 2KB in size and it delays the loop a few frames, enough so getLos will work less often, or with a bigger amount of time between checks.
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Tue Feb 01, 2011 7:34 pm

Isn't it great to find the solution on the forum! :tongue:

Hey thanks for commenting on this thread.

These esoteric issues (I guess I stumble on these often because I often am doing something in an unorthodox way) that get no responses/feedback
make me wonder sometimes if I am just talking to myself. :laugh:

Then its the painful hours and hours of trying random solutions until I find one that works.

When I do get help on the forum on these kind of weired issues I am extremely relieved because who ever it was that
helped me just saved me from staying up all night in trial and error HELL whacking blindly at the issue.

Nice to see I am not the only one with these "spooky bump in the night" problems.


I am experiencing problems too, with this function and I was actually pulling my hair out of my head until I read this.
I'm using GetLos inside a loop, as the exit condition. Needless to say I've had endless problems, and getLos returning 0 when it should be 1. What was REALLY spooky is that a printc" blah blah "inside the loop made things a lot better, I would say perfect. if I removed or commented the printc line things would go chaotic again WTF ??!?!??!?!?

now I clearly see the reason behind this. Printc is a relatively big function, about 2KB in size and it delays the loop a few frames, enough so getLos will work less often, or with a bigger amount of time between checks.

User avatar
Mariaa EM.
 
Posts: 3347
Joined: Fri Aug 10, 2007 3:28 am


Return to IV - Oblivion