The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: trickster on July 28, 2005, 04:46:29 AM

Title: Various Battle commands & Request a Battle Command
Post by: trickster on July 28, 2005, 04:46:29 AM
note: You need to have added Individual Battle Commands
 
Name: Smoke Screen
Description: Defends but also when attacked the evasion rating is increased by 30%

Add this method to Game_Battler 1
Code: [Select]

def smoke?
return (@current_action.kind == 0 and @current_action.basic == 5)
end


class Game_Battler 3 method attack_effect(attacker)
Replace
Code: [Select]

eva = 8 * self.agi / attacker.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)

with

if self.smoke?
eva = 8 * self.agi / attacker.dex + (self.eva + 13 / 10)
else
eva = 8 * self.agi / attacker.dex + self.eva
end
hit = self.damage < 0 ? 100 : 100 - eva
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)

in method skiil_effect (same class) replace
Code: [Select]

eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)

with

if self.smoke?
eva = 8 * self.agi / user.dex + (self.eva * 13 / 10)
else
eva = 8 * self.agi / user.dex + self.eva
end
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)

class Scene_Battle 3 method update_phase3_basic_command add after start_item_select
Code: [Select]

when "Smoke Screen"
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_acton.basic = 5
#[b]delete the next command and uncomment the next for an attack[/b]
#[b]uncomment the next command and delete the next for a do nothing action [/b]
#phase3_next_actor  
#atart_enemy_select

If you choose the person using this command to attack then in method end_enemy_select change if x == "Attack" to if x == "Attack" or x == "Smoke Screen"


ALMOST DONE Class scene_battle 4 method make basic_action_result
for people who want the battler to attack
Code: [Select]

make a copy of the if block that starts and end like this
if @active_battler.current_action.basic == 0
@animation1_id = @active_battler.animation1_id
[b] ... [/b]
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
paste the block so you'll have two
edit if @active_battler.current_action.basic == 0 to this
if @active_battler.current_action.basic == 5
remover the if block
if @active_battler.is_a?(Game_Enemy) all the way to the lines

end
end


for people who want this command to do nothing put increase evade
make a copy of the if block that starts and end like this
Code: [Select]

if @active_battler.current_action.basic == 1
@help_window.set_text($data_system.words.guard, 1)
return
end

edit if @active_battler.current_action.basic == 1
to if @active_battler.current_action.basic == 5

OPTIONAL
edit @help_window.set_text($data_system.words.guard, 1)
to @help_window.set_text("WHAT TO SAY WHEN USING", 1)

OPTIONAL (ICING ON THE CAKE)add
@active_battler.animation_id = WHATEVER ANIMATION you want to see
after @help_window.set_text


LAST PART (still working on this part) all of the other stuff was easy, but this is the hard part
actually implementing the battle command within your game many ways

1) create armor that you want the effect to be added to in a turn 0 battle event make a conditional branch if the character has that armor equipped then call script with this in it $game_actors[THE PERSON WITH IT].battle_commands.push("Smoke Screen") DO a test battle with one of the battlers with the equipment and see if the new command was added
If it wasn't then create a status effect with a rating of 0 (It will not show up) and set the armor to auto inflict the status effect now change the condition branch to say if the battler has this status effect then call script $game_actors[THE PERSON WITH IT].battle_commands.push("Smoke Screen")

this method works but you have to put this battle event in every battle  currently working on a script for linking battle commands to armor and weapons

2) use a parallel process common event to add the effect

EDIT
3) In the beginning of the game call a script with this in it
Code: [Select]

temp = $game_actors[THE PERSON WITH IT].battle_commands + ["Smoke Screen"]
$game_actors[THE PERSON WITH IT].battle_commands = temp


or

Code: [Select]

temp = $game_actors[THE PERSON WITH IT].battle_commands << "Smoke Screen"
$game_actors[THE PERSON WITH IT].battle_commands = temp
Title: Various Battle commands & Request a Battle Command
Post by: Lord Dante on July 28, 2005, 05:48:12 AM
what excatly do these do?
Title: Various Battle commands & Request a Battle Command
Post by: trickster on July 28, 2005, 05:58:49 AM
Quote from: Lord Dante
what excatly do these do?

In a battle you see the commands "Attack" "Skills" "Defend" and "Item" the two scripts above are for the code to make the database recognize two new commands and when it's selected in battle it executes a different effect like evade a attack, counterattacking, and other stuff.
Title: One more
Post by: trickster on July 28, 2005, 12:57:40 PM
Name: Magic Defense (EDIT)
Description: This defense only works on spells divides the damage by 3 and heals sp according to the sp cost of the spell

0) Add this variable to Game_Temp
  attr_accessor :magicaldefend #true if magical defending
  @magicaldefend = false


1) Game_Battler 1 add these variables
Code: [Select]

  attr_accessor :second_damage
  attr_accessor :second_critical
  attr_accessor :second_damage_pop
    @second_damage_pop = false
    @second_damage = nil
    @second_critical = false


and add anywhere

Code: [Select]

def mg_defense?
return (@current_action.kind == 0 and @current_action.basic == 7)
end


2)class Game_Battler 3 method skill_effect
Add after the self.guarding? if block
Code: [Select]

       if self.mgdefense?
        $game_temp.magicaldefend = true
        self.damage /= 3
        end

3)class Scene_Battle 3 method update_phase3_basic_command add in appropiate place
Code: [Select]

when "Magic Defense"
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_acton.basic = 7

4) OPTIONAL
Code: [Select]

if @active_battler.current_action.basic == 7
@help_window.set_text("The text goes here", 1)
return
end


5) add this in update_phase4_step5 after the for block
Code: [Select]

      if $game_temp.magicaldefend
        $game_temp.targetsaver.second_damage_pop = true
        $game_temp.targetsaver.second_restorative = true
          $game_temp.targetsaver.second_damage = -@skill.sp_cost
          $game_temp.targetsaver.sp -= $game_temp.targetsaver.second_damage
        end
          $game_temp.magicaldefend = false


6) add this in when 3 of the Game Enemy portion of set target battlers (scope)
Code: [Select]

$game_temp.targetsaver =  @target_battlers


7) Last step in Color_Fix add after the first damage pop
Code: [Select]

if @battler.second_damage_pop
damage(@battler.second_damage, @battler.second_critical, @battler.second_restorative)
@battler.second_damage = nil
@battler.second_critical = false
@battler.second_damage_pop = false
@battler.second_restorative = false
end

note: the healed sp in this script and the regen script are not shown I have a fix for this I'll post it later
Title: Various Battle commands & Request a Battle Command
Post by: trickster on July 28, 2005, 01:12:02 PM
name: Regenerate EDIT
description: when attacked heals a portion of the damage taken the lesser the hp you have the more you'll recover

0) Add the magical defense command first

1) Game_Battler 1
Code: [Select]

def regenerate?
return (@current_action.kind == 0 and @current_action.basic == 8)
end


2)class Game_Battler 3 method skill_effect and attack_effect
Find self.hp -= self.damage in both of the methods and add this before it
Code: [Select]

        if self.regenerate?
          $game_temp.regenerate = true
        end


3)class Scene_Battle 3 method update_phase3_basic_command add in appropiate place
Code: [Select]

when "Regenerate"
$game_system.se_play($data_system.decision_se)
@active_battler.current_action.kind = 0
@active_battler.current_acton.basic = 8


4) OPTIONAL
Code: [Select]

if @active_battler.current_action.basic == 8
@help_window.set_text("The text goes here", 1)
return
end


5) after where you put the effect code for Magical defense put this
Code: [Select]

            if $game_temp.regenerate
         $game_temp.targetsaver.second_damage_pop = true
        $game_temp.targetsaver.second_restorative = true
        healed = 0
        healed += $game_temp.targetsaver.damage
        randomregen = -rand(healed) - $game_temp.targetsaver.maxhp / ($game_temp.targetsaver.hp + 1)  - 2
        $game_temp.targetsaver.hp -= randomregen
        $game_temp.targetsaver.second_damage = randomregen
        $game_temp.targetsaver.hp -= $game_temp.targetsaver.second_damage
      end
      $game_temp.regenerate = false

This fix also removes a bug if your hp went to 0 (division by zero error)
Title: Various Battle commands & Request a Battle Command
Post by: Lord Dante on July 28, 2005, 04:10:39 PM
those r pretty cool...
Title: Auto link battle commands to armor and weapons
Post by: trickster on July 28, 2005, 05:28:28 PM
Ok figured out the solution to why battle commands won't link to armor well battle commands will not link to accessories because the person who did the original coding in ruby (The Interpretor class) made a mistake and the conditional branch event will not detect accessories worn by the battler (hmmn)
to correct it

class Interpreter 3 method command_111
look for
when 4
result = (actor.armor1_id ...  == @parameters[3])

change the last ")" to " or " and add actor.armor4_id == @parameters[3])


note: This next part = a turn 0 battle event
There that fixes it now to autolink the battle command to it create armor or a weapon remember the ID of it goto scripts and goto Scene_Battle 1 method main add this anywhere (I placed it before start_phase1)

Item types
weapon_id for a weapon
armor1_id for a shield
armor2_id for a helmet
armor3_id for armor
armor4_id for an accessory

Code: [Select]

if $game_actors[BATTLER NUMBER].(item types) == ITEM ID
$game_actors[1].battle_commands.push("THE COMMAND")
end
Title: Various Battle commands & Request a Battle Command
Post by: Shanus on July 28, 2005, 05:35:21 PM
Can you give a script that gives a skill a individual command other than in the skill menu
Title: Various Battle commands & Request a Battle Command
Post by: trickster on July 28, 2005, 11:53:21 PM
Quote from: Shanus
Can you give a script that gives a skill a individual command other than in the skill menu

The code is very short and depends if you want to attack one enemy or all enemies

ONE ENEMY
Scene battle 3 method update_phase3_basic_command
Code: [Select]

      when "commands name"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = (put any number here)
#make sure the number isn't the same as another command
        start_enemy_select



Scene_Battle 4 make_basic_action_result
Code: [Select]

        if @active_battler.current_action.basic == (same number)
          index = @active_battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
      @target_battlers = [target]
    @help_window.set_text("NAME OF COMMAND", 1)
     @skill = $data_skills[SKILL NUMBER]    
     @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
      return
    end


ALL ENEMIES
Scene battle 3 method update_phase3_basic_command
Code: [Select]

      when "commands name"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = (put any number here)
#make sure the number isn't the same as another command
        phase3_next_actor #no need to do enemy selection


Scene_Battle 4 make_basic_action_result
Code: [Select]

        if @active_battler.current_action.basic == (same number)
        for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
    @help_window.set_text("NAME OF SKILL", 1)
     @skill = $data_skills[SKILLS ID]    
     @animation1_id = @skill.animation1_id
    @animation2_id = @skill.animation2_id
    for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
      return
    end
Title: I bet people were waiting for this
Post by: trickster on July 29, 2005, 01:18:03 AM
name: Counter :D
description: Attacks and then if an ENEMY attacks the battler then the battler will counterattack

This is a pretty long addition
1) New global variables class Game Temp in their appropiate places
Code: [Select]

  attr_accessor :docounter #equals true if a counter attack is needed
  attr_accessor :targetsaver #saves the last target who was attacked
...
  @docounter = false
  @targetsaver = 0


2) Game_Battler 1 yet again
Code: [Select]

    def counter1?
    return (@current_action.kind == 0 and @current_action.basic == 9)
    end


3) Game_Battler 3 attack_effect  right after self.hp -= self.damage
Code: [Select]

      if self.counter1?
        $game_temp.docounter = true
        end


if you want the character to counter even if the attacker miss
put the same thing after self.damage = "Miss"
you could also make the battle counter if attacked by a spell just put the same code in the same places in skill effect

4) Scene_Battle 3 update_phase3_basic_command put this in proper place
Code: [Select]

      when "Counter Strike" #whatever name you want goes here
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 9
        start_enemy_select


5) Scene_Battle 4  make_basic_action_result
Code: [Select]

    if @active_battler.current_action.basic == 9
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
        if @active_battler.restriction == 3
          target = $game_party.random_target_actor
        elsif @active_battler.restriction == 2
          target = $game_troop.random_target_enemy
        else
          index = @active_battler.current_action.target_index
          target = $game_troop.smooth_target_enemy(index)
      end
      @target_battlers = [target]
      for target in @target_battlers
        target.attack_effect(@active_battler)
      end
      return
    end


6) This next addition when put in the right place with make the effect work correctly I had to put this in many different places to get it to work same place method update_phase4_step5
Code: [Select]

              if $game_temp.docounter
            @animation1_id = $game_temp.targetsaver.animation1_id
            @animation2_id = $game_temp.targetsaver.animation2_id
            target = @active_battler
            @target_battlers = [@active_battler]
      for target in @target_battlers
      target.attack_effect($game_temp.targetsaver)
      end
      $game_temp.docounter = false
      #when testing This next command makes the help menu pop up  
      #but in this case it pops up then disappears very quickly
      #@help_window.set_text("Counter Attack ", 1)
      target.damage_pop = true
  end
Title: Various Battle commands & Request a Battle Command
Post by: Leeroy_Jenkins on July 29, 2005, 02:12:54 AM
Here's a challenge: Can you make a skill which opens a box. In the box, you enter a 6-digit code. Each skill in the game will then be assigned a code, and when you enter a correct code in the box, it uses the corresponding skill. Otherwise, it says "Skill not found" I hope that wasn't confusing.
Title: Various Battle commands & Request a Battle Command
Post by: trickster on July 29, 2005, 02:18:53 AM
Quote from: Leeroy_Jenkins
Here's a challenge: Can you make a skill which opens a box. In the box, you enter a 6-digit code. Each skill in the game will then be assigned a code, and when you enter a correct code in the box, it uses the corresponding skill. Otherwise, it says "Skill not found" I hope that wasn't confusing.

Am I creating a skill or a battle command it sounds easy to create
Title: Various Battle commands & Request a Battle Command
Post by: Leeroy_Jenkins on July 29, 2005, 02:33:56 AM
A skill if possible. I would try it on my own, but am completely overwhelmed with RGSS. I can make comments and... that's it...
Title: Various Battle commands & Request a Battle Command
Post by: trickster on July 29, 2005, 08:49:35 PM
Quote from: Leeroy_Jenkins
A skill if possible. I would try it on my own, but am completely overwhelmed with RGSS. I can make comments and... that's it...

Well this is just about the best I can do It was going to be all scripting but it will not give you any time to input the number I tried everything and now this is a half script - half common event code

name: Code Breaker
description: when used input a number if it matches a predefined set of numbers a spell will be automatically cast note: this only works on the first character so if you want any character to use this command you must go down to the EXTRAS section to get the script for that (as soon as I fix it)

First create a spell (name doesn't matter if you want a battle command effect rating 0) linking to a common event remember the spell id and the common event id (only if you want this to be a battle command)

goto common events
goto the common event id from the spell

Message Display Options Bottom Don't Show
(I'll make a tiny box for it later I have to study up on this first though)
Input Number : [XXXX: Name], Y Digits (remember variable id Y - any number you want)

Conditional Branch: Variable [0015: Name] == ZZZ (ZZZ is any number)
<>Force Action: Hero 1, [The Spell], Random, Execute Now (Best I can do)
<>End Event Processing
<>
End

REPEAT THIS FOR EACH CODE
AT THE END
Message: Skill Not Found OR Play SE: '057=Wrong01', 80, 100  

Do all of the above for a spell with this effect now if you want a Battle Command with this effect then let's continue

Scene_Battle 4 make_basic_action_result
Code: [Select]

    if @active_battler.current_action.basic == A NUMBER (make sure it matches the other one)
      @skill = $data_skills[SPELL ID]
      @status_window.refresh
      @help_window.set_text("Code Breaker ", 1)
      @common_event_id = @skill.common_event_id
      @target_battlers.push(@active_battler)
      for target in @target_battlers
        target.skill_effect(@active_battler, @skill)
      end
      return
    end


Scene_Battle 3 update_phase3_basic_command
Code: [Select]

      when "Code Breaker"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = A NUMBER (make sure it matches the above one and no other numbers match this)
        phase3_next_actor


EXTRAS
the code above only works for the first character so with some editing you can add this instead (you need to give up another variable) I don't know what to set that variable equal to as of yet (watch this spot for an edit)
weird that the correction involves subtracting by 1 actor[1] is actor[0] and so on   EDIT this edit isn't fully tested so if an actor doesn't exist I don't know what will happen (possible error)
Code: [Select]

    if @active_battler.current_action.basic == A NUMBER (make sure it matches the other one)
      if @active_battler == $game_party.actors[0]
      $game_variables[NUMBER OF VARIABLE) = 1
      end
      if @active_battler == $game_party.actors[1]
      $game_variables[NUMBER OF VARIABLE) = 2
      end
      if @active_battler == $game_party.actors[2]
      $game_variables[NUMBER OF VARIABLE) = 3
      end
      if @active_battler == $game_party.actors[3]
      $game_variables[NUMBER OF VARIABLE) = 4
      end
      @skill = $data_skills[SPELL ID]
      @status_window.refresh
      @help_window.set_text("Code Breaker ", 1)
      @common_event_id = @skill.common_event_id
      @target_battlers.push(@active_battler)
      for target in @target_battlers
        target.skill_effect(@active_battler, @skill)
      end
      return
    end


the new fork this is a double fork now
Conditional Branch: THE OTHER VARIABLE == 1
Conditional Branch: Variable [0015: Name] == ZZZ (ZZZ is any number)
<>Force Action: Hero 1, [The Spell], Random, Execute Now (Best I can do)
<>End Event Processing
End
More spells for player 1
End

Conditional Branch: THE OTHER VARIABLE == 2
Conditional Branch: Variable [0015: Name] == ZZZ (ZZZ is any number)
<>Force Action: Hero 2, [The Spell], Random, Execute Now (Best I can do)
<>End Event Processing
End
More spells for player 2
End

Conditional Branch: THE OTHER VARIABLE == 3
Conditional Branch: Variable [0015: Name] == ZZZ (ZZZ is any number)
<>Force Action: Hero 3, [The Spell], Random, Execute Now (Best I can do)
<>End Event Processing
End
More spells for player 3
End

Conditional Branch: THE OTHER VARIABLE == 4
Conditional Branch: Variable [0015: Name] == ZZZ (ZZZ is any number)
<>Force Action: Hero 4, [The Spell], Random, Execute Now (Best I can do)
<>End Event Processing
End
More spells for player 4
End

Done all I have to do is fix the Input number command's box in battle (may be awhile)
Title: Blitz command
Post by: Sir Edeon X on July 29, 2005, 09:41:24 PM
U did some cool stuff!! What about a Blitz battle command? Just like Sabin in FF6. When you select it, you have to input a combination (like  UP, DOWN, ENTER) and then the character will invoke a skill for that combination.
Title: Re: Blitz command
Post by: trickster on July 30, 2005, 02:48:57 AM
Quote from: Sir Edeon X
U did some cool stuff!! What about a Blitz battle command? Just like Sabin in FF6. When you select it, you have to input a combination (like  UP, DOWN, ENTER) and then the character will invoke a skill for that combination.


Easy since I already have the script, but the Key Input Processing event waits for a player to hit a key so I'm going to have to bypass that or write a script from scratch I'll see If I can do that, but If I can't then It might be *gasp* Impossible

*EDIT*  With a quick fix of the battle system It is possible  :^^:
Battle fix
Goto Scene Battle 1 and search for
    if $game_system.timer_working and $game_system.timer == 0
      $game_temp.battle_abort = true
    end

you can either make them comments or delete them choose one
Create a skill that links to a common event remember both id's

Scripting (THE SAME AS CODE_BREAKER)
Scene_Battle 4 make_basic_action
things to replace(3)
the current_action's id
The skill id linking to the common event
Variable THREE is one unused variable Id
Code: [Select]

    if @active_battler.current_action.basic == ???
      @skill = $data_skills[Skill Id]
      @status_window.refresh
      @help_window.set_text("Name ", 1)
      if @active_battler == $game_party.actors[0]
      $game_variables[Variable THREE] = 1
      end
      if @active_battler == $game_party.actors[1]
      $game_variables[Variable THREE] = 2
      end
      if @active_battler == $game_party.actors[2]
      $game_variables[Variable THREE] = 3
      end
      if @active_battler == $game_party.actors[3]
      $game_variables[Variable THREE] = 4
      end
      @common_event_id = @skill.common_event_id
      @target_battlers.push(@active_battler)
      for target in @target_battlers
        target.skill_effect(@active_battler, @skill)
      end
      return
    end

Scene_Battle 3 put in proper place and replace current action id
Code: [Select]

      when "Blitz"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = ???
        phase3_next_actor


Goto the common event you created and put this there
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fshow.imagehosting.us%2Fshow%2F501516%2F0%2Fnouser_501%2FT0_-1_501516.PNG&hash=d62b8e851aa4d0518fe98b7d3e8088c9677b794e)

Now create another common event (making sure that it links where it says in the first common event "Common Event :Make one digit" ) put all of this in it
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fshow.imagehosting.us%2Fshow%2F501522%2F0%2Fnouser_501%2FT0_-1_501522.PNG&hash=4354d3662572a97632332381403df0ceb061e8e1) (http://www.imagehosting.us/index.php?action=show&ident=501522)

a little explaining
 
Key   Number     
Down   2     
Left   4     
Right   6     
Up   8     
Shift(A)   11     
X(B)   12     
Space(C)    13     
A(X)   14     
s(Y)   15     
d(Z)   16     
Button L   17     
Button R   18   

These are the normal key codes in order to get a maximum length of 8 you can't have double digits so the second common event reassigns the key's code (with the exception of Button L and Button R)

so now the new key codes as reassigned by me
 
Key   Number     
Shift(A)   0     
X(B)   1     
Down   2     
Space(C)    3     
Left   4     
A(X)   5     
Right   6     
s(Y)   7     
Up   8     
d(Z)   9     
Button L   17     
Button R   18   

And if the code for the skill is less than 8 say you only have to press Left, Down, and Right. There are two ways you can do this Press Left Right Down and then ButtonL(R) or Press Left Right Down (LET TIME EXPIRE & press another key) 3 seconds is ample time to press the keys for the skill[/img]

*EDIT* There is another blitz script at dubealex.com
Title: Various Battle commands & Request a Battle Command
Post by: Leeroy_Jenkins on July 30, 2005, 05:29:32 AM
Thanks so much for filling my request, but I'm a bit confused... could you use screenshots to show me how to fill out the common events? Also, where exactly do I put those scripts...

Sorry for sounding like a n00b...

EDIT: I only wanted the first character to have it anyway, so don't bother explaining the extras stuff.
Title: Various Battle commands & Request a Battle Command
Post by: trickster on July 30, 2005, 01:39:12 PM
Quote from: Leeroy_Jenkins
Thanks so much for filling my request, but I'm a bit confused... could you use screenshots to show me how to fill out the common events? Also, where exactly do I put those scripts...

Sorry for sounding like a n00b...

EDIT: I only wanted the first character to have it anyway, so don't bother explaining the extras stuff.


I'll answer your question with a couple of pictures

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fshow.imagehosting.us%2Fshow%2F500517%2F0%2Fnouser_500%2FT0_-1_500517.png&hash=1eb4e785eb6545a4c120e980c407e3af34cc8a24)

Look for this in your class Scene Battle 3 method make basic action
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fshow.imagehosting.us%2Fshow%2F500522%2F0%2Fnouser_500%2FT0_-1_500522.png&hash=d0e4d932574ba4f8c1d3133e9f4d6e12ac92d2a8)

And you can put this before the first commented line # in Scene_Battle 4 method make_basic_action_result
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fshow.imagehosting.us%2Fshow%2F500528%2F0%2Fnouser_500%2FT0_-1_500528.png&hash=b119d583f57283872c6b5fcd5720133bc7e4717c)[/img]
Title: The next few commands
Post by: trickster on July 30, 2005, 05:59:00 PM
The Coming up Next List in order
4) A steal command
5)A Charge command that powers up next attack
6)The jump command off FF6
7)The X Magic off FF6 use magic twice
8)Separating spells into two categories
Title: Various Battle commands & Request a Battle Command
Post by: Illudar on July 30, 2005, 06:03:04 PM
can you do one that allaws two attacks?
Title: Various Battle commands & Request a Battle Command
Post by: trickster on July 30, 2005, 08:35:40 PM
Quote from: Illudar
can you do one that allaws two attacks?

sure

*EDIT* This one was harder (the hardest to date) to code than expected  :(  so I'll have to delay it until I figure out how

*EDIT EDIT* I made the script for it
Title: X Attack Countering w/o choosing it's command & correcti
Post by: trickster on July 31, 2005, 05:35:43 PM
Name: Auto counter (Counter fix 1)
Description: Autocounters when attack chance of working (default is 50%)

in Scene_Battle 4 find if $game_temp.docounter and put this above it
Code: [Select]

if @active_battler.is_a?(Game_Enemy)
if target.battle_commands.include?("Name of Counter")
if rand(100) >= 50 #percent chance of autocounter
  target.second_damage = target.damage
  target.second_damage_pop = true
  target.damage_pop = false
  $game_temp.docounter = false
  @animation1_id = $game_temp.targetsaver.animation1_id
  @animation2_id = $game_temp.targetsaver.animation2_id
  target = @active_battler
  @target_battlers = [@active_battler]
  for target in @target_battlers
  target.attack_effect($game_temp.targetsaver)
  end
  @help_window.set_text("Counter Attack ", 1)
  target.damage_pop = true
end
end
end

Name: Counter fix two
Description: shows damage on both enemies
in scene_battle 4 find if $game_temp.docounter and delete that whole block of code and add this
Code: [Select]

if $game_temp.docounter
 target.second_damage = target.damage
 target.second_damage_pop = true
 target.damage_pop = false
 $game_temp.docounter = false
@animation1_id = $game_temp.targetsaver.animation1_id
@animation2_id = $game_temp.targetsaver.animation2_id
target = @active_battler
@target_battlers = [@active_battler]
for target in @target_battlers
target.attack_effect($game_temp.targetsaver)
end
@help_window.set_text("Counter Attack ", 1)
target.damage_pop = true
end


And Finally
name: X Attack
description: When selected the attack will attack twice
note this is the same process as adding code breaker and blitz


Create a skill memorize id linking to a comon event memorize that too
in the common event put (VARIABLE THREE CAN BE ANY VARIABLE)

      if [Variable THREE] == 1
      Force an action of attack executing now on first hero on last target chosen x2
      end

      if [Variable THREE] == 2
      Force an action of attack executing now on second hero on last target chosen x2
      end

      if [Variable THREE] == 3
      Force an action of attack executing now on third hero on last target chosen x2
      end

      if [Variable THREE] == 4
      Force an action of attack executing now on fourth hero on last target chosen x2
      end

you should know where to put this Scene_battle 3 proper place
Code: [Select]

      when "X Attack"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 13
        start_enemy_select


now scene_battle 4 make_basic_action_result
Code: [Select]

    if @active_battler.current_action.basic == 13
      @skill = $data_skills[Spell Id]
      @status_window.refresh
      @help_window.set_text("Name ", 1)
      if @active_battler == $game_party.actors[0]
      $game_variables[Variable THREE] = 1
      end
      if @active_battler == $game_party.actors[1]
      $game_variables[Variable THREE] = 2
      end
      if @active_battler == $game_party.actors[2]
      $game_variables[Variable THREE] = 3
      end
      if @active_battler == $game_party.actors[3]
      $game_variables[Variable THREE] = 4
      end
      @common_event_id = @skill.common_event_id
      @target_battlers.push(@active_battler)
      for target in @target_battlers
        target.skill_effect(@active_battler, @skill)
      end
      return
    end
Title: Magic Countering and Magic Countering w/o selecting it
Post by: trickster on July 31, 2005, 10:54:54 PM
Name: Magic Reversal
Description: Like a counter except when a enemy casts a spell (scope = 1) on the player then the player casts the same spell back at them uses 1/2 of the sp of the spell cast

Adding this will take a lot of steps

New variables (Game_Temp)
Code: [Select]

  attr_accessor :domcounter
...
  @domcounter = false



Game_battler 1 put this anywhere you want
Code: [Select]

    def counter2?
    return (@current_action.kind == 0 and @current_action.basic == 12)
  end


Game_Battler 3 paste this before the second to last command in skill_effect
Code: [Select]

          if self.counter2?
        $game_temp.domcounter = true
        end


Scene_Battle 3 update_phase3_basic_command if you've been using all these scripts you know where to put this
Code: [Select]

      when "Magic Reversal"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 12
        # 12 is the number I'm at now
        phase3_next_actor


Scene_Battle 4 you should know where to put this also
Code: [Select]

    if @active_battler.current_action.basic == 12
      @help_window.set_text("Magic Reversal ", 1)
      return
    end


ALMOST THERE
same class set_target(scope)
Code: [Select]

when 1 of (Game_Enemy's) part
        index = @active_battler.current_action.target_index
        @target_battlers.push($game_party.smooth_target_actor(index))
        $game_temp.targetsaver =  $game_party.smooth_target_actor(index)


update_phase4_step4 put this after the counter stuff (if you haven't added counter add if after the if block)
Code: [Select]

if $game_temp.domcounter
$game_temp.targetsaver.second_damage = $game_temp.targetsaver.damage
$game_temp.targetsaver.second_damage_pop = true
$game_temp.targetsaver.damage_pop = false
$game_temp.targetsaver.sp -= @skill.sp_cost / 2
@status_window.refresh
@help_window.set_text("Copy Skill", 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
@common_event_id = @skill.common_event_id
@target_battlers.push(@active_battler)
for target in @target_battlers
target.skill_effect($game_temp.targetsaver, @skill)
end
$game_temp.domcounter = false
target.damage_pop = true
end

if @active_battler.is_a?(Game_Enemy)
if target.battle_commands.include?("Magic Reversal")
if rand(100) >= 50 #percent chance of autocounter
$game_temp.targetsaver.second_damage = $game_temp.targetsaver.damage
$game_temp.targetsaver.second_damage_pop = true
$game_temp.targetsaver.damage_pop = false
$game_temp.targetsaver.sp -= @skill.sp_cost / 2
@status_window.refresh
@help_window.set_text("Copy Skill", 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
@common_event_id = @skill.common_event_id
@target_battlers.push(@active_battler)
for target in @target_battlers
target.skill_effect($game_temp.targetsaver, @skill)
end
$game_temp.domcounter = false
target.damage_pop = true
end
end
end


And you're done  :^^:
Title: Learning Enemy Spells
Post by: trickster on August 01, 2005, 03:24:11 PM
Not much to add here and any battler with this command can learn the spells

0) Create an attribute called learning or whatever

0.5) all enemy spells that you what battlers to learn need to have the attribute you just made checked

1) Game_battler 1
Code: [Select]

def learning?
return (@current_action.kind == 0 and @current_action.basic == 14)
end


2) Game_battler 3 make these two blocks of code before the return effective (last statement) in skill_effect
Code: [Select]

          if self.learning? and self.damage.is_a?(Numeric) and skill.element_set.include?("THE ID YOU CREATED")
          self.learn_skill(skill.id)
        end
      unless self.is_a?(Game_Enemy)
        if self.battle_commands.include?("Learning") and rand(100) > 50 and skill.element_set.include?("THE ID YOU CREATED")
          self.learn_skill(skill.id)
        end
      end


3)Scene_battle 3 you know where
Code: [Select]

      when "Learning"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 14
        phase3_next_actor


4)Scene_battle 4 you should know where
Code: [Select]

       if @active_battler.current_action.basic == 14
      @help_window.set_text("Learning", 1)
      return
    end


And you're done  :)
Title: Various Battle commands & Request a Battle Command
Post by: SiR_VaIlHoR on August 01, 2005, 03:26:16 PM
thanks a lot, i need this!!  :lol:
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 01, 2005, 03:27:57 PM
Quote from: SiR_VaIlHoR
thanks a lot, i need this!!  :lol:

you're welcome  8)
Title: Various Battle commands & Request a Battle Command
Post by: SiR_VaIlHoR on August 01, 2005, 03:29:14 PM
U mean Welcome i think  :lol:
Title: Making Defensive commands activate by not selecting them
Post by: trickster on August 01, 2005, 03:36:29 PM
Example for the defend command

Code: [Select]

if self.guarding
 self.damage /= 2
end


now add this to it

Code: [Select]

unless self.is_a?(Game_Enemy)  #<-- This is the most important part
if self.battle_commands.include?("Defend") and rand(100) > 50 #<- chance
self.damage /= 2 #< The effect is placed inside
end
end
Title: Various Battle commands & Request a Battle Command
Post by: SiR_VaIlHoR on August 01, 2005, 03:37:43 PM
with this last the cance is always 50%??
i'm searching for a hazard chance
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 01, 2005, 04:15:28 PM
Quote from: SiR_VaIlHoR
with this last the cance is always 50%??
i'm searching for a hazard chance

If you mean the lower the hp the person has the greater the chance it'll work then substitute that fifty for this

Game_Battler 3
100 - (100 * self.hp / self.maxhp)

Scene_Battle 4 (my scripts)
100 - (100 * $game_temp.targetsaver.hp / $game_temp.targetsaver.maxhp)
Title: Attacking all enemies
Post by: trickster on August 01, 2005, 04:25:50 PM
name: Attack All
description: an attack command that attacks all enemies nifty for weapons that should attack all enemies

Scene_Battle 3
Code: [Select]

      when "Attack All"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 15
       phase3_next_actor


Scene_Battle 4
Code: [Select]

     if @active_battler.current_action.basic == 15
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
        if @active_battler.restriction == 3
        for actor in $game_party.actors
          if actor.exist?
            @target_battlers.push(actor)
          end
        end
        elsif @active_battler.restriction == 2
               for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
        else
               for enemy in $game_troop.enemies
          if enemy.exist?
            @target_battlers.push(enemy)
          end
        end
end
      for target in @target_battlers
        target.attack_effect(@active_battler)
      end
      return
    end


And you're done  :^^:
note: I'll check to see if I can make an Attack that would attack all enemies twice EDIT
I Don't think it's possible   :cry:
Title: Notice
Post by: trickster on August 02, 2005, 03:04:35 PM
Are there any problems with any of the scripts I've posted are there any bugs in them? So far I haven't seen any posts about problems with them so I'll take the silence as they are all working fine  :lol:

The Coming up Next List in order
4) A steal/mug command (Finished)
7)The X Magic off FF6 use magic twice (Started over  :cry: )
8)Separating spells into two categories (????)
Title: Steal and Mug commands
Post by: trickster on August 03, 2005, 04:58:22 AM
Name: Steal
Description: Depending upon the stats of the spell may
1) Steal gold according to the effect rating
2) Steal an item (the item you get and amount depends on effect rating and variance and evasion)
3) Steal gold according to the enemy's drop gold
4) Steal an item according to the enemy's drop item the amount depends on evasion

Name: Mug
Description: Does the above and attacks

Alot of steps in this one so don't get confused

Create two spells steal gold and steal item don't set anything on them yet
two status effects (stolen gold and stolen item make their rating 0 so it won't show up these status effects are here so you can't steal from the same enemy twice and since the rating is zero it won't show up) Create a common event with this in it (If you did X Attack make a copy and edit it so that it is like this)
if [Variable THREE] == 1
Force an action of attack executing now on first hero on last target chosen
end

if [Variable THREE] == 2
Force an action of attack executing now on second hero on last target chosen
end

if [Variable THREE] == 3
Force an action of attack executing now on third hero on last target chosen
end

if [Variable THREE] == 4
Force an action of attack executing now on fourth hero on last target chosen
end

REMEMBER ALL ID'S OF THE THINGS YOU CREATED

Onto the script editor
You should know where to add these two (Scene_Battle 3)
Code: [Select]

      when "Steal"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 16
       start_enemy_select
      when "Mug"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 17
       start_enemy_select


Now goto Scene_Battle 4
Code: [Select]

  if @active_battler.current_action.basic == 16
  @skill = $data_skills[???] #<-- to steal gold or steal items id here
  @status_window.refresh
  @help_window.set_text("Steal", 1)
  @animation1_id = @skill.animation1_id
  @animation2_id = @skill.animation2_id
  index = @active_battler.current_action.target_index
  @target_battlers.push($game_troop.smooth_target_enemy(index))
  for target in @target_battlers
  target.steal_effect(@active_battler, @skill, @skill.int_f, false)
  end
  end
 
 if @active_battler.current_action.basic == 17
      @skill = $data_skills[???] #Steal gold or steal item goes here
      if @active_battler == $game_party.actors[0]
      $game_variables[??] = 1 #The variable in the common event goes here
      end
      if @active_battler == $game_party.actors[1]
      $game_variables[??] = 2
      end
      if @active_battler == $game_party.actors[2]
      $game_variables[??] = 3
      end
      if @active_battler == $game_party.actors[3]
      $game_variables[??] = 4
      end
      @status_window.refresh
      @help_window.set_text("Steal", 1)
      @animation1_id = @skill.animation1_id
      @animation2_id = @skill.animation2_id
      @common_event_id = ??? #Common event id
      index = @active_battler.current_action.target_index
      @target_battlers.push($game_troop.smooth_target_enemy(index))
      for target in @target_battlers
      target.steal_effect(@active_battler, @skill, @skill.int_f, true)
      end


Add this new method to game_battler 3 and now edit the skills to your desire
, that is after you read the commented section on how to edit it!
Code: [Select]

#--------------------------------------------------------------------------
  # ? steal_effect (my first major method :) ) version 1
  #  the skill effects
  # accurary determines the chance to steal modifier
  # elements aren't used so you don't have to check them
  # the agi(30%), dex(20%), and int(50%) stats determine how much more gold you get and chance
  # magic defense (theft defense) is the enemies steal defense (DON'T SET TOO HIGH)
  # status effects are used
  # effect rating determines the item you get or the gold you get
  # the evasion then determines the number of that item you get
  # If "MAGIC" equals any of these (if it doen't nothing will be stolen) then either of the following will happen
  # tosteal = 1 steals gold according to effect rating
  # tosteal = 2 steals an item the item id is the effect rating
  # tosteal = 3 steals gold according to the enemies drop gold
  # tosteal = 4 steals an item the item is the enemies drop item
  # variance tells the variance, but if tosteal = 2 then It determines
  # the type of item 1 for weapon 2 for armor 3 for item
  #
  #Pointers
  #I wouldn't set the agility and dexerity ratings too high or else you'll have some rich players
  # set agility to (10-50) and dex to (5-30) for best results
  # if MAGIC = 2 then you can ONLY steal the item the effect rating and variance is pointing to
  # remember the enemies drop probability you can set it to 0%!!!
  # If a enemy doesn't drop a (item,weapon,armor) then the steal automatically fails (I made it say NO ITEM)
  # Example of a good steal
  # effect rating 100
  # dexerity 25
  # agility 50
  # MAGIC 1
  # Magic defense 20
  # variance 20
  #--------------------------------------------------------------------------
 def steal_effect(attacker, skill, tosteal, mug)
    self.steal = true
    self.damage = 0
    self.critical = false
    hit_result = (rand(100) > self.dex / attacker.agi * attacker.int / self.int * skill.hit / 100)
    #need to fix hit result because the chance of success is too high
        if hit_result == true
            case tosteal
            when  1
                unless self.states.include?(STOLE GOLD ID)
                    add_state(STOLE GOLD ID)
                    power = skill.power + attacker.dex * skill.dex_f / 100
                    power += attacker.int * 100 / self.int  + attacker.agi * skill.agi_f / 67
                        if power > 0
                            power -= self.int * skill.mdef_f / 100 + self.dex * skill.mdef_f / 200 + self.agi * skill.mdef_f / 133
                            power = [power, 0].max
                        end
                    self.damage = power
                        if skill.variance > 0 and self.damage.abs > 0
                            amp = [self.damage.abs * skill.variance / 100, 1].max
                            self.damage += rand(amp+1) + rand(amp+1) - amp
                        end
                    $game_party.gain_gold(self.damage)
                        if mug == true
                            self.steal = false
                            self.second_steal = true
                            self.second_damage = 0
                            self.second_damage += self.damage
                            self.second_damage_pop = true
                            self.damage = 0
                            mug
                        end
                    else
                    self.steal = false
                    self.damage = "Failed"
                end
            when 2
                unless self.states.include?(STOLE ITEM ID)
                add_state(STOLE ITEM ID)
                    case skill.variance
                    when 1
                      $game_party.gain_weapon(skill.power, skill.eva_f)
                      self.damage = skill.eva_f.to_s + " " +$data_weapons[skill.power].name
                    when 2
                      $game_party.gain_armor(skill.power, skill.eva_f)
                      self.damage = skill.eva_f.to_s + " " +$data_armors[skill.power].name
                    when 3
                      $game_party.gain_item(skill.power, skill.eva_f)
                      self.damage = skill.eva_f.to_s + " " +$data_items[skill.power].name
                    end
                    if mug == true
                      self.steal = false
                      self.second_steal = true
                      self.second_damage = 0
                      self.second_damage += self.damage
                      self.second_damage_pop = true
                      self.damage = 0
                      mug
                    end
                  else
                self.steal = false
                self.damage = "Failed"
                end
            when 3
                unless self.states.include?(STOLE GOLD ID)
                    add_state(STOLE GOLD ID)
                    power = self.gold + attacker.dex * skill.dex_f / 100
                    power += attacker.int * skill.int_f / 50 + attacker.agi * skill.agi_f / 67
                    if power > 0
                        power -= self.int * skill.mdef_f / 100 + self.dex * skill.mdef_f / 200 + self.agi * skill.mdef_f / 133
                        power = [power, 0].max
                    end
                    self.damage = power
                    if skill.variance > 0 and self.damage.abs > 0
                        amp = [self.damage.abs * skill.variance / 100, 1].max
                        self.damage += rand(amp+1) + rand(amp+1) - amp
                    end
                    $game_party.gain_gold(self.damage)
                    if mug == true
                        self.steal = false
                        self.second_steal = true
                        self.second_damage = 0
                        self.second_damage += self.damage
                        self.second_damage_pop = true
                        self.damage = 0
                        mug
                    end
                  else
                self.steal = false
                self.damage = "Failed"
                end
            when 4
                unless self.states.include?(STOLE ITEM ID)
                add_state(STOLE ITEM ID)
                if self.weapon_id != 0
                    $game_party.gain_weapon(self.weapon_id, skill.eva_f)
                    self.damage = skill.eva_f.to_s + " " +$data_weapons[skill.power].name
                elsif self.armor_id != 0
                    $game_party.gain_armor(self.armor_id, skill.eva_f)
                    self.damage = skill.eva_f.to_s + " " +$data_armors[skill.power].name
                elsif self.item_id != 0
                    $game_party.gain_item(self.item_id, skill.eva_f)
                    self.damage = skill.eva_f.to_s + " " +$data_items[skill.power].name
                else
   self.damage = "No Item"
end
                if mug == true
                    self.steal = false
                    self.second_steal = true
                    self.second_damage = 0
                    self.second_damage += self.damage
                    self.second_damage_pop = true
                    self.damage = 0
                    mug
                  end
                else
              self.steal = false
              self.damage = "Failed"
              end
            end #ends the first case statement
                   
          else
          self.steal = false
          self.damage = "Failed"
          end
        return true
  end


some screenshots of the steal command in action

STEAL SUCCESS
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg304.imageshack.us%2Fimg304%2F6158%2Fshow2kc.png&hash=8793b3580575fae0ee424e3b5c2bdd068b201875) (http://imageshack.us)

enemy with a 0% chance get item
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg307.imageshack.us%2Fimg307%2F1845%2Fshow23dm.png&hash=7b28a488c38db26f4f65b0e8109bb8f6de6ac28e) (http://imageshack.us)

prying that item of its hands
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg278.imageshack.us%2Fimg278%2F1658%2Fshow30xx.png&hash=a61aa5a063918480d78719118fcc717706b3e147) (http://imageshack.us)

if you want the damage to display stolen blah blah like mine then do the following (If you don't then delete all instances of self.steal and self.second_steal) goto Color Fix (if you don't have this class get it)

edit the damage method's name to def damage(damage, critical, restorative, steal)
 
change this
Code: [Select]

if damage.is_a?(Numeric) and damage < 0
bitmap.font.color.set(176, 255, 144)
elsif restorative
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 255, 255)
end

to
Code: [Select]

if damage.is_a?(Numeric) and damage < 0
bitmap.font.color.set(176, 255, 144)
elsif restorative
bitmap.font.color.set(176, 255, 144)
elsif steal
bitmap.font.color.set(255, 215, 0) #A Golden color
else
bitmap.font.color.set(255, 255, 255)
end


add this after the if critical block
Code: [Select]

if steal
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 36, "STOLEN", 1)
bitmap.draw_text(+1, -1, 160, 36, "STOLEN", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "STOLEN", 1)
end


add these variables in Color fix ignore the second_(name) variables and delete them from my method (from Game_Battler 3) if you don't have the second_damage_pop if block
Code: [Select]

attr_accessor :steal
attr_accessor :second_steal
@steal = false
@second_steal = false    



change the damage_pop if block to this
Code: [Select]

if @battler.damage_pop
damage(@battler.damage, @battler.critical, @battler.restorative, @battler.steal)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
@battler.restorative = false
@battler.steal = false
end


if you have my second_damage_pop block then change it to this
Code: [Select]

if @battler.second_damage_pop
damage(@battler.second_damage, @battler.second_critical, @battler.second_restorative, @battler.second_steal)
@battler.second_damage = nil
@battler.second_critical = false
@battler.second_damage_pop = false
@battler.second_restorative = false
@battler.second_steal = false
end


If this doesn't work post that it doesn't work and your email and I'll send a project file with the code in it
Title: Notice II
Post by: trickster on August 06, 2005, 03:50:17 AM
The X magic script will take me longer to make than expected (the code for it didn't work the way I wanted so I started over) And this is the last call for requests because after I finish the last script I will not be making any more commands (unless you ask me when I'm in a good mood)
Title: Various Battle commands & Request a Battle Command
Post by: rune76 on August 08, 2005, 12:14:15 AM
Hmm.. I seem to have many problems with your last script, the steal and mug command. Would you mind putting it in a project so that I can download it?
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 08, 2005, 02:41:00 AM
Quote from: rune76
Hmm.. I seem to have many problems with your last script, the steal and mug command. Would you mind putting it in a project so that I can download it?


could you tell me the problem/error
Title: Various Battle commands & Request a Battle Command
Post by: rune76 on August 08, 2005, 12:42:57 PM
Ok, first of all I get an undefined method 'steal_effect' in Scene_Battle 4 for Game_Enemy. So I tried to put the definition steal_effect in Game_Enemy, however that didn't work very well... Maybe I'm just missing something, but could you tell me what to do to get it working?  :?
Title: Various Battle commands & Request a Battle Command
Post by: Leeroy_Jenkins on August 08, 2005, 01:02:00 PM
[off topic] I can see you are using a program to take screenshots, and it is putting an annoying little thing on them. Just press the print screen key, then open paint and right-click, paste, and viola, screenshot. If you just want the currently opened window (like most people), use ctrl+alt+print screen, open paint, right-click, paste. Simple screenshots, no programs, no annoying stamps.[/off topic]
Title: Various Battle commands & Request a Battle Command
Post by: rune76 on August 08, 2005, 01:24:22 PM
Or instead of pressing ctrl+alt+Print Screen Just press alt+Print Screen  :lol:
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 08, 2005, 03:15:01 PM
Quote from: Leeroy_Jenkins
[off topic] I can see you are using a program to take screenshots, and it is putting an annoying little thing on them. Just press the print screen key, then open paint and right-click, paste, and viola, screenshot. If you just want the currently opened window (like most people), use ctrl+alt+print screen, open paint, right-click, paste. Simple screenshots, no programs, no annoying stamps.[/off topic]

thanks I was getting tired of that stamp but I've never heard off using crtl alt print scrn to make screenshots wll I guess you learn something new everyday  :D
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 08, 2005, 03:16:58 PM
Quote from: rune76
Ok, first of all I get an undefined method 'steal_effect' in Scene_Battle 4 for Game_Enemy. So I tried to put the definition steal_effect in Game_Enemy, however that didn't work very well... Maybe I'm just missing something, but could you tell me what to do to get it working?  :?


steal_effect belongs in Game_Battler 3 anywhere you want
Title: Various Battle commands & Request a Battle Command
Post by: rune76 on August 08, 2005, 03:29:04 PM
Yeah, maybe. But the problem's still there... The line is like this:
target.steal_effect(@active_battler, @skill, @skill.int_f, false)
And because the target is defined as Game_Enemy there's an error... Maybe I put that code in the wrong place or something...
Please, would you put it in a project? I'd really like to have that code  :cry:
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 08, 2005, 06:30:45 PM
Quote from: rune76
Yeah, maybe. But the problem's still there... The line is like this:
target.steal_effect(@active_battler, @skill, @skill.int_f, false)
And because the target is defined as Game_Enemy there's an error... Maybe I put that code in the wrong place or something...
Please, would you put it in a project? I'd really like to have that code  :cry:


Did you put the code at the very bottom (the end) of the Game_Battler 3 class if you did just put the code between the attack_effect and skill_effect methods I'm positive that there are no errors in the steal_effect method because I just reread that script for errors so it's either you added a script that conflicts with mine or you made a mistake adding the code If that doesn't work then I'll send the project with the code by email
Title: Update No1
Post by: trickster on August 08, 2005, 09:53:13 PM
Replace Game_Battler 3 method steal_effect with this one
Code: [Select]

  #--------------------------------------------------------------------------
  # ? steal_effect Version 1.2
  # by trickster
  #
  # fixes in this version
  # fixes the accuracy of the steal it used to always work
  # if accuracy is 100 then it will always work
  # but if accuracy is 0 doesn't mean it won't always work
  #
  # the skill effects
  # accurary determines the chance to steal
  # elements aren't used so you don't have to check them
  # the agi(30%), dex(20%), and int(50%) ratings determine how much more gold you get
  # magic defense (theft defense) is the enemies steal defense
  # the dexerity and intelligence of the battler and the agility and intelligence of the enemy determines chance
  # strength and attack power and physical defense determine the damage
  # status effects aren't used (sorry about that)
  # effect rating determines the item you get or the gold you get
  # variance tells the variance, but if tosteal = 2 then It determines
  # the type of item 1 for weapon 2 for armor 3 for item
  # the evasion then determines the number you get
 
  # agility|dexterity|result
  #    =         =        hard
  #    >         <       very hard
  #    <          >       very easy
  #   >>       <<      impossible
  #  <<        >>     always
 
  # Third argument tosteal
  # tosteal = 1 steals gold according to effect rating
  # tosteal = 2 steals an item the item id is the effect rating
  # tosteal = 3 steals gold according to the enemies drop gold
  # tosteal = 4 steals an item the item is the enemies drop item
 
  #Fourth argument mug
  #set to true to attack and steal false to steal only
 
  #Pointers
  #I wouldn't set the agility and dexerity ratings too high or else you'll have some rich players :)
  # set agility to (10-50) and dex to (5-30) for best results
  # if MAGIC = 2 then you can ONLY steal the item the effect rating and variance is pointing to
  # remember the enemies drop probability you can set it to 0%!!!
  # If a enemy doesn't drop a (item,weapon,armor) then the steal automatically fails (I made it say NO ITEM)
  # Example of a good steal
  # effect rating 100
  # dexerity 25
  # agility 50
  # MAGIC 1
  # Magic defense 20
  # variance 20
  # Accuracy (30%-80%)
  #--------------------------------------------------------------------------
  def steal_effect(attacker, skill, tosteal, mug)
    self.steal = true
    self.damage = 0
    self.critical = false
    hit_result = (rand(100) > self.agi / attacker.dex * self.int / attacker.int * (100 - skill.hit))
        if hit_result == true
            case tosteal
            when  1
                unless self.states.include?(36) #YOUR STEAL GOLD ID HERE
                    add_state(36) #YOUR STEAL GOLD ID HERE
                    power = skill.power + attacker.dex * skill.dex_f / 100
                    power += attacker.int * 100 / self.int  + attacker.agi * skill.agi_f / 67
                        if power > 0
                            power -= self.int * skill.mdef_f / 100 + self.dex * skill.mdef_f / 200 + self.agi * skill.mdef_f / 133
                            power = [power, 0].max
                        end
                    self.damage = power
                        if skill.variance > 0 and self.damage.abs > 0
                            amp = [self.damage.abs * skill.variance / 100, 1].max
                            self.damage += rand(amp+1) + rand(amp+1) - amp
                        end
                    $game_party.gain_gold(self.damage)
                        if mug == true
                            self.steal = false
                            self.second_steal = true
                            self.second_damage = 0
                            self.second_damage += self.damage
                            self.second_damage_pop = true
                            self.damage = 0
                        end
                    else
                    self.steal = false
                    self.damage = "Failed"
                end
            when 2
                unless self.states.include?(37) #YOUR STEAL ITEM ID HERE
                add_state(37) #YOUR STEAL ITEM ID HERE
                    case skill.variance
                    when 1
                      $game_party.gain_weapon(skill.power, skill.eva_f)
                      self.damage = skill.eva_f.to_s + " " +$data_weapons[skill.power].name
                    when 2
                      $game_party.gain_armor(skill.power, skill.eva_f)
                      self.damage = skill.eva_f.to_s + " " +$data_armors[skill.power].name
                    when 3
                      $game_party.gain_item(skill.power, skill.eva_f)
                      self.damage = skill.eva_f.to_s + " " +$data_items[skill.power].name
                    end
                    if mug == true
                      self.steal = false
                      self.second_steal = true
                      self.second_damage = 0
                      self.second_damage += self.damage
                      self.second_damage_pop = true
                      self.damage = 0
                    end
                  else
                self.steal = false
                self.damage = "Failed"
                end
            when 3
                unless self.states.include?(36) #YOUR STEAL GOLD ID HERE
                    add_state(36)#YOUR STEAL GOLD ID HERE
                    power = self.gold + attacker.dex * skill.dex_f / 100
                    power += attacker.int * skill.int_f / 50 + attacker.agi * skill.agi_f / 67
                    if power > 0
                        power -= self.int * skill.mdef_f / 100 + self.dex * skill.mdef_f / 200 + self.agi * skill.mdef_f / 133
                        power = [power, 0].max
                    end
                    self.damage = power
                    if skill.variance > 0 and self.damage.abs > 0
                        amp = [self.damage.abs * skill.variance / 100, 1].max
                        self.damage += rand(amp+1) + rand(amp+1) - amp
                    end
                    $game_party.gain_gold(self.damage)
                    if mug == true
                        self.steal = false
                        self.second_steal = true
                        self.second_damage = 0
                        self.second_damage += self.damage
                        self.second_damage_pop = true
                        self.damage = 0
                    end
                  else
                self.steal = false
                self.damage = "Failed"
                end
            when 4
                unless self.states.include?(37) #YOUR STEAL ITEM ID HERE
                add_state(37) #YOUR STEAL ITEM ID HERE
                if self.weapon_id != 0
                    $game_party.gain_weapon(self.weapon_id, skill.eva_f)
                    self.damage = skill.eva_f.to_s + " " +$data_weapons[self.weapon_id].name
                elsif self.armor_id != 0
                    $game_party.gain_armor(self.armor_id, skill.eva_f)
                    self.damage = skill.eva_f.to_s + " " +$data_armors[self.armor_id].name
                elsif self.item_id != 0
                    $game_party.gain_item(self.item_id, skill.eva_f)
                    self.damage = skill.eva_f.to_s + " " +$data_items[self.item_id].name
                end
                if mug == true
                    self.steal = false
                    self.second_steal = true
                    self.second_damage = 0
                    self.second_damage += self.damage
                    self.second_damage_pop = true
                    self.damage = 0
                  end
                else
              self.steal = false
              self.damage = "Failed"
              end
            end #ends the first case statement
                   
          else
          self.steal = false
          self.damage = "Failed"
          end
        return true
  end
 
Title: Linking Battle Commands to Spells Made Easy An Update
Post by: trickster on August 09, 2005, 12:42:20 AM
In Programming it is better to have general methods than specific methods In order to make your methods more general you should use variables in your code so here's a better way to make battle command that links to a spell

add this variable to class Game_BattleAction
Code: [Select]

  attr_accessor :spell


same class method clear
Code: [Select]

    @spell = 0


now for the general spellcasting script
Code: [Select]

      when "NAME"
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 18 #This stays the same
        @active_battler.current_action.spell = 303 #Skill ID HERE
       start_enemy_select (1*)


note: 1* if the scope of the skill is all enemies or all actors then that should be phase3_next_actor if the scope is an actor then that should be start_actor_select


Code: [Select]

      if @active_battler.current_action.basic == 18
     #This is where the variable takes action
      @skill = $data_skills[@active_battler.current_action.spell]
      @status_window.refresh
      @help_window.set_text(@skill.name, 1)
      @animation1_id = @skill.animation1_id
      @animation2_id = @skill.animation2_id
      @common_event_id = @skill.common_event_id
        set_target_battlers(@skill.scope)
      for target in @target_battlers
      target.skill_effect(@active_battler, @skill)
    end
  end


And you're done  :^^:
Title: Skipping X-Magic for now
Post by: trickster on August 09, 2005, 05:29:10 AM
I'm moving on to two separate skill commands and I'll have that ready later tomorrow (I know how to do it now   :^^: ) They will be separated by their attribute
Title: Separating your skills
Post by: trickster on August 09, 2005, 03:33:35 PM
You only have to do this one unless you want three separate lists then you have to do this twice

Create an attribute called second skill list or something remeber the id

Make copies of Window_skill and Window_skillstatus and rename them to Window_name and Window_namestatus
now goto Window_name and look for this if block
Code: [Select]

    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil
        @data.push(skill)
      end
    end

and replace it with this
Code: [Select]

    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil and skill.element_set.include?(ELEMENT ID)
        @data.push(skill)
      end
    end

look for that same block in Window_skill and replace it with this
Code: [Select]

    for i in 0...@actor.skills.size
      skill = $data_skills[@actor.skills[i]]
      if skill != nil and not skill.element_set.include?(ELEMENT ID)
        @data.push(skill)
      end
    end


now skills with the element Id set on them will not appear on the battle command skills and they will appear in the new command

next make a copy of scene_skill and rename it to scene_name and replace all of the code in it to this
[code]
class Scene_Name
  #--------------------------------------------------------------------------
  # ? ?????????
  #     actor_index : ??????????
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
  end
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  def main
    # ???????
    @actor = $game_party.actors[@actor_index]
    # ???????????????????????????????
    @help_window = Window_Help.new
    @status_window = Window_NameStatus.new(@actor)
    @name_window = Window_Name.new(@actor)
    # ?????????????
    @name_window.help_window = @help_window
    # ????????????? (???
Title: Various Battle commands & Request a Battle Command
Post by: rune76 on August 09, 2005, 03:44:14 PM
Sorry, I haven't got it to work yet... :( If you wish to send me the project then my e-mail is tillman_matte@hotmail.com.
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 09, 2005, 04:05:04 PM
Quote from: rune76
Sorry, I haven't got it to work yet... :( If you wish to send me the project then my e-mail is tillman_matte@hotmail.com.

email sent if you want to test it out then do a test battle with the monster group with a turn 0 battle event
Title: Various Battle commands & Request a Battle Command
Post by: rune76 on August 09, 2005, 04:27:51 PM
Thank you very much! :D
It works! :)
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 09, 2005, 11:08:13 PM
Quote from: rune76
Thank you very much! :D
It works! :)

you're welcome
Title: Various Battle commands & Request a Battle Command
Post by: Soul on August 09, 2005, 11:29:45 PM
mine dont work... can you please send me a prgect of it please.. mine is greatwhitedragon999@hotmail.com
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 10, 2005, 02:16:20 PM
wierd I just started a new project and followed my directions on the steal command and it worked fine, but If you have problems with it just post with your email

Last chance for requests you still have a long time before I'm done
*EDIT* And I mean a loooooooong time because I've taking a break from coding this  :|

X Magic is progressing very slowly
Title: Various Battle commands & Request a Battle Command
Post by: Shanus on August 12, 2005, 07:56:19 PM
I cannnot get the magical defence command to work i've tried everything. So if you can please send me the battle commands in a file if possible my e-mail is shanus_2@hotmail.com

p.s great scripts :D
Title: Various Battle commands & Request a Battle Command
Post by: trickster on August 13, 2005, 03:03:03 AM
Quote from: Shanus
I cannnot get the magical defence command to work i've tried everything. So if you can please send me the battle commands in a file if possible my e-mail is shanus_2@hotmail.com

p.s great scripts :D


Sure just give me time to actually put the code in a project
Title: Issues with these scripts (I need to resolve these)
Post by: trickster on August 13, 2005, 03:24:06 AM
1) If you replace the battle system you *might* not be able to use these battle commands

EDIT Battle systems that for sure you will not be able to use these
Fukuyama, and 桜雅 在土 battle system (currently working on a compatible version

2) Giving these battle commands to enemies
Title: DUDE
Post by: Srylyk on August 15, 2005, 01:58:29 AM
Dude, you posted 4 times in a row! I don't think that's good!
Title: Re: DUDE
Post by: trickster on August 15, 2005, 02:34:48 PM
Quote from: Srylyk
Dude, you posted 4 times in a row! I don't think that's good!


Yeah but would you rather have one looooooooong post than four smaller ones  :)

*Edit* Dude you are also off topic  Hahaha :P
Title: Here the battle commands in a project file
Post by: trickster on August 22, 2005, 05:31:02 AM
60th post  :D Here it is Behold (http://rapidshare.de/files/4237013/Battle.zip.html)
Title: Re: Various Battle commands & Request a Battle Command
Post by: Metroidfan19 on January 27, 2008, 12:20:31 AM
The I got the error message "Script 'Scene_Battle 3' line 104: SyntaxError occurred.
Title: Re: Various Battle commands & Request a Battle Command
Post by: modern algebra on January 27, 2008, 06:14:06 AM
Wow, 1 year, 5 months. Post the line on which the error occurs, not just the name - http://rmrk.net/index.php/topic,19774.0.html
Title: Re: Various Battle commands & Request a Battle Command
Post by: Metroidfan19 on January 31, 2008, 01:05:05 AM
That was the entire error message.
Title: Re: Various Battle commands & Request a Battle Command
Post by: modern algebra on January 31, 2008, 01:25:38 AM
I know that was the error message. But:

"Script 'Scene_Battle 3' line 104

means that the error occurs on a specific line, line 104 in the Script Scene_Battle 3. So, go in the editor, and copy that line and post it.
Title: Re: Various Battle commands & Request a Battle Command
Post by: Metroidfan19 on February 05, 2008, 03:41:35 PM
Oh, okay. Here it is.



when "Counter Strike" #whatever name you want goes here





I've already added Counter Strike as a skill in the database as well.
Title: Re: Various Battle commands & Request a Battle Command
Post by: modern algebra on February 05, 2008, 04:19:56 PM
Hmm, I don't see a problem with that line. Can you post all the lines surrounding it?
Title: Re: Various Battle commands & Request a Battle Command
Post by: Metroidfan19 on February 05, 2008, 10:39:48 PM
Here's everything surrounding it.




update_phase3_basic_command
          when "Counter Strike" #whatever name you want goes here
        $game_system.se_play($data_system.decision_se)
        @active_battler.current_action.kind = 0
        @active_battler.current_action.basic = 9
        start_enemy_select
      end





Do I have to replace 9 with the ID of the skill?
Title: Re: Various Battle commands & Request a Battle Command
Post by: modern algebra on February 05, 2008, 10:46:34 PM
Quote
note: You need to have added Individual Battle Commands

Hmm, I am guessing this is not the entire script :P

Search for Individual Battle Commands maybe - I have no idea where it might be. In any case you are getting the error because you are missing part of the case statement, but as I am not familiar with the script I do not know what it is conditioned on.

Try finding the Scripter - he's probably released a more coherent version of the script than this. I think I will move this out of the database.