(Help) Scripts Commands.

● ARCHIVED · READ-ONLY
Started by tiagoms 20 posts View original ↗
  1. Hello everybody.

    I wonder, how can I make a script called for:

    1 - "If the last skill group was performed by Actor X"
    2 - "If the last skill group was performed by Actor X, and Y was the Skill"
    3 - "If the last skill group was performed by Actor X, and Z was element"

    4 - "If the last enemy has attacked the "state ID_X"




    Spoiler
    I do not know
    if this helps, but the IMP1 (User) once helped me with something similar.
    The questions were:Check if the last skill used by everyone from party, was the adeptness 2:

    $game_party.last_skill.object == $data_skills[2]

    Check if the last ability used by anyone of party, was the element 2

    $game_party.last_skill.object.damage.element_id == 2

    And he made ​​the following script:
     

    class Game_Party   attr_reader :last_skill   alias imp_last_skill_setup initialize unless $@  def initialize(*args)    imp_last_skill_setup(*args)    @last_skill = Game_BaseItem.new  end endclass Scene_Skill   alias imp_last_skill_useitem on_item_ok unless $@  def on_item_ok    $game_party.last_skill.object = item    imp_last_skill_useitem  end endclass Scene_Battle   alias imp_last_skill_useitem on_skill_ok unless $@  def on_skill_ok    $game_party.last_skill.object = @skill_window.item    imp_last_skill_useitem  end end
    Does someone could help me?
  2. What does last skill group mean?
  3. Sorry, was in a hurry and used the "Google Translate".

    1 - "If the last skill of the party,  was performed by Actor X"
    2 - "If the last skill of the party, was performed by Actor X, and Y was the Skill"
    3 - "If the last skill of the party, was performed by Actor X, and Z was element"
    4 - "If the last enemy that was attacked, has the "state X" "
  4. Can you provide an example of what you want?
  5. a) I want to create conditions for applying effects or skills through a "common event" during a battle ..

    b )  I want to create a condition on an existing script.


    1 -" If the last skill of the party, was Performed by Actor X "
    2 - "If the last skill of the party, was Performed by Actor X, and Y was the Skill"
    3 - "If the last skill of the party, was Performed by Actor X, and Z was element"
    4 - "If the last enemy que was attacked, has the" state X ""

    1 - With it I can add a special condition to an existing script, so that it has application only in "Actor X"

    2 and 3 - to create special conditions in "common events" during the battle
    4 - Based on the idea of your script: "Effect: State Action." But I want to do for events, placing special conditions (such as switch and variable).

    Reason for "item 4":
    1) I have a very large number of Scripts
    2) There was a compatibility issue with ATB victor engine (But maybe I pessa relief for DoubleX to update a fix)

    How am weak in RGSS3 (and ruby), I will request the codes and noting all I need. Below the codes that are always helpful to me. (to do work for events)

    Spoiler
    == (Igualdade)|| (or, ou lógico)>= (maior ou igual)<= (menor ou igual)! (not, negação)!= (diferente) Se o ator X tiver uma quantidade de mana maior ou igual a Y!($game_actors[X].mp >= Y) Se o ator X tiver uma quantidade de hp menor ou igual a Y!($game_actors[X].hp <= Y) Se o ator X tiver uma quantidade de tp igual a Y!($game_actors[X].tp == 50) Se o ator de id X puder usar a Habilidade de id Y!($game_actors[X].usable?($data_skills[Y])) Se o Actor "X" Esta com estado "Y"!($game_actors[X].state?(Y)) Se o Actor "X" POSSUI habilidade "Z"!($game_actors[X].skill_learn?($data_skills[Z])) Possuir item "Z"!($game_party.has_item?($data_items[Z])) Actor X utiliza arma Y!($game_actors[X].weapons.include?($data_weapons[Y])) Actor X utiliza armadura Y!($game_actors[X].armors.include?($data_armors[Y])) Actor "Z" está na party!($game_party.members.include?($game_actors[Z])) $game_party.members[x].equips.empty?Ah, e usar o $game_actors vai dar problema, use o $game_party.members (masked) Para checar se o ator 1 tem qualquer arma equipada:!$game_actors[1].weapons.empty? Checar se o Ator 1 possui qualquer armadura equipada!$game_actors[1].armor.empty? Checar se o ator 1 tem Arma 2 equipada    $game_actors[1].weapons.include?($data_weapons[2])  Checar se ator 1 tem armadura 2 equipada$game_actors[1].armors.include?($data_armors[2])  Verificar se alguem da party tem a Arma 1 equipada:    $game_party.members.inject(false) { |t, actor| t = t || actor.equips.include?($data_weapons[1]) }  Checar se alguem da party tem armadura 1 equipada:$game_party.members.inject(false) { |t, actor| t = t || actor.equips.include?($data_armors[1]) } Para chegar se a party tem mais de 2 itens do item 1 (incluindo itens equipados):$game_party.item_number($data_armors[1]) > 2 Verificar se a ultima skill usada, pelo actor 1, foi a skill 2:$game_actors[1].last_skill.object == $data_skills[2] Verificar se a ultima skill usada, pelo actor 1, foi do element 2:$game_actors[1].last_skill.object.damage.element_id == 2 To check the last skill used by anyone in the party, you need a little script: http://pastebin.com/raw.php?i=5Ju854n9 Verificar se a ultima habilidade, usada por qualquer pessoa da party, era a habilidad 2:$game_party.last_skill.object == $data_skills[2] Verificar se a ultima habilidade utilizada por qualquer pessoa da party, era do elemento 2$game_party.last_skill.object.damage.element_id == 2 Verificar se quem está na posição “X” da party/battle é o membro de index “Y”$game_party.battle_members[X] == $game_actors[Y]  ------- Actor X usa Skill Y em Posição Z --------@params = [A, B, C, D]self.command_339# A = Se 0, inimigo. Se 1, personagem.# B = Index (inimigo) ou ID (personagem)# C = ID da habilidade# D = Index/ID do destino  mover evento>jogador>chamar script> @move_speed = 3.5

    You could understand me?

    Sorry for my English. I'm trying to improve.
  6. If Hime and Yuki are in the party, and Hime casts Fireball and yuki casts Iceball second, is the ice ball the "last skill of the party"?


    So basically you want to know what was the last skill performed by the entire party
  7. No.

    "If The Last Skill of the party, was realized for Actor X"

    Exemple:
    1 - Yuki and Hime are in the party.
    2 - Hime use "Fire Ball"
    3 - Yuki use "Ice Ball"
    4 - Common Event Check: "The last party member to use a skill = Hime ?"
    5 - No. the last party member, using a skill, was the "Yuki".
    6 - Nothing happens.

    but

    1 - Yuki Hime and are in the party.
    2 - YUKI use "Ice Ball"
    3 - HIME use "Fire Ball"
    4 - Common Event Check: "The last party member to use a skill = Hime ?"
    5 - Yes! the last member of the party, using a skill, was the "HIME".
    6 - HIME use "Fire Explosion" - Forced.


    "game_party.last_action = Game_Actor[Hime]"
    "game_party.last_action = Game_Actor[Hime].data_Skill[X]"
    "game_party.last_action = Game_Actor[Hime].Element[Z]"
    "Last_target.used.State?[X]"

    Could understand now? :unsure:
  8. If you want to script this for yourself, then for 1 to 3 you basically need a script that adds into skill processing and stores the user ID, the skill ID, the target ID and (if an attack) the element ID into preselected variables.


    That is all, because then you could check those variables in eventing with conditional branches in whatever way you want.


    4 (last target has state) will be more tricky, because the target can have several states and events don't have direct access to any arrays (and you'll need an array or something similiar to store an unknown number of state-IDs).
  9. Andar said:
    If you want to script this for yourself, then for 1 to 3 you basically need a script that adds into skill processing and stores the user ID, the skill ID, the target ID and (if an attack) the element ID into preselected variables.

    That is all, because then you could check those variables in eventing with conditional branches in whatever way you want.

    4 (last target has state) will be more tricky, because the target can have several states and events don't have direct access to any arrays (and you'll need an array or something similiar to store an unknown number of state-IDs).
     

    My level Scripter boils down to "look at the instructions, and sometimes add one line" :D
  10. First what I get is, this will get very complicated, because not only we need to check many condition regardings to many things.
    Secondly, It's a lot of things that you want to do regardings that matter.
    Moreover it will get more complicated(or bulky) if the player can change actor in the middle of the game.
    But the most thing that I or most people can't help you is, we don't really know what exactly the conditions you want to check. Let's say :

    but1 - Yuki Hime and are in the party.2 - YUKI use "Ice Ball"3 - HIME use "Fire Ball"4 - Common Event Check: "The last party member to use a skill = Hime ?"5 - Yes! the last member of the party, using a skill, was the "HIME".6 - HIME use "Fire Explosion" - Forced. # <= This I assume stored in common eventHIME use "Fire Explosion" - Forced. I assume that this stored in a common event(which need you to know how to make Hime forced use Fire Explosion skill), then assuming you know how to do it we solve this matter, just calling the common event, But then another little problem, we need to decide which id of the common event that must be called, now I  assume you can assign it yourself for the conditional handler if the condition true. I mean

    If Hime using Fire Exposion in the last turn # <= first conditional > # You need to decide the common event id to be called # If trueelse > # Nothing happens endOkay we can solve it assuming you know how to do this, but here comes the real problem, we don't really know how many conditions you want to check and if we even know how many, WHAT are they one by one? @@a

    I want to create a condition on an existing script. <= What conditions? and how many?
    Just this?

    Spoiler
    1 -" If the last skill of the party, was Performed by Actor X "
    2 - "If the last skill of the party, was Performed by Actor X, and Y was the Skill"
    3 - "If the last skill of the party, was Performed by Actor X, and Z was element"
    4 - "If the last enemy que was attacked, has the" state X ""
    Or there's more? it looks like you want to check many conditions.

    The main real problem is we don't really know how many conditions need to be checked and what are they exactly is -__-a. And there are specific way to check a condition based from different thing. Ex: based from the last subject performing action(Actor/Enemy), or based from the last skill used(skill id), or the element the skill has(element id), or the user state?(not mentioning who is "user"), In fact you need to decide what conditions you want to check, and maybe we could help you after we know what conditions you really want to check. It doesn't really matter how many condition you want to check(but you need to be careful for the conditional hirearchy(that's I believe only you can decide the priority of each condition)).

    The last thing that is really bothered me is this

    Spoiler
    My level Scripter boils down to "look at the instructions, and sometimes add one line" :D
    I don't mean to be an as*****, but I believe you need to know how the conditional branch work(I assume you know right? :) ) Then you need to know in which place the code should be placed, turn_end method in Scene_Battle maybe, aliasing it or overwrite it or another method? This is essential.

    Okay that just my flash thought about this matter, maybe I'm wrong and perhaps the other guys can help you. I'm not yelling at you with that bold sentence, it just for noticement really :) I'm looking forward for this.
    Again I'm sorry I can't help you :( Peace.

     
  11. Ok .. I understand. I call them sorry.

    items for "1, 2 and 3", will formulate a better explanation.



    For item 4, this would be the situation:

    1 - "Actor 1" uses "Ability X" in the "Enemy A"
    2 - "Ability X" call a "common event"
    3 - In the "common event":
       3.1 - Condition: "The Enemy A" (Last target index) has "State ID = 20"?
       3.1.1 - Yes:
       3.1.1.1 - "Actor 2" force action "Skill Y"
       3.1.2 - Not
       3.1.2.1 - Nothing happens

    ps1 - Yes, I do use the "force action" in the event window.

    Spoiler
    What is the importance of this?

    Additional conditions can be incremented.
    example:
    1 - "Actor 1" uses "Ability X" in the "Enemy A"
    2 - "Ability X" call a "common event"
    3 - In the "common event":
       3.1 - Condition: "The Enemy A" (Last target index) has "State ID = 20"?
       3.1.1 - Yes

       3.1.1.1 - Switch 100 = True?:

       3.1.1.1.1 - Yes => "Actor 2" force action "Skill Y"
       3.1.1.1.2 - No => "Actor 3" force action "Skill 9999"

       3.1.2 - Not

       3.1.2.1 - Variable[2] >= 30 ?

       3.1.2.1.1 - Yes => "Actor 1" gain "state 10"

       3.1.2.1.2 - No => Nothing happens

    Again, sorry if I am not getting express myself properly.
    But now, I think I managed to explain the item 4. :D
  12. Okay I got it, I help you with item no 4, hopefully this is what you want if not I'm sorry :)
    This quite complicated if you can't script. So bear with me..

    Assuming we want the performer of Skill X is Eric and if the target has a poison state, Eric will force Action cast Nuclear and blast the whole Enemy, if the enemy didn't poisoned, then Eric will no doing anything(means the battle will go on).

    First what you want to check is 4 main things
    1. The subject(The perfomer right now). Who is he? Actor? Enemy?   if it's enemy then we don't need to go further just skip (Means false)

    2. The Actor. Who is he? Eric? Natalie? Terence?. Let's say we want Eric to do this, so unless it's Eric just skip (Means false)

    3. The Skill. What is the skill? We want it to be Ability X(Skill X right?). If the skill Eric cast is not Skill X, then just skip (Means false)
    4. The target State. What is it? Poison/Silence/or what?  Unless Poison just skip (Means false)

    After those four conditions is true, we want to call a common even(Which you should know how to make a force action right?)
    Blaaaaar!! all is done. So how to do this?
    Here's the code :

     class Scene_Battle < Scene_Base  #--------------------------------------------------------------------------  # * Use Skill/Item  #--------------------------------------------------------------------------  def use_item      item = @subject.current_action.item    @log_window.display_use_item(@subject, item)    @subject.use_item(item)    refresh_status    targets = @subject.current_action.make_targets.compact    show_animation(targets, item.animation_id)    targets.each {|target| item.repeats.times { invoke_item(target, item) } }        # You can alias the code above before this custom_method    custom_method(@subject, item)  end   def custom_method(subject, item)    return unless subject.is_a?(Game_Actor) # Check the actioner is actor/enemy?    return unless subject.id == 1 # Check who is the actor(Eric == 1)    return unless item.id == 127 # Check what skill? (127 == skill X)        # check if the last target inflicted with a state? in this case 2 is poison    # if yes it is poisoned, then   set @temp_common_event = false    @temp_common_event = false if $game_troop.members[subject.last_target_index].state?(2)              if @temp_common_event == false # if this is false        # do this common event        $game_temp.reserve_common_event(1) # id 1        # Just set the common event index 1 to force action.        # The subject is actor, the target is last enemy index                        # set this to true, so prevent endless looping.        @temp_common_event = true      end        end end # End of Scene_BattleOkay I hope you can understand the workflows, I have tested the code above and it works well.
     For the rest condition you want, just make another custom method like my example, but again you need to know what condition should be checked, and how to check them.

    P.S: You might want to aliasing the use_item method, you might want to give a unique method name and instance variable name

     
  13. If I understand correctly, your script already does all the work we talked.
    But I think maybe the solution was simpler.
    See photo.
     

    imagem.JPG
  14. Okay my bold sentence is not I'm yelling at you, it just to emphasize the conclusion :) .

    What is Need Check Last Target Have State Here? I'm a little confused with that..
    How can it check if the last target has a state? for ex :poison 

    It's not that easy to check something like who's the performer and who's the target in battle via script call in conditional branch(especially we won't know who is the last target, because this can be dynamic B) ). If it can be done from that damn(yeah it sucks) little script box, I won't make the script above.
    Okay I admit I'm not a good eventer, but I can't see if that common event will take effect(or even do a check upon the last target state). So how do you do that? I mean this should be a code right? Need Check Last Target Have State Here  <= This should be a code right? Not mentioned the nested conditional branch where you might fall into a pitfall.

    Script call usually used for a method defined in Game Interpreter, or used to call a global variable(which can be accessed through anywhere and anytime) then we can use the methods it has. Then the problem is the subject who perform the skill, who is he/she? How can we get him/her? Especially we need to be sure that he/she is the one who use(or have) the skill X upon the enemy(like you want). Needless to say we still need to get the target(enemy), also how do we know if it(the enemy and of course the last target) has the state we want to check? Does those many things we need to get(so we can perform a check), can be acquired from a simple global variable? especially with the little damn script box?(even for the full version, it's still small)

    I don't think we can. I don't know if it can. But I don't want to waste my time to find it via that method. So I find it's alot easier to make a custom method and just add it in the last line of use_item method. You can make many custom method defining what condition you want to check, then you don't need to be confused again with switch variable and common event. I mean after you made the code, that is done. You don't need to be confused with any other else(asumming your code is working nice).

    This is why I"m a little bothered with this :|

    Spoiler
    My level Scripter boils down to "look at the instructions, and sometimes add one line" :D
    Again I'm sorry I didn't mean to offend you, but really, you're not messing with simple section like window section, you're messing with scene battle that is need a basic(or intermediate) scripting knowledge :) .
    If you're insist not touching script editor then I'm not the person who can help you, I;\'m sorry :(
     
  15. I thought it was possible to check if the last target has attacked has the "state X."
    because by events is possible check if an enemy of "position Y" has the "state X.

    But thanks for listening.

    ************ EDIT *************

    But there would be a command to check:
    "If the last target attacked was the enemy of the X position"?

    $Last_Target_Index = Enemy.Position(X)
  16. The built in check for this purpose is pretty much useless, because it checks static enemy position IDs only.

    It is good for a boss fight, where you know that the enemy on position XY will be the enemy you set it to be there.

    But for a random encounter, the enemies will change, their positions will change too.

    That script what BoluBolu wrote looks interesting. 

    Ima save it for future usage. :)
  17. Sixth said:
    The built in check for this purpose is pretty much useless, because it checks static enemy position IDs only.

    It is good for a boss fight, where you know that the enemy on position XY will be the enemy you set it to be there.

    But for a random encounter, the enemies will change, their positions will change too.

    That script what BoluBolu wrote looks interesting. 

    Ima save it for future usage. :)
    But it is possible to verify if: "Last Target Index" = "Position 1"?

    This way I can develop conditions in conditions (events) to arrive at my objective.

    $game_battle.game_enemy.last_target_index == position 1
  18. Okay before going any further, brace yourself because this could become more like a lecture  than a solution  So if you didn't like to read a long explanation then forget this :)
     

     But it is possible to verify if: "Last Target Index" = "Position 1"?
    The answer is somewhat yes.. actually not really yes. Let me explain :
    You can acquire the enemy index position with this
       $game_troop.members[the index]
    the index = the index is not index in Enemies Database, it's the index in enemy troop position(when you assign them in troop database) and it's in reverse order(if I remember correctly). So the answer for this is yes. But it's become NO when you asking for Last Target Index Why? Because we need to know who was attacking that enemy(or who was attacking this => $game_troop.members[the index]. In this case we didn't know who is the subject. 
    So this $game_troop.members[the index] is actually not needed(useless if I can say) if you want to do this condition type check. To see an example why this cannot be simply done is, try open conditional branch event command, go for enemy and look at the option, is there any option for us to choose last target index? NO because it's not messing with subject or any related to that, it just giving you enemy not target, and what we want is last TARGET index. It's different with Force Action command that has last target index for the target option, why? Because Force Action is processed through a method in Scene_Battle called process event further inside the code, there's process forced action, It can be done because to acquire the performer it's easy, it just need @subject which is the instance variable in this class. But we are not in Scene_Battle, we are in conditional branch event command, so there's no option to call @subject or the computer will yelling undefined method or else.

    If in your game you have fixed actor, say you use Eric, Natalie, Terence, Rick and their formation will not changing even once and for the entire game

    We can use this assuming the actor index formation will never change(this way you know who has the skill X and etc)
    $game_party.battle_members[the index]
    the index = the index of actor, it's number from 0 - 3 Assuming your battle members onoly consist 4 actors.
    Oh yeah I forgot to mention, the index of actor and enemy is started from 0, not from 1. So For ex Eric is the first actor, then it means his index is 0.

    Now we can aquire the last target index with this syntax : game_troop.members[subject.last_target_index]

    subject can be changed to $game_party.battle_members[the index]

    So for the first actor last target index will be game_troop.members[$game_party.battle_members[0].last_target_index]
    This will give you the enemy object, and if you want to check if it has a particular state, let's say poison, you can add this method #state?(poison id)
    Resulting in this : game_troop.members[$game_party.battle_members[0].last_target_index].state?(poison id)

    Regardless from the functionality of that code, I still doubt it can be used, why? The script call box for conditional branch is very small and it's only fit one line.
    So the conclusion is, doing this in eventing will get really complicated. Not only how to acquire what we need to check something(not mention how to check it), we also need to deal with more space to write our code which in this case this cannot be tolerated anymore.
    As you can see this : game_troop.members[$game_party.battle_members[0].last_target_index].state?(poison id) needed to check if enemy has poison state or not, and this can't fit in script box @@a. So yeah this is not an option to. So again if you're insist to not touching Script Editor this task is simply impossible to be done.

    EDIT : Oh yeah, this can be somewhat break the topic of this thread(hope not), and mod will screaming at us. So brace ourselves if that's happen :)

     
  19. Thank you very much "BoluBolu". Thanks to you, the question has been resolved 4.

    if $game_party.battle_members[0] == $game_actors[1]

    Yes = $game_troop.members[$game_party.battle_members[0].last_target_index].state?(20)

    No = if $game_party.battle_members[1] == $game_actors[1]

            Yes = $game_troop.members[$game_party.battle_members[1].last_target_index].state?(20)

            No = if $game_party.battle_members[2] == $game_actors[1]

                     Yes = $game_troop.members[$game_party.battle_members[2].last_target_index].state?(20)

                     No = if $game_party.battle_members[3] == $game_actors[1]

                             Yes = $game_troop.members[$game_party.battle_members[3].last_target_index].state?(20)

                             no = nothing

    =)

    *** EDIT ***

    ps - thank you for your explanations, they are also very useful :)
  20. Err actually I can't understand your code above ^_^", but if that's solved your problem then it's great =)  
    Never mind, I just want to help :)