gulogulo Posted June 19, 2012 Share Posted June 19, 2012 Hi again, Im currently working on stremlining my mod Nature of the beast. It covers several biological ablities that require to detect creatures. The smell ability I am concerned right now requires detection of actors in the appropriate direction towards the player. For example if the wind blows from the north you can detect only actors north of the player no matter in which direction the player is heading. Everything works but there is a problem. I check whether current actor is in appropriate direction towards the player via scripts and the script system works the way it works. In short, the smell ability in my mod in exterior places works too slow. It must determine whether 20-40 actors are in appropriate position and it requires fairly sophisticated code (the rest of abilities in my mod work fine). Now I want to change that. I want to determine the general border coordinates via script and check every actor in current distance via condition functions in CK (not in papyrus). This system works when I try to check whether the actor is in appropriate distance from the player. In case of checking direction there is a problem. GetHeadingAngle which I try to use doesnt seem to work the way I supposed. I tried to use GetHeadingAngle, set it to run on subject, set target as player and switched the swap target and subject option. I used the function 2 times simultanously. First instance I set to <=-25 and the second instance I set to >=25. In this way I tried to check whether I will detect actor Im currently facing. The result was weird. In interiors I was able to detect all actors no matter their position when I faced the north-north east direction.When I was facing any other direction I couldnt detect any actor no matter its position. I was testing it in Riverwoods inn and in Riverwoods trader. In exterior area (Skyrim) I wasnt able to detect any actor. Anyone has any experience with using GetHeadingAngle function in CK? Anyone tried to use GetRelativeAngle function in CK? Please share with me your opinion. Link to comment Share on other sites More sharing options...
gulogulo Posted June 19, 2012 Author Share Posted June 19, 2012 Bump Link to comment Share on other sites More sharing options...
fg109 Posted June 19, 2012 Share Posted June 19, 2012 I only have experience using [urlhttp://www.creationkit.com/GetHeadingAngle_-_ObjectReference]GetHeadingAngle[/url], not GetHeadingAngle, but from the descriptions, they work the same. I don't know what the problem is exactly, since I don't know how you set up your conditions. Let's assume that you have a cloak ability to apply a spell to anything within a whole cell (such as this example). So I'll give you a few examples of some conditions and explain what happens. S GetHeadingAngle [TARGET] >= 25 In the case of magic effects, the "subject" is the actor that was hit by the spell or magic effect. Target is the one who cast the spell. Turning to the right means turning in a positive direction, turning to the left means turning in a negative direction. So that means the condition is saying, "Only apply this magic effect on the spell target if the spell caster is to the right of the target, but not so close that the target can see the caster with a 25 degree turn." S GetHeadingAngle [TARGET] < 25 The condition is saying, "Only apply this magic effect on the spell target if the spell caster is less than a 25 degree angle from the target's right. So if the caster is in front or to the left of the target, apply the magic effect. If the target can only see the caster after turning 25 degrees or more to the right, don't apply the magic effect." S GetHeadingAngle [TARGET] < 25 AND S GetHeadingAngle [TARGET] > -25 The condition is saying, "Only apply this magic effect on the spell target if the spell caster is less than a 25 degree angle left or right of the spell target. In other words, apply this magic effect only if the spell target is facing in the general direction of the caster." If you had the same conditions as above, but you checked "Switch Subject and Target" (or whatever that checkbox is called), then the condition is saying, "Only apply this magic effect on the spell target if the spell target is less than a 25 degree angle left or right of the spell caster. In other words, apply this magic effect only if the spell caster is facing in the general direction of the target." Link to comment Share on other sites More sharing options...
gulogulo Posted June 20, 2012 Author Share Posted June 20, 2012 @fg109 Thank you for the advice. I did previoulsy something similar to the tutorial you have provided, but now basing on your text I simply didnt fill the Target section in the condition and it did the trick! Previously I set it to player. In short success!!! Once again thank you! This should considerably improve the performance of my mod. Link to comment Share on other sites More sharing options...
Recommended Posts