General RGSS/RGSS2/RGSS3 Help

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

Previous topic - Next topic

Shining Riku

I have all I need, I'm just not sure how to do it. I understand scripting well enough to know where to go if somebody tells me, but I can't get my SE to play during a critical hit.

I think it'd be awesome to have it in my game. If it's possible, somebody please tell me how. I'd greatly appreciate it!

And everybody else that comes here could benefit from it too. :D

Aqua

November 12, 2009, 07:58:55 pm #321 Last Edit: November 12, 2009, 08:01:12 pm by Aqua
There are scripts out there already like this.

Try RPG Revolution or creationasylum or something. :)

Edit:
If you /really/ wanna do it yourself...
$game_system.se_play(name_of_sound_effect_here)

Would play the sound effect.

samsonite789

So, I'm using a view range script for my game, and I was wondering how to do the following:

The script calls a method like so:

$view_range_enemies_view(a, b, c, d, e)
Where:
a = event_id (the monster's ID)
b = the view range in tiles
c = switch thrown when player is within view range
d = self switch thrown when player is within view range
e = whether impassable tiles are taken into account (block enemy view)

Here's an example:
$view_range_enemies_view(4, 5, nil, 'A', true)

However, I use a lot of these script calls in the enemy event and I'm going to make a lot of enemy events.  Instead of having to go through each page for each event and type in the enemy's event ID for each script call, I'd like to be able to set some sort of variable that will do that for me.

I tried PK8's Self Variables script to do that.  That does the following:

self_variable(variable_id, value, operation(i.e set, add, etc.))
And to call the variable, you use: self_variable(variable_id) in a call script.

So I tried this:

self_variable('monster', 4, 0) #set variable to monster's ID which is 4
$view_range_enemies_view(self_variable('monster'), 5, nil, 'A', true)

And I get an error telling me:
Script 'Self Variables' line 127: NoMethodError occurred
undefined method for '[]=' for nil:NilClass

That points to the following line in the script:
Spoiler: ShowHide


class Interpreter
  def self_variable(id, value = nil, oper = nil)
    if @event_id > 0
      key = [@map_id, @event_id, id]
      if value != nil
        case oper
        when nil, 0, 'equal', 'set', '='                     # Setting
          $game_self_variables[key] = value   <------------------THIS LINE
        when 1, 'add', '+'                                   # Adding
          $game_self_variables[key] += value
        when 2, 'sub', 'subtract', '-'                       # Subtracting
          $game_self_variables[key] -= value
        when 3, 'mul', 'multiply', 'x', '*'                  # Multiplying
          $game_self_variables[key] *= value
        when 4, 'div', 'divide', '/'                         # Dividing
          $game_self_variables[key] /= value if value != 0
        when 5, 'mod', 'modular', '%'                        # Modulating
          $game_self_variables[key] %= value if value != 0
        end
      else
        return $game_self_variables[key]
      end
      if value != nil
        $game_map.need_refresh = true
        return true
      end
    end
  end
end



I have a feeling it's just the syntax I'm messing up on.  Any ideas?

Shining Riku

Thanks Aqua. I'll take a look. :D

The reason why I asked is I figured I could edit the default scripts to do the critical noises, But now I dunno ha ha  :^_^':

So i'll go looking for now. I'll keep that script sniplet you showed me in mind though (I tried using it, but I guess I don't know how to get it to use the SE I need. I can't remember if I need " " around the SE name or not)

Aqua

Just add it in Game_Battler 3
Where the critical stuff takes place in attact_effects or whatever it's called

Blizzard

@Satoh: Don't do it like this. Instead in the refresh method you should add the items like you need them to be displayed. Then in the draw_item method just remove the quantity display.

Instead of the default loop to get all items, use this one:

data = []
(1...$data_items).each {|id|
    $game_party.item_number(id).times {data.push($data_items[id])}}


Remember to change $data_items and item_number to $data_XXXs and XXX_number depending for what you need it.
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.

Satoh

Lol, Thanks again... I swear you fix things so easily and make it seem obvious... It's like looking back at childhood and wondering how 8 * 2 was ever a tough problem...(Ironically I always had issues with 8's... now they're the ones that come most naturally... binary and hexadecimal have changed my life.)

Eventually I'll probably find myself making a new battle system... but that's a ways off...

Thanks again.
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

G_G

How would we take a screenshot and use it as a bitmap?
Its for my save system. When you save, it snaps a picture of the map, then only displays a small square of it, and the small square is where you saved.

Is this possible?

Aqua

I saw a save system like this before...
Either on RPG Rev or CreationAsylum.
It requires the screenshot dll

There even was a system where an image /was/ the savefile D:

G_G

Could you help me find it? I've been searching RRR and CreationAsylum for awhile now.

Aqua

http://www.rpgrevolution.com/forums/?showtopic=13382
That one is for VX.
You can take the screenshot dll from there and maybe even learn how to do it in RGSS by looking at RGSS2?
XD

I'll continue searching.

winkio

If you just want a screenshot on map, look at Blizz-ABS.  That's how the pre-menu works, it takes a screenshot of the game then sets it as the background for the menu. ;)

G_G

all it does is call Spriteset_Map, and I'm trying to do that but I'm trying to make it a small rectangle and center that rectangle on the player. I'm trying to understand spriteset_map some more.

>__> this is confusing >.<

Satoh

November 15, 2009, 03:20:25 pm #333 Last Edit: November 15, 2009, 03:23:21 pm by Satoh
Quote from: game_guy on November 15, 2009, 03:09:06 pm
all it does is call Spriteset_Map, and I'm trying to do that but I'm trying to make it a small rectangle and center that rectangle on the player. I'm trying to understand spriteset_map some more.

>__> this is confusing >.<


call that first, than BLT a portion of it to a variable, and save that variable to the save file...?

I can't say I'd know how to do it myself, but recently I have found block transfer to be invaluable for just about any drawing method...

Alternately you could save the transfered image to a new file and have the save files look up an image file with a corresponding name...


I regret that I'm too inexperienced to explain HOW to do any of that... but I can at least give the suggested modus operandi...
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

fugibo

You can't BLT Spriteset_Map, it's not a Bitmap. AFAIK, there's no way to do this without taking a literal screenshot or synthesizing a map on the fly.

samsonite789

I haveth a question...

How doth one change thine global variables in thine scripts before the main processing occurreth? 

In other, modern english words:

How do I set something like &data_enemies[1].exp in the script editor instead of in a map event?  If I try to do it, it tells me the following:

undefined method [] for nil:NilClass


Satoh

November 15, 2009, 08:20:52 pm #336 Last Edit: November 15, 2009, 08:22:27 pm by Satoh
1. use a $ for global, not an &
2. Try adding "p $data_enemies[1].exp" on a line and see if it's producing the right info.
Requesting Rule #1: BE SPECIFIC!!

Light a man a fire and he'll be warm for a night...
Light a man afire and he'll be warm for the rest of his life... ¬ ¬;

My Resources

G_G

I would still like to know how to do the map screenshot thing, but I have a question.
Also @aqua: the vx thing didnt have the screenshot dll in it, it simply copied some stuff from spriteset_map, but seeing how vx's rtp is way different then xp, makes it so difficult.

Anyways, how would we rotate a picture or bitmap?

Fantasist

@G_G: Dude, you can find Screenshot.dll in my Transition Pack demo, with a good demonstration of how to use it >.<

@samsonite789: The $data_BLAH stuff are loaded in Scene_Title#main. So if you want to do anything, look for where they are loaded and do your magic after they are loaded.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Blizzard

I did a script once that would syntesize everything in Spriteset_Map to a bitmap, but the add-blended fog and weather were causing problems so I figured it's easier to go with a screenshot script.
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.