iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

The 2nd Quarter Contest has arrived! Go check it out in the Community Announcements now!

> Note for Tutorial Threads

New threads (tutorials) here will go into a moderation queue. You will not see your thread appear when you create it. A moderator will decide if it will be approved or denied.

 
Reply to this topicStart new topic
> [-Eventing-] [-Scripting-] Changing the terms In-Game, meaning, while you are playing the game
Sir Eagle
post Jan 1 2011, 03:40 PM
Post #1


He knows what to do with chicken.
Group Icon


Type: Spriter
Alignment: Chaotic Good




I was looking for a way how to do this, when I stumbled upon a very easy to use script.

This Tutorial covers how you can make the game change the terms, while you are playing the game

To understand this tutorial, you need to:
1. Understand how common events work
2. Understand how switches work
3. Understand how conditional branches work
4. Know how the Script Editor works
5. Know how to copy and paste

[hr]

Step 1: Installing the script
First, go to the Script Editor. All the way to the bottom, but above all other custom scripts you might have installed, create a new section named []KGC scripts, and a new class named KGC_ChangeSystemTerms

It should look like this
QUOTE
...
Scene_Gameover

▼KGC Scripts
KGC_ChangeSystemTerms

▼Main Process
Main


Copy the script below, and paste it in the new class you made.
Spoiler:
CODE
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/   ◆          Change System Terms - KGC_ChangeSystemTerms             ◆ VX ◆
#_/   ◇                    Last Update: 2008/05/28                            ◇
#_/   ◆        Translated, Ported, and Updated by Mr. Anonymous               ◆
#_/   ◆ KGC Site:                                                             ◆
#_/   ◆ http://f44.aaa.livedoor.jp/~ytomy/                                    ◆
#_/   ◆ Translator's Blog:                                                    ◆
#_/   ◆ http://mraprojects.wordpress.com                                      ◆
#_/----------------------------------------------------------------------------
#_/  Installation: Insert above as many custom scripts as possible.
#_/============================================================================
#_/  This script allows you to change the vocabulary of certain system-used
#_/  terms such as "Gold" or "Skill" with the use of the "Script" event command.
#_/----------------------------------------------------------------------------
#_/                       ◆ Instructions For Usage ◆
#_/  This command is used in "Script" function in the third page of event
#_/   commands under "Advanced".
#_/  
#_/ * SystemTerms.change(Index, String)
#_/  The core of this script. Allows you to alter the text of a given system
#_/   term. Where Index = the term's index. Scroll down to the "Initialize"
#_/   block below to see the numbered list of alterable system terms. Where
#_/   String = the desired string you wish to change the term to.
#_/
#_/   Example: SystemTerms.change(0, "Zenny")
#_/    This would change the value in index 0 ("Gold" (by default)) to Zenny.
#_/   For a better example of how this works, please refer to the "Vocab" system
#_/    script, located at the very top of the scripts.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

$imported = {} if $imported == nil
$imported["ChangeSystemTerms"] = true

module SystemTerms
  #--------------------------------------------------------------------------
  # ● System Terms Module
  #      index : SystemTerms Index
  #     string : Designated String
  #--------------------------------------------------------------------------
  def self.change(index, string = "")
    # Change System Term
    $game_system.system_terms[index] = string
    # Refresh System Term
    $game_system.terms_refresh
  end
end

#=================================End Module===================================#

#==============================================================================
# ■ Game_System
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # ● Public Instance Variable
  #--------------------------------------------------------------------------
  attr_accessor :system_terms             # System Terms
  #--------------------------------------------------------------------------
  # ● Object Initialization
  #--------------------------------------------------------------------------
  alias initialize_KGC_ChangeSystemTerms initialize
  def initialize
    # Run original process
    initialize_KGC_ChangeSystemTerms
    @system_terms     = []
    @system_terms[0]  = $data_system.terms.gold     #Name of currency
    @system_terms[1]  = $data_system.terms.level    #Level
    @system_terms[2]  = $data_system.terms.level_a  #Level abbrevation
    @system_terms[3]  = $data_system.terms.hp       #Health
    @system_terms[4]  = $data_system.terms.hp_a     #Health abbrevation
    @system_terms[5]  = $data_system.terms.mp       #MP
    @system_terms[6]  = $data_system.terms.mp_a     #MP Abbrevation
    @system_terms[7]  = $data_system.terms.atk      #Attack stat
    @system_terms[8]  = $data_system.terms.def      #Defense stat
    @system_terms[9]  = $data_system.terms.spi      #Spirit stat
    @system_terms[10] = $data_system.terms.agi      #Agility stat
    @system_terms[11] = $data_system.terms.weapon   #"Weapon"
    @system_terms[12] = $data_system.terms.armor1   #Shield
    @system_terms[13] = $data_system.terms.armor2   #Helmet
    @system_terms[14] = $data_system.terms.armor3   #Body Armor
    @system_terms[15] = $data_system.terms.armor4   #Accesory
    @system_terms[16] = $data_system.terms.weapon1  #"Weapon 1"
    @system_terms[17] = $data_system.terms.weapon2  #"Weapon 2"
    @system_terms[18] = $data_system.terms.attack   #"Attack" command
    @system_terms[19] = $data_system.terms.skill    #"Skill" command
    @system_terms[20] = $data_system.terms.guard    #"Guard" command
    @system_terms[21] = $data_system.terms.item     #"Item" command, menu name
    @system_terms[22] = $data_system.terms.equip    #"Equip" menu name
    @system_terms[23] = $data_system.terms.status   #"Status" menu name
    @system_terms[24] = $data_system.terms.save     #"Save" command
    @system_terms[25] = $data_system.terms.game_end #"Game End" command
    @system_terms[26] = $data_system.terms.fight    #"Fight" command
    @system_terms[27] = $data_system.terms.escape   #"Escape" command
    @system_terms[28] = $data_system.terms.new_game #"New Game" command
    @system_terms[29] = $data_system.terms.continue #"Continue" command
    @system_terms[30] = $data_system.terms.shutdown #"Shutdown" command
    @system_terms[31] = $data_system.terms.to_title #"To Title" command
    @system_terms[32] = $data_system.terms.cancel   #"Cancel" command
    @system_terms[33] = Vocab::ShopBuy
    @system_terms[34] = Vocab::ShopSell  
    @system_terms[35] = Vocab::ShopCancel  
    @system_terms[36] = Vocab::ExpTotal
    @system_terms[37] = Vocab::ExpNext
    @system_terms[38] = Vocab::SaveMessage    
    @system_terms[39] = Vocab::LoadMessage  
    @system_terms[40] = Vocab::File  
    @system_terms[41] = Vocab::Emerge    
    @system_terms[42] = Vocab::Preemptive    
    @system_terms[43] = Vocab::Surprise    
    @system_terms[44] = Vocab::EscapeStart    
    @system_terms[45] = Vocab::EscapeFailure    
    @system_terms[46] = Vocab::Victory    
    @system_terms[47] = Vocab::Defeat    
    @system_terms[48] = Vocab::ObtainExp    
    @system_terms[49] = Vocab::ObtainItem    
    @system_terms[50] = Vocab::LevelUp        
    @system_terms[51] = Vocab::ObtainSkill
    @system_terms[52] = Vocab::DoAttack        
    @system_terms[53] = Vocab::DoGuard        
    @system_terms[54] = Vocab::DoEscape        
    @system_terms[55] = Vocab::DoWait
    @system_terms[56] = Vocab::UseItem
    @system_terms[57] = Vocab::CriticalToEnemy
    @system_terms[58] = Vocab::CriticalToActor
    @system_terms[59] = Vocab::ActorDamage
    @system_terms[60] = Vocab::ActorLoss
    @system_terms[61] = Vocab::ActorDrain
    @system_terms[62] = Vocab::ActorNoDamage
    @system_terms[63] = Vocab::ActorNoHit    
    @system_terms[64] = Vocab::ActorEvasion
    @system_terms[65] = Vocab::ActorRecovery    
    @system_terms[66] = Vocab::EnemyDamage
    @system_terms[67] = Vocab::EnemyLoss
    @system_terms[68] = Vocab::EnemyDrain
    @system_terms[69] = Vocab::EnemyNoDamage
    @system_terms[70] = Vocab::EnemyNoHit    
    @system_terms[71] = Vocab::EnemyEvasion
    @system_terms[72] = Vocab::EnemyRecovery  
    @system_terms[73] = Vocab::ActionFailure    
  end
  #--------------------------------------------------------------------------
  # ● Refresh
  #--------------------------------------------------------------------------
  def terms_refresh
    $data_system.terms.gold       = @system_terms[0]
    $data_system.terms.level      = @system_terms[1]
    $data_system.terms.level_a    = @system_terms[2]
    $data_system.terms.hp         = @system_terms[3]
    $data_system.terms.hp_a       = @system_terms[4]
    $data_system.terms.mp         = @system_terms[5]
    $data_system.terms.mp_a       = @system_terms[6]
    $data_system.terms.atk        = @system_terms[7]
    $data_system.terms.def        = @system_terms[8]  
    $data_system.terms.spi        = @system_terms[9]  
    $data_system.terms.agi        = @system_terms[10]
    $data_system.terms.weapon     = @system_terms[11]
    $data_system.terms.armor1     = @system_terms[12]
    $data_system.terms.armor2     = @system_terms[13]
    $data_system.terms.armor3     = @system_terms[14]
    $data_system.terms.armor4     = @system_terms[15]
    $data_system.terms.weapon1    = @system_terms[16]
    $data_system.terms.weapon2    = @system_terms[17]
    $data_system.terms.attack     = @system_terms[18]
    $data_system.terms.skill      = @system_terms[19]
    $data_system.terms.guard      = @system_terms[20]
    $data_system.terms.item       = @system_terms[21]
    $data_system.terms.equip      = @system_terms[22]
    $data_system.terms.status     = @system_terms[23]
    $data_system.terms.save       = @system_terms[24]
    $data_system.terms.game_end   = @system_terms[25]
    $data_system.terms.fight      = @system_terms[26]
    $data_system.terms.escape     = @system_terms[27]
    $data_system.terms.new_game   = @system_terms[28]
    $data_system.terms.continue   = @system_terms[29]
    $data_system.terms.shutdown   = @system_terms[30]  
    $data_system.terms.to_title   = @system_terms[31]
    $data_system.terms.cancel     = @system_terms[32]
    Vocab::ShopBuy                == @system_terms[33]
    Vocab::ShopSell               == @system_terms[34]
    Vocab::ShopCancel             == @system_terms[35]
    Vocab::ExpTotal               == @system_terms[36]
    Vocab::ExpNext                == @system_terms[37]
    Vocab::SaveMessage            == @system_terms[38]
    Vocab::LoadMessage            == @system_terms[39]
    Vocab::File                   == @system_terms[40]
    Vocab::Emerge                 == @system_terms[41]  
    Vocab::Preemptive             == @system_terms[42]  
    Vocab::Surprise               == @system_terms[43]
    Vocab::EscapeStart            == @system_terms[44]
    Vocab::EscapeFailure          == @system_terms[45]  
    Vocab::Victory                == @system_terms[46]
    Vocab::Defeat                 == @system_terms[47]  
    Vocab::ObtainExp              == @system_terms[48]  
    Vocab::ObtainItem             == @system_terms[49]    
    Vocab::LevelUp                == @system_terms[50]      
    Vocab::ObtainSkill            == @system_terms[51]
    Vocab::DoAttack               == @system_terms[52]      
    Vocab::DoGuard                == @system_terms[53]    
    Vocab::DoEscape               == @system_terms[54]        
    Vocab::DoWait                 == @system_terms[55]
    Vocab::UseItem                == @system_terms[56]
    Vocab::CriticalToEnemy        == @system_terms[57]
    Vocab::CriticalToActor        == @system_terms[58]
    Vocab::ActorDamage            == @system_terms[59]
    Vocab::ActorLoss              == @system_terms[60]
    Vocab::ActorDrain             == @system_terms[61]
    Vocab::ActorNoDamage          == @system_terms[62]
    Vocab::ActorNoHit             == @system_terms[63]  
    Vocab::ActorEvasion           == @system_terms[64]
    Vocab::ActorRecovery          == @system_terms[65]
    Vocab::EnemyDamage            == @system_terms[66]
    Vocab::EnemyLoss              == @system_terms[67]
    Vocab::EnemyDrain             == @system_terms[68]
    Vocab::EnemyNoDamage          == @system_terms[69]
    Vocab::EnemyNoHit             == @system_terms[70]  
    Vocab::EnemyEvasion           == @system_terms[71]
    Vocab::EnemyRecovery          == @system_terms[72]  
    Vocab::ActionFailure          == @system_terms[73]
  end
end

#==================================End Class===================================#

#==============================================================================
# ■ Scene_File
#==============================================================================

class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  # ● Read Save Data
  #     file : Saved File
  #--------------------------------------------------------------------------
  alias read_save_data_KGC_ChangeSystemTerms read_save_data
  def read_save_data(file)
    # Run original process
    read_save_data_KGC_ChangeSystemTerms(file)
    # Refresh system terms
    $game_system.terms_refresh
  end
end

#==================================End Class===================================#


Step 2: Creating the common event & Switches

This part is very important. When the game boots, it loads the terms from the database. Since the script doesn't change the database, it would screw up your terms, and ruin the game.

First, Go to the switches list. (tip: you can find the switches in the event creation screen, under control switches, but you should know that already). Create two switches. Name one "Terms CE switch" and the other after the event that should make your terms change. For example, if you want the terms to change after defeating the Demon King, name it "Demon King defeated".

Second, create a new common event, and name it Change Terms after <certain event name here>. for example, "Change terms after defeating Demon King". Change the trigger to "Parallel", and change the condition switch to "Terms CE switch", that you created before.

In the common event, create a Conditional Branch with as a condition, in the example's case, the switch "Demon King defeated" is ON. The Common Event screen should look something like this

QUOTE
Name:......................................Trigger........Condition Switch
[Change Terms after...]...........[Parallel]....[####:Terms CE Sw...]
_________________________________________________________________
@>Conditional Branch: Switch [####:Defeated Demon King] = ON
.....@>
: Else
.....@>
: Branch End
@>


Now copy the following script:
CODE
SystemTerms.change(Index, String)


In the conditional branch, create a "script" event line. (on the 3rd page of the event control panel) and paste the code above. That code is the one actually doing all the work. where "Index" is, enter the index number of the term you want to change. You can find the index number in the script class, or in the spoiler at the bottom of the post. Where "string", enter the name you want the term to get, inbetween quotes. For example, if you want the "skills" term to change into "demonic arts", the code would be:

CODE
SystemTerms.change(19, "Demonic Arts")


and the common event would look like this

QUOTE
Name:......................................Trigger........Condition Switch
[Change Terms after...]...........[Parallel]....[####:Terms CE Sw...]
_________________________________________________________________
@>Conditional Branch: Switch [####:Defeated Demon King] = ON
.....@>Script: SystemTerms.change(19, "Demonic Arts")
.....@>
: Else
.....@>
: Branch End
@>


Now the Skills term will change as soon as the Defeated Demon King switch is turned on. To make the game change the term back when the switch is turned off again, simply add the same code, but with "Skills" as string, under the Else line. It would look like this.

QUOTE
Name:......................................Trigger........Condition Switch
[Change Terms after...]...........[Parallel]....[####:Terms CE Sw...]
_________________________________________________________________
@>Conditional Branch: Switch [####:Defeated Demon King] = ON
.....@>Script: SystemTerms.change(19, "Demonic Arts")
.....@>
: Else
.....@>Script: SystemTerms.change(19, "Skills")
.....@>
: Branch End
@>


You can add more then one term change by putting repeating the code with different index numbers. You don't have to add a new branch for each term, just put it in the same branch.
_____________________________________________________________________________________________

End of Tut. The rest you will have to find out by experimenting. The Index list is below.

Index list
Spoiler:
0: Name of Currency
1: Level
2: Level Abbrevation
3: Health
4: Health Abbrevation
5: MP
6: MP Abbrevation
7: Attack stat
8:Defense stat
9: Spirit stat
10:Agility stat
11:"Weapon"
12:"Shield
13:Helmet
14:Body Armor
15:Accesory
16:"Weapon 1"
17:"Weapon 2"
18:"Attack" command
19:"Skill" command
20:"Guard" command
21:"Item" command, menu name
22:"Equip" menu name
23:"Status" menu name
24:"Save" command
25:"Game End" command
26:"Fight" command
27:"Escape" command
28:"New Game" command
29:"Continue" command
30:"Shutdown" command
31:"To Title" command
32:"Cancel" command


--------------------
My Games & Resources
Spoiler:


Personal Project: Game-ification of SapphireLibra3's fanfiction.
I Support
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 16th April 2014 - 03:11 PM

RPGMakerVX.net is an Privacy Policy, Legal.