The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Event Systems => Topic started by: shintashi on March 20, 2011, 03:04:47 PM

Title: [XP] Force Action target Problems?
Post by: shintashi on March 20, 2011, 03:04:47 PM
I've found you can do some pretty cool stuff with Common Events in Battle, but the Targeting systems are kind of screwy, because it doesn't matter who triggers the common event, and you can't target actors or enemies for the effect.

For example, it will always be actor #1 (or whatever you originally pick), and either random enemy or enemy #1 (or whatever you pick).

I would like to set up a common event that when activated in battle by a particular actor, considers them the 'actor', and then options for target, either actors, or enemies, comes up. Is there a snippet or something to resolve this targeting issue?
Title: Re: Force Action target Problems?
Post by: shintashi on March 21, 2011, 02:02:23 AM
here's a workaround I developed recently, at least for the actors

Make four versions of this:
Code: [Select]
a =  $data_system.party_members[0]
b = $storc
if a == b
$game_variables[99] = 1
end

so you have

Code: [Select]
a =  $data_system.party_members[3]
b = $storc
if a == b
$game_variables[99] = 4
end

at the bottom of the list. (i.e. members[0-3] = variable 1-4).

Now $storc is just a global variable I put in the script editor. I put it here:

Code: [Select]
        if @item.common_event_id > 0
 $storc = @active_battler.id

but the important part is "$storc = @active_battler.id" wherever active battler is being set.


This still doesn't solve the targeting enemies problem and kind of sucks, but it works for what it does.
Title: Re: Force Action target Problems?
Post by: cozziekuns on March 21, 2011, 02:35:20 AM
Huh, that snippet looks a bit odd, such as using a global variable when you could be using a regular variable, and I can't seem to get it to work. Do you mind sharing the whole Scene_Item?

As for the target enemies issue, I can't see what's wrong with making "Last Target" your target. Is there something else you want to accomplish?
Title: Re: Force Action target Problems?
Post by: shintashi on March 21, 2011, 03:59:06 AM
Huh, that snippet looks a bit odd, such as using a global variable when you could be using a regular variable, and I can't seem to get it to work. Do you mind sharing the whole Scene_Item?

As for the target enemies issue, I can't see what's wrong with making "Last Target" your target. Is there something else you want to accomplish?

I was originally testing it for my "use weapon or shield" option I'm working on, but I later added it to some other areas, including regular items and skills. You have to use it during combat, and you need a different global variable for each of the three (well not really but it helps keep them sorted easier, because you only need 3 instances).

Here's an example of one used in a skill, you should be able to find these lines from their surrounding context. They occur between lines 1000 and 3500 in section III of my SDK.
in your script editor:

Quote from: script editor
        # If common event ID is valid
        if @skill.common_event_id > 0
          # Common event call reservation
          $storb = @active_battler.id
          $game_temp.common_event_id = @skill.common_event_id
          # Play use skill SE
---------------
      # If command event ID is valid
        if @skill.common_event_id > 0
          # Command event call reservation
          $storb = @active_battler.id
          $game_temp.common_event_id = @skill.common_event_id
          # Switch to map screen
---------------------
    # Set animation ID
    @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    # Set command event ID
    $storb = @active_battler.id
    @common_event_id = @skill.common_event_id
    # Set target battlers
    set_target_battlers(@skill.scope)
    # Apply skill effect
 
Then in a common event activated by a skill (that's important, skill and item common events aren't processed the same) Try something like this (warning, big image):

Spoiler for:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg717.imageshack.us%2Fimg717%2F2048%2Fskillfxpt1.jpg&hash=209b5f8167e7bfeaaa80035488a5975f885c4ff5)

and where it says 'extra attack p1...p4'

put this

Quote from: extra attack p1
Text: \tc \w[15]Extra Attack!
Force Action: Actor No. 1, Attack, Random, Execute Now

Quote from: extra attack p2
Text: \tc \w[15]Extra Attack!
Force Action: Actor No. 2, Attack, Random, Execute Now

Quote from: extra attack p3
Text: \tc \w[15]Extra Attack!
Force Action: Actor No. 3, Attack, Random, Execute Now

Quote from: extra attack p4
Text: \tc \w[15]Extra Attack!
Force Action: Actor No. 4, Attack, Random, Execute Now