Jump to content

[LE] Trying to make a system can randomly pick followers


Recommended Posts

Now I am trying to make a system that can randomly pick followers from a follower pool. I used to think I can do it with a separate indoor cell (to make it become followers pool) and FindRandomActorFromRef function. But then I realized that this actually won't work because the function can't work correctly when the player isn't actually in that room. So I am getting stuck now. Guys, do you have any idea that how to make a follower pool (I want to make this system can add followers from different mods), I will really appricate if u guys can give me some hints. Thank you.

Link to comment
Share on other sites

The " FindRandomActorFromRef " works as long as the caller is in that cell, you can bypass the dependence of the player presence in the cell by doing the following, example : attaching the script to an xMarker, and the xMarker will run your script.
Game.FindRandomActorFromRef(Self, 5.0).
" Self " will always target/point to the REF that the script is attach to (living inside it).
A more reliable way to do this is to use a random number generator and pre assign a number to each follower.
int Function RandomInt(int aiMin = 0, int aiMax = 100) native global

 

So this way you have detach the dependence of the player presence in the cell .

Edited by maxarturo
Link to comment
Share on other sites

Now I am trying to make a system that can randomly pick followers from a follower pool. I used to think I can do it with a separate indoor cell (to make it become followers pool) and FindRandomActorFromRef function. But then I realized that this actually won't work because the function can't work correctly when the player isn't actually in that room. So I am getting stuck now. Guys, do you have any idea that how to make a follower pool (I want to make this system can add followers from different mods), I will really appricate if u guys can give me some hints. Thank you.

Thanks for ur suggestions, that is actually a way to realize the system. But I am a little bit confusing about how to make an object call a script itself.

Link to comment
Share on other sites

"But I am a little bit confusing about how to make an object call a script itself."

I'm guessing that you mean, how the object will do what / when you want it to do it.
This is actually the easiest part of what i'm going to suggest (since i don't know what your actual idea is, i'm making up my own idea based on what you've written).
Let's say you will create a summon spell that you want to spawn you a random follower, your "Magic effect" script should have this line :
xMarkerActivator.Activate(self)
that uppon casting the spell will activate an xMarkerActivator in which your spawn follower script will be living and will have the " FindRandomActorFromRef " or "RandomInt" that will choose a random follower and then move him to your location.
* Also your "Magic Effect" script's properties should define the xMarkerActivator and Link Ref its property to that xMarkerActivator.
ObjectReference Property xMarkerActivator auto
{Activates xMarkerActivator}
The "xMarkerActivator" upon getting activated will do the rest and the actual job of your "Summom Random Follower Spell".
This actually requires two scripts, one for your Magic Effect and one for the xMarkerActivator.
I hope that this helps you.
Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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