Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin =========================================================================
- ┌───────────────┐ v 1.1
- │ Effect Blocks™│
- │ By Dekita │
- └───────────────┘
- ================================================================================
- Script Information:
- ====================
- This script simply holds effect blocks, for use with some of my other scripts
- ie. scripts that enable these effects to be triggered.
- There is also substantial information on how they work included in this script
- ================================================================================
- ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- ================================================================================
- 1. You MUST give credit to "Dekita" !!
- 2. You are NOT allowed to repost this script.(or modified versions)
- 3. You are NOT allowed to convert this script.(into other game engines e.g RGSS2)
- 4. You are NOT allowed to use this script for Commercial games.
- 5. ENJOY!
- "FINE PRINT"
- By using this script you hereby agree to the above terms and conditions,
- if any violation of the above terms occurs "legal action" may be taken.
- Not understanding the above terms and conditions does NOT mean that
- they do not apply to you.
- If you wish to discuss the terms and conditions in further detail you can
- contact me at http://dekitarpg.wordpress.com/ or DekitaRPG@gmail.com
- ================================================================================
- History:
- =========
- D /M /Y
- o7/o3/2o13 - changed import method,
- - compatability with $D13x equip,
- 17/o2/2o13 - finished,
- ================================================================================
- INSTRUCTIONS:
- ==============
- Place this script UNDER "▼ Materials" and ABOVE "▼ Main" in your script editor.
- Place above ALL other scripts that require this one
- ================================================================================
- To Scripters:
- ==============
- If you are wanting to trigger an effect block within one of your own scripts
- call this method...
- Effect_Blocks.trigger(BLOCK)
- BLOCK = the effect block ie, [:common, id]
- ================================================================================
- NOTES :
- ========
- Some of the scripts i will write use what i like to call " Effect Blocks "
- This may not be the correct name, but its what i like to call them.
- This information descrbes all the generic effect blocks used
- within certain scripts of mine.
- An Effect Block is basically an array that holds information.
- Effect Blocks will always be used in the customization options.
- They are used for certain scripts that unlock achievements or change
- the environment at times that may not be able to be controlled by
- the Developer. e.g A new Level is reached, a Pokemon Evolves,
- The REAL WORLD time changes and controls the environment,
- multiple different things..
- I have written them as easy to understand as possible..
- here is a "default" effect blocks to get things started..
- [:common, id]
- as you can see the effect block is surrounded by square brackets '[' ']'
- this is what holds the information held in the block ie. an array
- :common = basically the method, the method MUST ALWAYS be first in the block
- this tells the block what it was designed to control, in this case ,
- it triggers a common event.
- id = the id of the common event to trigger.
- And its that easy.
- Of course some more complex effect blocks can be a little complicated,
- But ALL Effect Blocks work in this way, ie. you can read it and it tells you
- EXACTLY what it does..
- Heres a few examples ;
- [:common, 1]
- Triggers common event id 1.
- [:switch, 169, true]
- This turns game switch number 169 on.
- [:switch, 274, false]
- This turns game switch number 274 off.
- As you can see you can also control game switches with effect blocks,
- the format of a switch effect block is this.. [:switch, id, boolean]
- Now Heres a more complicated effect block..
- [:variable, 1, :set, 3]
- As with before this effect block is easy to read,
- ie. variable 1 set at the value of 3
- but unlike the others it has a larger array with a second method,
- this is because there is multiple things you may want to do with this block,
- just like you would with game variables.
- the secondary :variable methods are :set, :add, :sub, :div, :mul, :mod
- as you can see, these are standard ways of controlling variables.
- the variable format is .. [:variable, id, control_type, value]
- control_type = the secondary method called, ie :sub , :add ect
- Here is a full list of all DEFAULT Effect Blocks.
- DEFAULT = Can be used in all of my scripts that use effect blocks.
- [:common, id]
- [:switch, id, true]
- [:switch, id, false]
- [:variable, id, :set, value]
- [:variable, id, :add, value]
- [:variable, id, :sub, value]
- [:variable, id, :div, value]
- [:variable, id, :mul, value]
- [:variable, id, :mod, value]
- [:gold, :gain, value]
- [:gold, :lose, value]
- [:item, id, amount, include equip(bool)]
- [:weapon, id, amount, include equip(bool)]
- [:armor, id, amount, include equip(bool)]
- Note ~
- for :weapon and :armor, if using my $D13x equip system, the amount will become
- the teir of the equip rather than the amount.(equip can also only be added)
- You can also create your own custom effect blocks in scripts that use them.
- And thats all there is to know about the basics of effect blocks..
- =end #=========================================================================#
- module Effect_Blocks
- #==============================================================================#
- # This is simply the module that holds the default effect blocks
- # DO NOT modify the exsisting code, but feel free to add to it, IF
- # you are confident in what you are doing and need to impliment
- # a new common effect block.
- def self.trigger(block)
- return if block == nil
- case block[0]
- when :switch
- $game_switches[block[1]] = block[2]
- when :variable
- case block[2]
- when :set ; value = block[3]
- when :add ; value = ($game_variables[block[1]] + block[3])
- when :sub ; value = ($game_variables[block[1]] - block[3])
- when :div ; value = ($game_variables[block[1]] / block[3])
- when :mul ; value = ($game_variables[block[1]] * block[3])
- when :mod ; value = ($game_variables[block[1]] % block[3])
- end; $game_variables[block[1]] = (value).to_i
- when :common
- $game_temp.reserve_common_event( eff[1] )
- when :gold
- case block[1]
- when :gain ; $game_party.gain_gold(block[2].to_i)
- when :lose ; $game_party.lose_gold(block[2].to_i)
- end
- when :item
- $game_party.gain_item($data_items[block[1]],block[2].to_i)
- when :weapon
- inc_e = block[3] == nil ? false : block[3]
- if $D13x[:Equip]['core']
- Cloning_101.start_clone(:weapon, block[1], block[2].to_i)
- else
- $game_party.gain_item($data_weapons[block[1]],block[2].to_i,inc_e)
- end
- when :armor
- inc_e = block[3] == nil ? false : block[3]
- if $D13x[:Equip]['core']
- Cloning_101.start_clone(:armor, block[1], block[2].to_i)
- else
- $game_party.gain_item($data_armors[block[1]],block[2].to_i,inc_e)
- end
- end
- end
- end
- $imported = {} if $imported.nil?
- $imported[:Effect_Blocks] = {} if $imported[:Effect_Blocks].nil?
- $imported[:Effect_Blocks]['core'] = true
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- # - SCRIPT END - #
- #==============================================================================#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement