Valsazaar

Warper
Member
Joined
Feb 16, 2014
Messages
4
Reaction score
5
First Language
English
Primarily Uses
Trying to compile a useful list of native / semi native functions for scripting. Can't seem to find a good single page resource for this anywhere. Will add more as I progress. I am aware of the 14 page monstrosity floating around with content spread all over the place.

REGION MANIPULATION

setTileRegion(x,y,newID)

description: extends the game map class to be able to set tile regions in real time

typical usage: $game_map.setTileRegion(x,y)

class Game_Map  def setTileRegion(reg_x,reg_y,reg_id)        if reg_id > 63 || reg_id < 0      reg_id = 0    end        @thirdvalue = "%14b" % self.data[reg_x, reg_y, 3]           # binary split of the two elements    @bLEFT = @thirdvalue[0,6] # REGION ID IN BINARY    @bRIGHT = @thirdvalue[6,8] # SHADOW ID IN BINARY        @bLEFT = "%6b" % reg_id        @newvalue = @bLEFT.to_s + @bRIGHT.to_s    @newvalue = @newvalue.to_i(2)        self.data[reg_x, reg_y, 3] = @newvalue      endend

getTileRegion(x,y)

description: extends the game map class to return the tile region at coordinate x,y on the map loaded into game map

typical usage:

@variablename = $game_map.getTileRegion(x,y)



class Game_Map  def getTileRegion(reg_x,reg_y)        # gets a 14 bit long binary string from the map data array @thirdvalue = "%14b" % self.data[reg_x, reg_y, 3]           # binary split of the two elements    @bLEFT = @thirdvalue[0,6] # REGION ID IN BINARY    @bRIGHT = @thirdvalue[6,8] # SHADOW ID IN BINARY # converts the binary string back to an integer and returns    return(@bLEFT.to_i(2))      endend


getShadowID(x,y)

description: extends the game map class to return the shadow tile ID at coordinate x,y on the map loaded into game map

typical usage:

@variablename = $game_map.getShadowID(x,y)



class Game_Map  def getTileShadowID(reg_x,reg_y)     # gets a 14 bit long binary string from the map data array    @thirdvalue = "%14b" % self.data[reg_x, reg_y, 3]           # returns binary split of the two elements    @bLEFT = @thirdvalue[0,6] # REGION ID IN BINARY    @bRIGHT = @thirdvalue[6,8] # SHADOW ID IN BINARY # converts the binary string back to an integer and returns    return(@bRIGHT.to_i(2))      endend


MAP MANIPULATION

getTileIDByLayer(x,y,layer)

description:

returns the tile ID stored in the map database. These are the internal ID's that the engine uses to refer to tiles. Autotiles can have anywhere up to 50 variants! More useful for checking if scenery items are ona  tile than checking if a ground type is of a certain variety. Layer0 is the ground layer, Layer1 is the mask layer that overlays Layer0's and Layer2 is the object layer for A5-B,C,D,E.

typical usage:

@variablename = $game_map.getTileIDByLayer(x,y,layer)

class Game_Map def getTileIDByLayer(x,y,layer) return(self.data[x,y,layer]) endendsetTileIDByLayer(x,y,layer,tile_ID)

description:

sets the tile ID of a specified tile on the map to temporarily display on screen. This is temporary only because it does not update the saved map data, only the copy in memory that is temporary. Changing map, loading,saving etc will all refresh this value and cause the map to revert to its state in the game editor.

tile_ID is the internal ID's that the engine uses to refer to tiles. Autotiles can have anywhere up to 50 variants! More useful for temporary spell effects, puzzles than permenant world changes.

Layer0 is the ground layer, Layer1 is the mask layer that overlays Layer0's and Layer2 is the object layer for A5-B,C,D,E.

typical usage:

$game_map.setTileIDByLayer(57,32,1,1069)

class Game_Map  def setTileIDByLayer(x,y,layer,tile_ID)    self.data[x,y,layer] = tile_ID  endendSAVABLE MAP MANIPULATION

Strongly recommend the following script:

Title: Tile Swap
 Author: Tsukihime, Rycochet

(just google it, better than me posting dead links here, fantastic script I couldnt recommend more highly)

combined with the below additional command:

changeTileByInternalID(map_id,x,y,layer,intID)

description:

sets the tile ID of a specified tile on the map_id number permenantly to another value.

The script linked above does 99% of the heavy lifting here as far as retaining data between games, autotiles etc.

tile_ID is the internal ID's that the engine uses to refer to tiles. Autotiles can have anywhere up to 50 variants!

Layer0 is the ground layer, Layer1 is the mask layer that overlays Layer0's and Layer2 is the object layer for A5-B,C,D,E.

typical usage:

$game_system.changeTileByInternalID($game_map.map_id, x, y, layer, tile_ID)

dependency:

Title: Tile Swap
 Author: Tsukihime, Rycochet


Code:
class Game_System  def changeTileByInternalID(map_id,x,y,layer,intID)    initialize_pos_list(map_id, layer)        tid = intID        @swapped_pos_tiles[map_id][layer][y] = [] if @swapped_pos_tiles[map_id][layer][y].nil?        @swapped_pos_tiles[map_id][layer][y][x] = tid        $game_map.load_new_map_data  endend
 
Last edited by a moderator:

C-C-C-Cashmere (old)

Resident Weirdo
Veteran
Joined
Mar 7, 2014
Messages
832
Reaction score
341
First Language
English
Primarily Uses
What the heck, this is so useful. More please lol.

Thank you!
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,088
Reaction score
2,690
First Language
Greek
Primarily Uses
RMMZ
Okay.

You got my attention!

What are the Terms of use for these scripts?  :)
 

Long Lost Hero

Veteran
Veteran
Joined
Feb 6, 2015
Messages
38
Reaction score
6
First Language
English
Primarily Uses
Is this used for allowing the player to change the map tiles as they play the game? Such as destroying walls or blowing a hole in the ground or building a house?
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,940
Reaction score
750
First Language
German
Primarily Uses
RMMZ
The POS-Revert command of Tsukuhimes Script is Buggy.

Without that function the Script is Awsome but only as half as good it could be.

Can someone fix the Bug in that Script?
 

Amegatron

Warper
Member
Joined
Mar 20, 2015
Messages
3
Reaction score
1
First Language
Russian
Primarily Uses
getTileRegion(x,y)

description: extends the game map class to return the tile region at coordinate x,y on the map loaded into game map

typical usage:

@variablename = $game_map.getTileRegion(x,y)
Hm, there is already $game_map.region_id(x,y) for that :)
 

daniacea

Maker
Member
Joined
Jun 5, 2014
Messages
9
Reaction score
1
First Language
English
Primarily Uses
I thought I would add this here. I wanted to add it to script call equivalents of events but that post is locked. 

To start a game timer from a script call;

$game_timer.start(600)

Each unit of 60 equals 1 second, so this example would start a timer with 10 seconds. 
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,940
Reaction score
750
First Language
German
Primarily Uses
RMMZ
I was working on it, so i wanted to share it.

I just watched a Tutorial on how to show a Icon from an ItemID on the Gamescreen.

It was a Script, but it also works as a Eventcommand Scriptcall with some little Edit.



class Window_Custom < Window_Basedef initializesuper(0, 0, 48, 48)refreshself.opacity = 0enddef refreshdraw_icon($data_items[1].icon_index, 0, 0)endend$game_variables[1] = Window_Custom.newAnd this is for Erasing the Icon

$game_variables[1].disposeI dont know why or how this works with a Variable, but it does :) .
 
Last edited by a moderator:

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,940
Reaction score
750
First Language
German
Primarily Uses
RMMZ
Ok i found another one, i want to share. (Hope double Post is Ok in this Case)

Its a use Item Script Equivalent. Playm helped to build this (mostly all thanks to him).

Usable for:

Own Picture Menus to use Items outside the standard Menu.

Or to differently use the Items in the Key Item List.

The following example is used in the Eventcommand Script.

hero = $game_party.leader #<-Useritem = $data_items[1] #<-Item_Idtargets = if !item.for_friend? [] elsif item.for_all? $game_party.members else [hero] endif hero.usable?(item) && targets.any?{ |t| t.item_test(hero, item) } hero.use_item(item) targets.each do |target| item.repeats.times{target.item_apply(hero,item)} endendThanks Playm

Possible Users:
$game_party.leader
$game_actors[id]
$game_party.members[index]

Item_Id
Insteed of the number for Item id you can use also [$game_variables[1]], this is needed when you want to Combine the Keyitem selection Variable with Items you can consume or use to trigger Common Events with using KeyItemList. Thatway you dont need Conditional branch for every Item used through Key Item List.

The Database 

Itemsettups are fully recognized.
Target: User or whole Group
Consumable Yes or No
Effects on chars work and also the Call Common Event from an Event is triggered.

Hope this comes handy for someone.
 
Last edited by a moderator:

dii

Villager
Member
Joined
Jul 14, 2014
Messages
18
Reaction score
4
First Language
Polish
Primarily Uses
Ok I will try to post here my text file with collection of script calls concerning a troop and a party. When I gained a certain proficiency in RPG Maker I began to search for script calls enabling implementation of more complex ideas/skills. I see now how easy it is to find something concerning script call if you have a basic knowledge of what calls are there. Most of custom formulae thread and script call collection thread are wonderful resources but there is so much scattered around in those two threads. I hope that this txt file concerning troop and party will help someone above beginner to expand his/her knowledge concerning troop script calls :) Here I have gathered from various places calls that help to familiarize oneself with what is out there. I know it is messy but it is just a starting point :) Please remove this replay if it is not appropriate.
 

Attachments

  • game troop.txt
    12.1 KB · Views: 10

Latest Threads

Latest Profile Posts

PC got fixed finally. Back online again. Turns out I have no business trying to self repair pcs because it was getting to like 176F / 80C. Shop installed a totally new cooling system and now it runs fine and is super quiet.
When you're making major progress, but have to stop to go to work.
Streaming making some Parallax maps if anyone wants to hang :)

Still alive, still kicking, still working on M
Just busy irl :)
Okay so... resetting BIOS to default settings causes a hard drive to take 9999 damage and become resistant to phoenix downs.... and pleads...

Forum statistics

Threads
131,480
Messages
1,220,171
Members
173,229
Latest member
ZecaVn
Top