scripting to decide behavior of enemies based on levels of party members

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
144
Reaction score
11
First Language
English
Primarily Uses
RMVXA
I'm using a script which makes enemies attack you if they are stronger than you (based on their level).
It works fine when there is only one party member, but let's say you are level 10 and you recruit someone who is level 3. There are enemies that will not attack you if you are alone (because you are level 10 and they are, say, level 7), but I want to make it so they will attack my companion if they are weak.

In the script, @epassive = false if @enemy.enemy_id == 14 && $game_party.leader.level < 8 means that any enemy with ID 14 will attack you if you are lower than level 8. This works fine.
I added this line to the script: @epassive = false if @enemy.enemy_id == 14 && $game_party.members[1].level < 8 so that if my companion is lower than level 8 then the enemy attacks. This also works fine but only when I have a companion. If I venture out alone I get a NoMethodError message, presumably because the party member doesn't exist.

Is there an easy solution to this so that the enemy will attack only if one or more party members are below the specified level?

This is part of the Falcao ABS script, to which I added Hime's enemy levels script, which allows you to assign enemy levels to events on the map. Falcoa's ABS supports followers and therefore should allow enemies to aggro them if they are too weak, but I don't know enough about scripting to do this. Hopefully there's a simple thing I can do with the above commands to make this work.

Thanks for any help. :D
 

Latest Threads

Latest Posts

Latest Profile Posts

Starting work on some stuff for the community. Hopefully it will be fun, and useful to somebody.
Searching what to play in my dead times, the nostalgia hit me hard and ended downloading the Patapon trilogy, hope I can avenge my child self and beating all the games hahaha
Finished the frontier and...I apologize to anyone who saw the trailer I posted and actually tried it. Technical marvel, crazy disjointed fetish story hidden inside a cheap milsim skin that has no idea what it's trying to be except sanctimonious and failing at even that. As much as I hate fallout 4's story, even it was better. I guess there just won't be another non-parody fallout after all.
Anyone else having trouble posting in the forum? I have no reply box in posts or in messages. This is the only place I can type. @Archeia?

Forum statistics

Threads
107,763
Messages
1,031,989
Members
139,911
Latest member
Katara
Top