Attack from an enemy to a actor as condinitional branch - Printable Version +- Save-Point (https://www.save-point.org) +-- Forum: Games Development (https://www.save-point.org/forum-4.html) +--- Forum: Code Support (https://www.save-point.org/forum-20.html) +--- Thread: Attack from an enemy to a actor as condinitional branch (/thread-5187.html) |
Attack from an enemy to a actor as condinitional branch - Djigit - 06-30-2014 First of all: Hi... Im new here in this forum and just signed in because i've a huge problem. Im using the rpg xp maker since 6 years but im a total noob in scripting. I need a script query, so when a enemy troop with the id 1 attacks the actor with the id 17. I need this as a script in the condinational branch, so I can use it as an trigger in a battle. What I mean is this: If monster 1 from the enemy troops (there can only be 8 enemies) attacks actor with the id 17 or uses a phy, skill or a magical skill against the actor with he id 17. I need this as an script in the condinational branch. I tried this one: Code: $game_troop.enemies[1].action.target_$game_actors[17] Very important: The trigger should also happen when the user is attacked with magical, physicla skill or just normal attacks. but it doesnt work at all.. I made this trigger, so that if this is triggered the actor 17 will use the skill fire. I only get a nomethoderror. Undefined method action for nil class Without this, I cant continue my projet... Thanks in advance RE: Attack from an enemy to a actor as condinitional branch - KasperKalamity - 07-01-2014 have you tried using common events? RE: Attack from an enemy to a actor as condinitional branch - DerVVulfman - 07-02-2014 The enemy troop is a whole group of enemies, be it 1 or 8. Are you looking for a way to make a switch be turned on if player ID 17 is attacked by any enemy from Troop #1 ? Sorta like? Code: if $game_troop.id == 1 #There's no such ID right now. This code is clearly conjecture, but is this what you're striving for? You cannot just make it in the script call of the Troops section. More likely, you'd need to add this into the Game_Battler class as well as a simple addition to the Scene_Battle system. RE: Attack from an enemy to a actor as condinitional branch - MechanicalPen - 07-02-2014 He's clearly asking for a script that returns true when the first enemy of a troop attacks Actor 17. He's ALSO asking for it to be a "battle trigger" in an event, which I am pretty sure is not possible. Events can run at the start of a turn, or skills can call them. If you can make it work, its Code: actorAt = -1 good luck! RE: Attack from an enemy to a actor as condinitional branch - Djigit - 07-04-2014 Hello guys. I dont know if you didint understand me correctly. I think mechinicalpen understood me. Im a asking for a little script code which can be used as a trigger in a battle. By tirgger I mean in a condinational branch. Lets take another example: I want that if the enemy, lets say enemy troop number 1, (it must be on if the 8 troops, this is very important) attacks the hero with the id 17. I want this as a little code in a condiantional branch. So I can use this as a trigger. With this little code I want to make a counterattack system. This is what I want to make: I want to make a counterattack system. I cant just use a script because my battle system is different than the normal one. I just cant simply take it it would not work. Im using the atoa acbs battle system. Normally theres a counterattack script from the very beggining but it doesnt work. So I need take another way.... by condinational branch. RE: Attack from an enemy to a actor as condinitional branch - MechanicalPen - 07-04-2014 You'd be better off scripting it into your battle system. If it is different then you should post it, and maybe one of us could alter it. RE: Attack from an enemy to a actor as condinitional branch - DerVVulfman - 07-05-2014 The problem with a conditional branch is that you typically have no way to determine if an enemy had attacked the hero. Or not without some scripting help as we both had mentioned... However, you are using ATOA's system. Is your edit able to use his counter attack system? If so, maybe something can be altered to look like this if you were interested... Setting actor 17 to counter attack if ... any attack... user #1 ... ... return with a healing skill ... or ... Code: Counter_Setting['Actor'][17] = { {'type' => 4 'condition' => 'user.id(1)'} =>{'type' => 1, 'id' => 1, 'cost' => true} } or Setting actor 17 to counter attack if ... any attack... user #1 ... ... return with turning Switch 15 on. Code: Counter_Setting['Actor'][17] = { {'type' => 4 'condition' => 'user.id(1)'} =>{ $game_switches[15] = true } } That doesn't mean that the 'user.id(1)' in this code will work., nor do I have anything that checks for any particular troop ID (if desired), That may take some more time. I never really used Atoa's system, Does this sound fairly satisfactory? RE: Attack from an enemy to a actor as condinitional branch - Djigit - 07-05-2014 Hm I need to test it, but Im 100% sure that it wont work becasue the code itself is bugged as I noticed. I tried to modify the script and edit it but it wont work. I only get errors. Cant you download the demo I put below on the beggining. Can you try to put the script above and check wheither it works. this is the easies way to configurate it Counter_Setting['State'][91] = { {'type' => 4} => {'type' => 0, 'wait' => false}, # Counter any physical attack and target waits until action ends. #{'type' => 2, 'condition' => 'target.in_danger?'} => {'type' => 2, 'id' => 1, 'cost' => true}, # Counter against magic using potions if the battler hp is in danger # {'type' => 4, 'condition' => 'damage.numeric? and damage > 1000'} => {'type' => 1, 'id' => 1, 'cost' => true}, # Counter any attack that can deal more than 1000 damage using Cure in him/herself } if an enemy or an actor is inflicted with the status with the 91 he will counterattack if hes attacked no matter skill or just simple attack. this is why I want to make a counterscript via condinational branch because the script doesnt work. i tried this code: $game_troop.enemies[1].current_action.target_index == $game_actors[17] as an condinational branch But I get undefined method errors of currenct_action Cant you at least define the method currenct_action and the target_index for me. I think this would really help me alot and maybe solve my problem |