Jump to content

How to find the total number of enemies within a certain radius from t


vidalia

Recommended Posts

I need some help in creating a custom spell which has a different effect based on the total number of enemies in the vicinity of the player - if the number of enemies is less than 3 it casts targeted style damage. However if the number of enemies exceeds 3 I want to cast an AOE style damage.

 

To switch the effects i need to find the total number of enemies within a specified radius of the player. Is there a way to do so via papyrus?

 

Any help in this regard would be appreciated.

Link to comment
Share on other sites

You could try the FindRandomActorFromRef function then test its return value for hostility. While keeping track of the form returned so not to count the same actor twice. Depending on the random is not the best idea though.

 

FindClosestReferenceOfAnyTypeInListFromRef sounds promising but i think if you found one then removed it from the form list another of the same base type wouldn't be counted.

 

If you could figure out how to eliminate actors (particular ref not base type) already found FindClosestActorFromRef would be a better choice. Beyond my knowledge though.

 

Until you can get some better help the random actor thing should work but very inefficient.

Link to comment
Share on other sites

You could try the FindRandomActorFromRef function then test its return value for hostility. While keeping track of the form returned so not to count the same actor twice. Depending on the random is not the best idea though.

 

FindClosestReferenceOfAnyTypeInListFromRef sounds promising but i think if you found one then removed it from the form list another of the same base type wouldn't be counted.

 

If you could figure out how to eliminate actors (particular ref not base type) already found FindClosestActorFromRef would be a better choice. Beyond my knowledge though.

 

Until you can get some better help the random actor thing should work but very inefficient.

 

Thanks for the response. However I am currently working on a different approach - taking the idea from here http://www.creationkit.com/Dynamically_Attaching_Scripts. Basically create 2 spells - one that tags and counts enemies via a cloak archetype and another spell for the actual effect. Still working on resolving some issues with the state variables to make these spells work in tandem.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...