Guest Access
Go to page : 1, 2
Morderator
Morderator
Morderator
profile
albertfish
profile
Hey, this is a little script I threw together just now.
This script calls a common event equal to the current terrain tag.
For example, terrain tag 1 calls common event 1, terrain tag 2 calls common event 2, etc. Terrain tag 0 does not call any common events. By default all terrain tags, 1 through 7, call common events, but you may change @final_tag to something less than 7. The new value will be the last terrain tag that calls an event.
This script also calls the even once for every time you step on the tile.
For example, if the common event added 1 gold, as I walk on to the tile I will receive 1 gold rather than receiving 1 gold repeatedly.
Anyways, here is the script.
This script calls a common event equal to the current terrain tag.
For example, terrain tag 1 calls common event 1, terrain tag 2 calls common event 2, etc. Terrain tag 0 does not call any common events. By default all terrain tags, 1 through 7, call common events, but you may change @final_tag to something less than 7. The new value will be the last terrain tag that calls an event.
This script also calls the even once for every time you step on the tile.
For example, if the common event added 1 gold, as I walk on to the tile I will receive 1 gold rather than receiving 1 gold repeatedly.
Anyways, here is the script.
- Spoiler:
- Code:
#==============================================================================
# ** Terrain Tag Common Event Triggering
#------------------------------------------------------------------------------
# * Created by: albertfish
# * Version: 1.2
# * Last edited: December 13, 2009
#------------------------------------------------------------------------------
# Version History:
# Version 1.2: December 13, 2009
# - Changed over to Scene_Map to eliminate any problems with the spriteset
# being drawn when the player can't move
# Version 1.1: December 13, 2009
# - Added new control features
# - Ability to repeat the common event call if needed
# - Ability to set a pause between repeated event calls
# Version 1.0: December 12, 2009
# - Initial release
#------------------------------------------------------------------------------
# Description:
# This script triggers the common event equal to the terrain tag you are
# currently on. This script only calls the common event once until you
# move to another tile.
#------------------------------------------------------------------------------
# Usage Instructions:
# This script will call all common events from 1 to @final_tag. You may
# edit this value to it's max ammount (7).
# To set the common event to repeat, place a comment in the common event
# and type repeat. To set a pause for repeated event calls, type a comment
# as follows:
# wait #
# This will tell the script to wait for # of frames before repeating. For
# example, wait 40 should repeat the script 1 time per second. This
# depends on the refresh rate, which is by default 40.
#------------------------------------------------------------------------------
# Install Instructions:
# Place this script above the main script and below the default scripts.
#==============================================================================
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
alias af_ttcet_sm_main main
def main
@final_tag = 7
@repeat = false
@wait = 0
@prev_x = $game_player.x
@prev_y = $game_player.y
af_ttcet_sm_main
end
alias af_ttcet_sm_update update
def update
af_ttcet_sm_update
x = $game_player.x
y = $game_player.y
tag = $game_map.terrain_tag(x, y)
@repeat = false
if $data_common_events[tag] != nil
if tag > 0 && tag <= [7, @final_tag].min
list = $data_common_events[tag].list
for i in 0...list.size
if (list[i].code == 108 || list[i].code == 408) &&
list[i].parameters[0] == "repeat"
@repeat = true
elsif (list[i].code == 108 || list[i].code == 408) &&
list[i].parameters[0][0, 4] == "wait" && @wait == -1
@wait = list[i].parameters[0][5, list[i].parameters[0].size - 5].to_i
end
end
if @wait == 0 && (@repeat || x != @prev_x || y != @prev_y)
$game_temp.common_event_id = tag
@wait = -1
elsif @wait > 0
@wait -= 1
end
end
end
if x != @prev_x || y != @prev_y
@wait = 0
end
@prev_x = x
@prev_y = y
end
end
Morderator
Show Signature
Morderator
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
@Albertfish - man you rock!
this opens up more interaction with the map in such
a simple manner...
for swimming in water...
walking slower in the mud...
and the one calvin and I have been working on...
falling off the edge.
this is great! having it not repeat was such a nice touch.
7 terrains are more than enough to play with...
I was just trying to get one to work ^,^
this opens up more interaction with the map in such
a simple manner...
for swimming in water...
walking slower in the mud...
and the one calvin and I have been working on...
falling off the edge.
this is great! having it not repeat was such a nice touch.
7 terrains are more than enough to play with...
I was just trying to get one to work ^,^
Administrator
Show Signature
Morderator
Morderator
Morderator
profile
albertfish
profile
I'm also working on giving you more control over how it executes. What I am going to add to this script is the ability to have it repeat if you want it to repeat, and also allow you to control the speed in which it repeats.
Morderator
Show Signature
Morderator
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
come to think of it, having it repeat
and at what speed would work well
with maps that have acid or lava
ok now I'm even more excited ^,^
and at what speed would work well
with maps that have acid or lava
ok now I'm even more excited ^,^
Administrator
Show Signature
Morderator
Morderator
Morderator
profile
albertfish
profile
Alright, version 1.1 is now posted which gives you the ability to control how the script calls the events.
Morderator
Show Signature
Morderator
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
wow! ~ though this script is small...
I'm looking at code I've never seen before! ^,^
I can't wait to try it out using terrain tag 1 to have a common event
make the player/character fall of the edge/cliff.
my question is, how would I be able to use this with multiple maps
so that when the player falls they reappear at a "safety point" for each map ?
going to have fun with the new version right now!
edit: having issues with passability
I'm looking at code I've never seen before! ^,^
I can't wait to try it out using terrain tag 1 to have a common event
make the player/character fall of the edge/cliff.
my question is, how would I be able to use this with multiple maps
so that when the player falls they reappear at a "safety point" for each map ?
going to have fun with the new version right now!
edit: having issues with passability
Administrator
Show Signature
Morderator
Morderator
Morderator
profile
albertfish
profile
Well, my script does not alter the effects of the RPG Maker, all of that stuff is hard coded and cannot be changed. The script just effects the executed game, so my script wouldn't alter anything when changing the terrain tag in the database.
I also tried this on my machine and it didn't alter the pass-ability. Also, I updated the script again. Just a minor edit so that the game doesn't crash if the corresponding common event doesn't exist.
If you find any bugs in the script please let me know .
I also tried this on my machine and it didn't alter the pass-ability. Also, I updated the script again. Just a minor edit so that the game doesn't crash if the corresponding common event doesn't exist.
If you find any bugs in the script please let me know .
The only this that I can thing of is a compatibility issue. Maybe with the ABS, because I know that script uses terrain tags in it.Gameface101 wrote:edit: having issues with passability
Morderator
Show Signature
Morderator
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
there was a conflict with this Vehicle script I was using...
well it was easy for me to decide which script to keep ^,^
I've made a simple teleport common event with tag 1
and a lose HP with tag 2 using the wait 40 comment...
it truly works like a charm! ^,^
I'm sorry if I ever doubted you
pure genius
well it was easy for me to decide which script to keep ^,^
I've made a simple teleport common event with tag 1
and a lose HP with tag 2 using the wait 40 comment...
it truly works like a charm! ^,^
I'm sorry if I ever doubted you
pure genius
Administrator
Show Signature
Morderator
Morderator
Morderator
profile
albertfish
profile
Well, send me that script and I'll see if I can sort out any compatibility issues.
Morderator
Show Signature
Morderator
Administrator
Administrator
Administrator
profile
G@MeF@Ce
profile
generic vehicle script sent ^,^
thanks for taking a look... I'm sure there's a better
script or way to make vehicles.
this terrain trick script of yours has got me working
on all 7 common events. it's just super nifty!
thanks for taking a look... I'm sure there's a better
script or way to make vehicles.
this terrain trick script of yours has got me working
on all 7 common events. it's just super nifty!
Administrator
Show Signature
Go to page : 1, 2