I have a custom module I use myself that looks like this
CustomFollow.ashSpoiler
// new module header
import function Follow(this Character*, Character* toFollow, int dist=10, int eagerness=67);
import bool IsFollowing(this Character*);
import Character* Followed(this Character*);
CustomFollow.ascSpoiler
// new module script
bool _isFollowing[];
Character* _following[];
void game_start(){
_isFollowing = new bool[Game.CharacterCount];
_following = new [/spoiler]Character[Game.CharacterCount];
}
function Follow(this Character*, Character* toFollow, int dist, int eagerness){
_following[this.ID] = toFollow;
if(toFollow!=null){
_isFollowing[this.ID] = true;
} else {
_isFollowing[this.ID] = false;
}
this.FollowCharacter(toFollow, dist, eagerness);
}
bool IsFollowing(this Character*){
return _isFollowing[this.ID];
}
Character* Followed(this Character*){
return _following[this.ID];
}
I've been thinking of just having a readonly property for the character named Following, as
Character::get_Following that returns null if no character is being followed or a pointer to the character that this character is following. Does this makes sense? Would this be useful for anyone else?