Attempting to make a mining script.

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
EDIT:

Edited this to put my current script in

Code:
############# Mining Script by: Bloodmorphed##Here is the attributes you can have in the section.#:name, :regionid, :percent, :item, :quantity: :depleted, :depletedmes#############DEFAULT_MINE = 1ORES ={1 >={ :name >= "Iron",:regionid >= 63,:percent >= 100,:item >= 10,:quantity >= 1,:depleted >= 4,:depletedmes >= "This vein is depleted",}}module MINEmodule MINE_TILE##################################Mining Animation##Animation when mining, Standing is 1.#########MINE_FRAME = 2end # MINE_TILEend # MINEmodule MINEmodule REGEXPmodule TILESET   MINING = /<(?:MINING|mine tile):[ ]*(\d+(?:\s*,\s*\d+)*)>/i  end # TILSETend # REGEXPend # MINE #==============================================================================# ■ RPG::Map#==============================================================================class RPG::Map   #--------------------------------------------------------------------------  # public instance variables  #--------------------------------------------------------------------------  attr_accessor :mine   #--------------------------------------------------------------------------  # common cache: load_notetags_mrr  #--------------------------------------------------------------------------  def load_notetags_mrr    @mine = MINE::MINE_TILE::DEFAULT_MINE.clone       #---    self.note.split(/[\r\n]+/).each { |line|      case line      #---      when MINE::REGEXP::MAP::MINE_TILE        $1.scan(/\d+/).each { |num|        @mine.push(num.to_i) if num.to_i > 0 }      #---      end    } # self.note.split    #---  end end # RPG::Map#==============================================================================# ■ Game_Map#==============================================================================class Game_Map   #--------------------------------------------------------------------------  # alias method: setup  #--------------------------------------------------------------------------  alias game_map_setup_mrr setup  def setup(map_id)    game_map_setup_mrr(map_id)    @map.load_notetags_mrr  end   end # Game_Map #==============================================================================## ▼ End of File##==============================================================================
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
why not just use terrain tags or region ids instead of notetags?


anyway, following that, you need to save the tileid of mining tiles into the mining array... then on your game, whenever you use the mining command/button, you will check if the tileid is included in that array...


though I really suggest using terrain tags or regions ids for that... maybe regions since there are many of them...
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
I am doing it by terrain tags, I just haven't gotten to that point yet. Maybe region ID's actually as you can have multiple ones do certain things.

Also I would like to create options, such as:

:ore {1 = iron}

You know, something like that, or similar to vlues random equipment actually.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
then you don't even really need that notetag... if you want each terrain tag or region to do a different thing, you can use probably constants for that + if then elses...

you'd do something like this:

Code:
module Blood  #Assuming terrain tags  IRON_TAG = 1  COAL_TAG = 2  #Item ids  IRON_ID = 10  COAL_ID = 11end
then you would add the command in the update processing of Scene_Map (discover it :) )... then to determine if you can mine:

Code:
#assuming you mine in the spot of the player#also assuming 100% chance to obtain itemif $game_map.terrain_tag($game_player.x,$game_player.y) == BLOOD::IRON_TAG  $game_party.gain_item($data_items[BLOOD::IRON_ID],1)elsif $game_map.terrain_tag($game_player.x,$game_player.y) == BLOOD::COAL_TAG  $game_party.gain_item($data_items[BLOOD::COAL_ID],1)end
now if you want to mine in front, then you will need to get first the direction of the player...
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Eh? I would still need it to know which tile is the actualy vein though, right? I mean I can have it like this...

:ore { 1 = iron

        region = 1 }

Something like that, and maybe have others come out as a percent? I'm not too sure what you mean by constant and if then statements.

EDIT:

I see in your post, it would have to be in front of the player. I'm still confused on how to actually do this by region...???
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I edited the above post with sample codes... :)
 

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Yeah see what you have is not quite what I'd like

Fir pushing V would swing, it would only make a sound AND recieve ore on a vein. oh and you can only swing while not moving.

Here is what I would like to happen:

ores

1. Iron

-region id = 1

-percent = 100 (or w/e)

2. Coal

-region id = 2

-percent = 100

3. Sapphire

-region id = 1,2

-percent = 10

Something like that.

perhaps I'm not quite ready to dabble into actually making something like this, lol.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I just posted those as EXAMPLE, as a starting point that you can check... especially since this is Learning section... :)


PS: it's actually pretty simple... you can do it... just try and try...
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Even the way I would want to do it? Hmmm... Your far more experienced then I am so ofc it would be easy for you :p
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I know this can be technically done by events, but I'd rather not make an event for every single mining thing I want.
I am not sure what is difficult about using an event to represent a mining area. It seems to be a very manage-able solution.


I would not approach it the way you're going about. Just think about the issues you've already run into and whether you really want to go and edit other scripts just to force your solution to work.
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
yeah, it is quite easy... all you do is catch a key press, check tiles, check if an item will be obtained, done... you're just over thinking it... :)


but yeah, it's easily doable via events too... and I don't really see anything wrong with that either... though if you want so many of those per map, then the script becomes a better approach...


you can prototype it maybe using events first, then once you get a bit more understanding of scripting, switch to scripting...
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
OKay so I have been working on this a bit more, looking through scripts and how to do whatever. But I still am struggling on how to implement what I would like to do.

############# Mining Script by: Bloodmorphed##Here is the attributes you can have in the section.#:name, :regionid, :percent, :item, :quantity: :depleted, :depletedmes#############DEFAULT_MINE = 1ORES ={1 >={ :name >= "Iron",:regionid >= 63,:percent >= 100,:item >= 10,:quantity >= 1,:depleted >= 4,:depletedmes >= "This vein is depleted",}}module MINEmodule MINE_TILE##################################Mining Animation##Animation when mining, Standing is 1.#########MINE_FRAME = 2end # MINE_TILEend # MINEmodule MINEmodule REGEXPmodule TILESET   MINING = /<(?:MINING|mine tile):[ ]*(\d+(?:\s*,\s*\d+)*)>/i  end # TILSETend # REGEXPend # MINE#==============================================================================# ■ RPG::Map#==============================================================================class RPG::Map   #--------------------------------------------------------------------------  # public instance variables  #--------------------------------------------------------------------------  attr_accessor :mine   #--------------------------------------------------------------------------  # common cache: load_notetags_mrr  #--------------------------------------------------------------------------  def load_notetags_mrr    @mine = MINE::MINE_TILE::DEFAULT_MINE.clone       #---    self.note.split(/[\r\n]+/).each { |line|      case line      #---      when MINE::REGEXP::MAP::MINE_TILE        $1.scan(/\d+/).each { |num|        @mine.push(num.to_i) if num.to_i > 0 }      #---      end    } # self.note.split    #---  end end # RPG::Map#==============================================================================# ■ Game_Map#==============================================================================class Game_Map   #--------------------------------------------------------------------------  # alias method: setup  #--------------------------------------------------------------------------  alias game_map_setup_mrr setup  def setup(map_id)    game_map_setup_mrr(map_id)    @map.load_notetags_mrr  end   end # Game_Map#==============================================================================## ▼ End of File##==============================================================================
Also there are a few reasons I don't want this in events. Firstly, this will be a good learning experience, secondly this is a much easier way of going about it, rather then having to call common events and figure out a way to do each thing individually and compile it in one.
 
Last edited by a moderator:

AwesomeCool

Bratty and spoiled little sister
Veteran
Joined
Jul 20, 2013
Messages
2,862
Reaction score
1,947
First Language
English
Primarily Uses
N/A
get rid of the clone on this line (it serves no purpose):

@mine = MINE::MINE_TILE::DEFAULT_MINE.cloneand I thought it was => and not >=.

also, put: 

DEFAULT_MINE = 1ORES ={1 >={ :name >= "Iron",:regionid >= 63,:percent >= 100,:item >= 10,:quantity >= 1,:depleted >= 4,:depletedmes >= "This vein is depleted",}}into a module of some kind
 
Last edited by a moderator:

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
Thank you for that, but it doesn't really answer my question.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
@awesome,: >= is for greater than or equal to... hash set-up uses key => value
 

Mike

Veteran
Veteran
Joined
Aug 28, 2013
Messages
316
Reaction score
36
First Language
English
Primarily Uses
@Shana

Isn't OP declaring a hash variable with ORES as the variable name?
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
yeah, but he used >= instead of =>

Code:
ORES ={1 >={ :name >= "Iron",:regionid >= 63,:percent >= 100,:item >= 10,:quantity >= 1,:depleted >= 4,:depletedmes >= "This vein is depleted",}}
 
Last edited by a moderator:

Mike

Veteran
Veteran
Joined
Aug 28, 2013
Messages
316
Reaction score
36
First Language
English
Primarily Uses
Well, alright. I just misinterpreted your previous post.
 

Bloodmorphed

Dungeon Fanatic
Veteran
Joined
Sep 17, 2012
Messages
1,466
Reaction score
144
First Language
English
Primarily Uses
It was supposed to be => though. 
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Exactly what I said
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top