General RGSS/RGSS2/RGSS3 Help

Started by G_G, March 04, 2009, 12:14:28 am

Previous topic - Next topic

Zeriab

You can perfectly fine still catch the error.
It still raises errors it gets.

nathmatt

ok im trying to figure out how i should set up my skill script right now it wait 5 then takes the base stat & multiplies it my the number of times it loops then adds the atk so ur weapon so ur weapon effects the speed  till it equals the given amount but what im what i need is by how much should the base stat increase each lvl right now it starts at 50 than increases by 5 every lvl
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


nathmatt

March 25, 2010, 01:26:11 pm #422 Last Edit: March 26, 2010, 02:16:57 pm by nathmatt
ok i managed to get the path finder from Blizz-ABS with creates an array of directions to get to the targeted x & y my problem is figuring out how to get the player to move using each command in the array i tried casing the direction to move in the correct direction then i shifted the array to remove the already moved direction from the array the problem is it goes through the array to fast i need it to wait for the move to be completed remove it from the array then do the next 1

edit: figured it out just had to check if player was moving if he wasn't then call the method again
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


G_G

I'm assuming this just has to do with math because it most likely does. What I want is to draw an area around the player like in a tactic battle system. Something like this.

Spoiler: ShowHide


That area would be drawn if the player's move count was 3. The red square is the player and the blue squares are where he can walk.
I'm trying to figure out an equation to draw so many squares like that according to move count.

If anyone could help I would be very thankful. Its for a small mini-game I'm working on.

winkio

that area is defined by abs(a.x-o.x) + abs(a.y-o.y) <= r, where a is a tile, o is the center, and r is the radius.  One way to do it is using that equation.

Another way is to go from one end to the other, increasing the amount of tiles by 2 each time until you hit the center, then decreasing by 2 each time.  it's simpler and doesn't need an equation.

nathmatt

March 31, 2010, 11:13:08 am #425 Last Edit: March 31, 2010, 05:48:15 pm by nathmatt
is there a way to check if a message is being displayed from the show text command in Interpreter ?
edit: found it $game_temp.message_window_showing
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


G_G

Okay how would we use a dll made in C# in a script? I'm trying a few things out. Any help is appreciated.

Blizzard

You can't. Ruby can only use libraries made in C (AFAIK) and C# DLLs are bound to .NET so you can't use them out of two reasons.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Jragyn

Congratulations, Blizzard on retiring from rmXP!
Hope life goes in the way you want, away from this game making software lol.

But, erhm, to whomever can answer:

Whats the difference between this:

if $game_system.save_disabled
      # Disable save
      @command_window.disable_item(4)
    end


and this:...?

 @command_window.disable_item(4) if $game_system.save_disabled


Is the First like...bad coding?
I've personally discovered that using the latter when possible seems easier to manage...
but does it...really make a difference in some way?
A bright light can either illuminate or blind, but how will you know which until you open your eyes?

Blizzard

There is no difference. It's just in the first statement you can add more commands under that conditional branch while in the second you can't.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

momentai1018

April 10, 2010, 03:42:59 pm #430 Last Edit: April 13, 2010, 05:54:30 pm by game_guy
Hi i was wondering if anyone can make this script compatible with blizz abs cause  i can't seem to get it. it's not mine but i want to be able to use it, it's a swimming script and it worked before i added blizz abs


Spoiler: ShowHide

#==============================================================================#
#  Swimming!  v 1.8                                                          #
#  By: ToriVerly @ hbgames.org                                                    #
#==============================================================================#
#  Intructions:                                                                #
#------------------------------------------------------------------------------#
=begin
Paste this script above Main and below everything else.
For each character you will have swimming, make a swimming sprite that has the
same name as the character but ending with "_swim" and another with "_dive" if
DIVE_GRAPHIC is true.
   Example: "001-Fighter01_swim.png"

If TREAD_ANI = true, the character will be animated while in water when they are
not moving.  Hence a treading water effect.  Set it to false if you don't want
the effect.

Set the WATER constant to the terrain tag ID of your water tiles or whatever tile
you want to swim through.  When you place non water tiles over water tiles (in
a higher layer), the non water tiles will need to have a terrain tag that is
different than WATER and not 0 or else the characters is swim through it.

   IMPORTANT--->make sure your water tile is passable.

If you want the ability to swim to depend on a switch, set SWIM_SWITCH to the ID
of the game switch you're using. If you don't want to use a switch, set it to nil.
Similarily, set SWIM_ITEM, SWIM_ARMOR or SWIM_WEAPON to the ID of the item, armor
or weapon required for swimming and nil if there is none.  You can even set more
than one condition!

The SWIM_SE will play every time you jump into water.  If you don't want a sound,
set DIVE_SOUND_OFF to true.

The SNEAK_KEY and DASH_KEY functions can be set for Mr.Mo's ABS or an input
letters script.  If you don't have such an input system but have another dashing
and/or sneaking system/script, change them to Input::YourKey.
    Example: Input::X
             Input::Y
If you don't have dashing or sneaking at all, set them to nil.
WATER_DASHING is self explanitory.  If you want to dash in water, set it to true.
If DROWNING is on, the player will have about three seconds to get out of water
before they die (if swimming isn't available). If it is off, water will just be
impassable.
Enjoy!
=end
#------------------------------------------------------------------------------#
WATER = 3
SWIM_SWITCH = nil
SWIM_ITEM = nil
SWIM_ARMOR = nil
SWIM_WEAPON = nil
SNEAK_KEY = nil #Input::Letterres["Z"] for Mr.Mo's ABS or input letters script
DASH_KEY = nil #Input::Letters["X"] for Mr.Mo's ABS or input letters script
SWIM_SE = "022-Dive02"
DROWN_SE = "021-Dive01"
DROWNING = false
WATER_DASHING = false
DIVE_SOUND_OFF = false
DIVE_GRAPHIC = true
TREAD_ANI = true
#------------------------------------------------------------------------------#

#==============================================================================#
# Game_Player                                                                  #
#------------------------------------------------------------------------------#
# Modifies the Game_Player class initialization and updating                   #
#==============================================================================#
class Game_Player < Game_Character
 attr_reader   :swim
 attr_reader   :swimming?
 attr_reader   :swim_count
 alias swim_init initialize
 def initialize
   @swim = false
   @drown_count = 0
   @swim_count = 0
   swim_init
 end
 alias swim_update update
 def update

   # Checks if swimming is triggered
   if DROWNING == true
   return jump_in if facing?(WATER, 'any', 1) and !@swim and moving?
   # Drowns if it is not available
   drown if !swim_available? and on?(WATER)
   elsif DROWNING == false
   return jump_in if facing?(WATER, 'any', 1) and !@swim and moving? and swim_available?
   end
   
   # Jumps out of water at shore
   jump_forward if !on?(WATER) and !facing?(WATER, 'any', 1) and !facing?(WATER, 'any', 2) and @swim and moving?
   # Returns original settings when out of water
   revert if @swim and !on?(WATER)
   
   # Refreshes swimming state
    swim_refresh if swimming?
 swim_update
end

   # Makes water impassable when swimming isn't available
 alias mrmo_swim_game_player_passable passable?
 def passable?(x, y, d)
   # Get new coordinates
   new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
   new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
   # Check if it water tag
   return false if $game_map.terrain_tag(new_x,new_y) == WATER and !swim_available? and DROWNING == false
   # Old Method
   mrmo_swim_game_player_passable(x,y,d)
 end
#------------------------------------------------------------------------------#
# Custom Methods                                                               #
#------------------------------------------------------------------------------#
 # Checks swimming availability
 def swim_available?
    if SWIM_SWITCH != nil
     return true if $game_switches[SWIM_SWITCH]
     return false if !$game_switches[SWIM_SWITCH]
    end
    if SWIM_ITEM != nil
      return true if $game_party.item_number(SWIM_ITEM) != 0
      return false if $game_party.item_number(SWIM_ITEM) == 0
    end
    if SWIM_ARMOR != nil
      return true if $game_party.actors[0].armor1_id == SWIM_ARMOR
      return true if $game_party.actors[0].armor2_id == SWIM_ARMOR
      return true if $game_party.actors[0].armor3_id == SWIM_ARMOR
      return true if $game_party.actors[0].armor4_id == SWIM_ARMOR
      return false
    end
    if SWIM_WEAPON != nil
      return true if $game_party.actors[0].weapon_id == SWIM_WEAPON
      return false
    end
    return true
  end
   
 # Jumps in the water if swimming is triggered
 def jump_in
   @swim = true
   unless DIVE_SOUND_OFF
    @play_sound = true
   end
  if DIVE_GRAPHIC == true
   @character_name = $game_party.actors[0].character_name
   @character_name = $game_party.actors[0].character_name + "_dive"
  end
  jump_forward if facing?(WATER, 'any', 1)
 end
 
 # Swimming setup
 def swim_refresh
     get_speed if moving?
     if !moving?
       @character_name = $game_party.actors[0].character_name
       @character_name = $game_party.actors[0].character_name + "_swim"
     end
     if @play_sound and !moving?
        Audio.se_play("Audio/SE/" + SWIM_SE , 80, 100)
        @play_sound = false
     end
        @swim = true
     if TREAD_ANI == true
        @step_anime = true
      end
    end
   
 # Drowning
 def drown
   @move_speed = 0.1
   if @drown_count <= 120
     #jump_in if !@swim
     @drown_count += 1
       if @drown_count %40 == 0
         Audio.se_play("Audio/SE/" + DROWN_SE, 80, 100)
       end
     elsif @drown_count >= 120
     @character_name = ""
     @drown_count = 0
     Audio.se_play("Audio/SE/" + SWIM_SE, 80, 100)
    $scene = Scene_Gameover.new
   end
 end
 
 # Reverts original settings when out of water
 def revert
     @character_name = $game_party.actors[0].character_name
     @swim = false
     @drown_count = 0
       unless dashing? or sneaking?
        @move_speed = 4
        @move_frequency = 6
       end
      if TREAD_ANI == true
      @step_anime = false
    end
  end
 
 # Determines Speed (Swim Leveling)
 def get_speed
   # Gets Swim Count
     @swim_count += 0.05
   case @swim_count
   when 0.05
     @swim_speed = 1
     @move_frequency = 1
   when 100
     @swim_speed =  2
     @move_frequency = 1
   when 250
     @swim_speed = 3
     @move_frequency = 1
   when 750
     @swim_speed = 4
     @move_frequency = 1
   when 2000
     @swim_speed = 5
     @move_frequency = 1
   end
   @move_speed = @swim_speed
     if WATER_DASHING == true
         if DASH_KEY != nil and Input.press?(DASH_KEY) and !sneaking?
          @move_speed = @swim_speed + 1
          @move_frequency = 6
         end
         if SNEAK_KEY != nil and Input.press?(SNEAK_KEY) and !dashing?
          @move_speed = @swim_speed -1
          @move_frequency = 2
        end
      end
    end
 
# Jumps forward
 def jump_forward
 case @direction
     when 2
       jump(0, 1)
     when 4
       jump(-1, 0)
     when 6
       jump(1, 0)
     when 8
       jump(0, -1)
     end
   end
 # Jumps backward
 def jump_backward
   case @direction
     when 2
       jump(0, -1)
     when 4
       jump(1, 0)
     when 6
       jump(-1, 0)
     when 8
       jump(0, 1)
     end
   end

 # Checks if dashing
 def dashing?
   return true if DASH_KEY != nil and Input.press?(DASH_KEY)
   return false if SNEAK_KEY != nil and Input.press?(SNEAK_KEY)
 end
 # Checks if sneaking
 def sneaking?
   return true if SNEAK_KEY != nil and Input.press?(SNEAK_KEY)
   return false if DASH_KEY != nil and Input.press?(DASH_KEY)
 end
 # Checks if swimming
 def swimming?
   return true if on?(WATER) and @swim
 end
 # Checks if player is on a terrain tag
 def on?(tag)
   return true if $game_map.terrain_tag($game_player.x, $game_player.y) == tag
 end
 # Checks if player is facing a terrain tag
 def facing?(tag, dir, dist)
   case dir
    when 2
      if $game_player.direction == 2
       tag_x = $game_player.x
       tag_y = $game_player.y + dist
     end
    when 4
      if $game_player.direction == 4
       tag_x = $game_player.x - dist
       tag_y = $game_player.y
      end
    when 6
      if $game_player.direction == 6
       tag_x = $game_player.x + dist
       tag_y = $game_player.y
      end
    when 8
      if $game_player.direction == 8
       tag_x = $game_player.x
       tag_y = $game_player.y - dist
     end
    when 'any'
      if $game_player.direction == 2
       tag_x = $game_player.x
       tag_y = $game_player.y + dist
     end
      if $game_player.direction == 4
       tag_x = $game_player.x - dist
       tag_y = $game_player.y
     end
      if $game_player.direction == 6
       tag_x = $game_player.x + dist
       tag_y = $game_player.y
     end
     if $game_player.direction == 8
       tag_x = $game_player.x
       tag_y = $game_player.y - dist
     end
   end
  return false if tag_x == nil or tag_y == nil
  return true if $game_map.terrain_tag(tag_x, tag_y) == tag
end
end
#------------------------------------------------------------------------------#
# By ToriVerly
# Thanks to Mr.Mo for help with my passability issues and to Chaosg1 for my intro
# into scripting :)
#------------------------------------------------------------------------------


Added code and spoiler tags ~ G_G

WhiteRose

I'm afraid I can't help, as I'm not much of a scripter, but I do have a few recommendations that will make sure your request is filled quicker:
1. Make sure you use the "Search" function before you post; I don't know if you did already, but I do recall a swimming script being mentioned before. I don't remember if it worked or not, though.
2. Once you have confirmed that there is no solution already available, start a new thread clearly outlining what scripting work you would like completed. In this case, sorting out the compatibility between your swimming script and Blizz-ABS.
3. Use code tags. It'll make your script easier to read, use and edit.

If you follow these things, I'm sure that one of our expert scripters such as Ryex or Game_Guy will come give you a hand. :)

Blizzard

This is a topic for scripters and GENERAL scripting questions. If you have problems with a specific script, post it in the Script Troubleshooting section.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Jackolas

April 13, 2010, 08:32:56 am #433 Last Edit: April 13, 2010, 11:24:48 am by Jackolas
question.... (kinda got myself in over my head again:S)
I want kinda create a rather complicated array (think that's it called)

for example:
random for specific actor at a level must return a number

so I will end up wit:
for actor A
 on lvl 1 return 2
 on lvl 2 return 6
 etc...
for actor B
 etc...


now I want a way that I configure this (as small as poss) and than read it from some point in my script
I hope I make sense :S

i seen scripts that use it the configure this way:
  something = {
 1 => [  [1,2],[2,6],[3,8],[4,10],[etc],
      ],
 2 => [  [1,3],[2,5],[3,7],[4,9],[etc],
      ],
 } #end

what I kinda like because its small (not a lot of lines)
but I know no way to read it. (and the script I found this in is incomplete, accidental removed a part and can't find the script any more :S)
ofc it doe's not have to be like that 1... as long as its 1 that works

(Hexamin)

Hmmm... something like...

$game_party.actors[0] = index
Random_Stuff[index] = player_lvls
player_lvls[index.level] # returns random number


or...


Random_Stuff[$game_party.actors[0]][$game_party.actors[0].level] # returns random number


Maybe?
Max 1111101000; characters remaining: 1110111000

Jackolas

April 13, 2010, 11:27:54 am #435 Last Edit: April 13, 2010, 03:53:35 pm by Jackolas
hmm.. think its my lack of explaining skill :S

retry:

I want somehow in a script a predetermined number that fist at a specific lvl and actor.

for example of the following config:
 something = {
 1 => [  [1,2],[2,6],[3,8],[4,10],[etc],
      ],
 2 => [  [1,3],[2,5],[3,7],[4,9],[etc],
      ],
 } #end

if I than ask for lvl 3 in actor 1 I need to get 8 in return (as an example)
hope that makes it more clear

atm i'm trying to work around it by something like:
  def self.something(id)
   case id
     when 1: return [2,6,8,10,etc...]
     when 2: return [3,5,7,9,etc...]
     end
   return [0]
 end

and than somehow request the 4th number when ID is 1 (witch will result in 10 ofc)
atm am failing :S

Edit:
Nvm... fixed it myself
something(id)[place] = number

so
something(01)[4] = 10

Valdred

I got a question. How do I show an Animation trough scripting?
I don't mean the charset/stop animation way. You know the animations like "hit" and so.

nathmatt

April 13, 2010, 04:39:13 pm #437 Last Edit: April 13, 2010, 04:41:54 pm by nathmatt
charactor.animation_id = the animation id caractor is the charactor so say $game_player.animation_id = 1 would use the animation 1 on the player

edit: i think ruby doesn't like me how does @players.any? {|key, value| value.username == value.username} = false?
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


G_G

Quote from: Jackolas on April 13, 2010, 08:32:56 am
question.... (kinda got myself in over my head again:S)
I want kinda create a rather complicated array (think that's it called)

for example:
random for specific actor at a level must return a number

so I will end up wit:
for actor A
  on lvl 1 return 2
  on lvl 2 return 6
  etc...
for actor B
  etc...


now I want a way that I configure this (as small as poss) and than read it from some point in my script
I hope I make sense :S

i seen scripts that use it the configure this way:
  something = {
  1 => [  [1,2],[2,6],[3,8],[4,10],[etc],
       ],
  2 => [  [1,3],[2,5],[3,7],[4,9],[etc],
       ],
  } #end

what I kinda like because its small (not a lot of lines)
but I know no way to read it. (and the script I found this in is incomplete, accidental removed a part and can't find the script any more :S)
ofc it doe's not have to be like that 1... as long as its 1 that works


Like this.
array = Random_stuff[actor_id]
# array then = [  [1,2],[2,6],[3,8],[4,10] ]

Then go from there.

Jackolas

got it already fixed Game_guy.
could not solve it one way so I approached the problem from an other side.