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

gsuk

Veteran
Veteran
Joined
Jun 24, 2013
Messages
135
Reaction score
10
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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

It's raining non stop since yesterday. The sound of the rain is so soothing.
I really miss the old style disney animated movies. I guess the last one was The Princess and the Frog from 2009. Now I am trying to collect every single one I can get on BD or DVD.
What I've seen from the MZ tiles looks pretty inconsistent, bleh. Every plant seems to be drawn in a different style.
Recently posted a demo of my game online. Now I have no idea what to do with myself o_O What is the reason for my existence now...
I'm feeling a lot better this week. Some of the rules in my country for isolation changed a little, so I was able to see friends in person again, which was a huge relief. Thanks everyone for giving me some sympathy last week when I was having a rough time!

Forum statistics

Threads
99,287
Messages
963,880
Members
130,899
Latest member
Densuki
Top