News: Blizz-ABS, the ultimate Action Battle System!

Pages: [1] 2  All
  Print  
Author Topic: Fantasist's Tips for Eventers  (Read 4628 times)
Fantasist
Astral Trancist
*****

Level: 123
Offline Offline

Gender: Male
Posts: 1932


Wretched Samurai! Once again you have eluded me!!


View Profile WWW
« on: January 08, 2008, 08:18:30 PM »

Fantasist's Tips for Eventers

       Events are a way to control the default scripts, eventing IS scripting in a way. There are certain things you can't do directly with event commands, but you don't need to resort to large script systems for a solution. Sometimes, pieces of code can be very useful. I'll be gathering those tips here in this thread. I'll keep this post updated with any new ideas I have. Feel free to suggest/request/ask anything. If you feel events are not getting your job done and you need a little more, this is your place.

Player and Event Positions on the Map


The map is a grid of 32x32 pixel tiles. Each tile has an adress in terms of X and Y coordinates. For some reason, if you want to know the player's/event's position on the current map, these are the lines of code:
Player's position:
Code:
$game_player.x  # The player's X coordinate
$game_player.y  # The player's Y coordinate

An Event's position:
Code:
$game_map.events[ID].x  # X position of the event. ID is the ID of the event in the map
$game_map.events[ID].y  # Y position of the event. ID is the ID of the event in the map

These can be very useful for things like minimaps. There is also another potential use for which I actually dug these lines: ranged actions. You can compare the distance between two events/player and make something happen. For example, you can make a caterpillar system where the event 'Follows the Hero' if the distance is more that 1 tile. You can make pets too: follow the hero if the distance is more than, say 6 tiles and move around randomly otherwise. That way, your pet wanders around near you but will follow you if you're too far.

Power of variables - Storing Strings


You know that variables are used to store numbers, right? Fact is, they can store pretty much ANYTHING, like text and even your current party. But for storing these other things, you should the Call Script command and use this code:
Code:
$game_variables[ID] = (thing to store)
where ID is the ID of the variable you intend to use. (thing to store) can be anything, mostly
Code:
'text' or "text"
or other things like
Code:
$game_party

How is this useful? You know that \n[1] will be replaced by the name of the first actor in the party, but what if you wanted to display the name of the first actor in the database? Or actually, if you want to display a frequently used or changing text in a message, what would you do? You'd use variables to store the text.

Let's cover the name of the actor first. To store the name of the 4th actor in the database, you'll use:
Code:
$game_variables[ID] = $data_actors[4].name
$data_actors[4].name is the name of the 4th actor in the database.

Now here's another use. Say you have multiple possibilities in your game, where a message is different depending on a switch. So instead of doing this:
Code:
<>Conditional Branch: Switch [0036: Heaven's Blade Unlocked] == ON
  <>Message: Heaven's Blade is the strongest weapon in existance.
  Else Handler
  <>Message: Ultima Blade is the strongest weapon in existance.
  End

You can do this:
Code:
<>Conditional Branch: Switch [0036: Heaven's Blade Unlocked] == ON
  <>Script: $game_variables[1] = 'Heaven's Blade'
  Else Handler
  <>Script: $game_variables[1] = 'Ultima Blade'
  End
<>Message: \v[1] is the strongest weapon in existance.
And actually, you can simple use \v[1] whenever you want to refer to the strongest weapon in existance.

Range - distance between two points


Let's say there's two ppoints on the map and you want to find the distance between them. These two points can be anywhere, one below the other, vertically aligned, horizontally aligned, or diagonally placed at a distance. If you're familiar with the Pythogoran rule for the hypotenuse of a right angled triangle, this is exactly that, it gives the distance between two points:
Code:
Math.hypot(x2 - x1, y2 - y1)
where x1, x2, y1 and y2 are the coordinates of the points (x1, y1) and (x2, y2).
It's mostly cartesian geometry, nothing complex once you know the basics. This piece of code can be VERY WELL USED in conjunction with Player and Event Positions on the Map to make ranged systems, the same things discussed in Player and Event Positions on the Map.

Get All Items


Ever wanted to have ALL the items during debug? I for one find it irritating using lots of 'Add Item' event command. Now, paste the following code into a 'Call Script' event command and you have all the items:

Code:
itemdata = load_data('Data/Items.rxdata')
wpndata = load_data('Data/Weapons.rxdata')
armordata = load_data('Data/Armors.rxdata')
(1..itemdata.size).each {|id| $game_party.gain_item(id, 99)}
(1..wpndata.size).each {|id| $game_party.gain_weapon(id, 99)}
(1..armordata.size).each {|id| $game_party.gain_armor(id, 99)}
$game_party.gain_gold(999999999)

The last line makes you VERY rich, you can remove it if you want.

Shop Everything


Same as above, for shops. Paste this anywhere above 'Main' and below 'Window_ShopBuy'. You need to set the SHOP_EVERYTHING_ID to the ID an item you make in the database. When you call a shop with that item, it'll call a shop with ALL items, weapons and armors (no exceptions).

Code:
class Window_ShopBuy
 
  SHOP_EVERYTHING_ID = 1
 
  alias fant_shop_everything_win_shop_buy_init initialize
  def initialize(shop_goods)
    if shop_goods[0][0] == 0 && shop_goods[0][1] == SHOP_EVERYTHING_ID
      goods = []
      # Items
      (1..$data_items.size).each {|i| goods.push([0, i])}
      # Weapons
      (1..$data_weapons.size).each {|i| goods.push([1, i])}
      # Armors
      (1..$data_armors.size).each {|i| goods.push([2, i])}
    end
    fant_shop_everything_win_shop_buy_init(goods)
  end
 
end
« Last Edit: July 26, 2008, 06:53:33 AM by Fantasist » Logged

I have stopped developing code for RMXP. And as of now, I am no longer going to update or even properly support my scripts. I just might, but don't count on it. So you collectors out there might want to download any of my demos and stuff before Sendspace deletes them from their server.

I hate to leave my work unsupported, but I'm just not willing to spend my mental resources on RGSS anymore. So, I welcome the other scripters here to use/adapt my scripts and post their modified versions if they want.

Sorry and thank you.

Nortos
Has earned a custom title
Astral Trancist
*****

Level: 19
Offline Offline

Gender: Male
Posts: 1303


Celestial Bomb my Digital Ass


View Profile
« Reply #1 on: January 09, 2008, 01:18:39 AM »

love that code
Code:
$game_player.x  # The player's X coordinate
$game_player.y  # The player's Y coordinate
it can be used for when passing through an area to trigger an autorun instead of lot's of player touches. Oh btw Fantasist would it possible for some code to say after 10 steps after some event you can make another event
Logged

Sally
Sallygirl :P
Remexos Team Member
Astral Trancist
*****

Level: 11
Offline Offline

Gender: Female
Posts: 1281


View Profile
« Reply #2 on: January 09, 2008, 02:40:26 AM »

yea acually u dont need a script for that one Tongue

wait a min ill show you Tongue
Logged
Sally
Sallygirl :P
Remexos Team Member
Astral Trancist
*****

Level: 11
Offline Offline

Gender: Female
Posts: 1281


View Profile
« Reply #3 on: January 09, 2008, 02:48:57 AM »

okay 2 things..

1 why do i have -1 energy Sad Sad Sad Sad

and 2:

hear u go nortos!

Even one place on map
Code:
<>Message: After 10 steps after this event there will be another
:              : event :)
<>Switch: [0001: Event-up] = ON
<>

Common event:
NAME: event Trigger: Parallell Process Trigget switch: 0001: Event-up
Code:
<>Variable: [0001: steps] = Steps
<>Conditional Branch Variable [0001: steps == 10
     <>Message: see? 10 steps after! :) no scripts
     :              :
     :              :             -Sally
     <>
:    End
<>
« Last Edit: January 09, 2008, 02:49:54 AM by Susys » Logged
Nortos
Has earned a custom title
Astral Trancist
*****

Level: 19
Offline Offline

Gender: Male
Posts: 1303


Celestial Bomb my Digital Ass


View Profile
« Reply #4 on: January 09, 2008, 07:46:40 AM »

oh ty must of overlooked variables...
Logged

Galatea
Reborn Member
**

Level: 8
Offline Offline

Gender: Male
Posts: 124


Im Listening. . . *Chuckles*


View Profile
« Reply #5 on: January 09, 2008, 09:32:07 AM »

@Susy, i think someone defame/powerdown/minus your energy.
you've got to ask who did that, and why.
Its just my opinion, it might be wrong.  :-\
Logged

wanna see my artworks?

 > > > http://oratorium.deviantart.com/ < < <

Earth Valor : Progress 15%
Nortos
Has earned a custom title
Astral Trancist
*****

Level: 19
Offline Offline

Gender: Male
Posts: 1303


Celestial Bomb my Digital Ass


View Profile
« Reply #6 on: January 09, 2008, 01:13:40 PM »

that's only way I could think of she could get it unless a bug, oh and maybe put if want to continue this convo in feedback board, don't want to get too offtopic
Logged

Galatea
Reborn Member
**

Level: 8
Offline Offline

Gender: Male
Posts: 124


Im Listening. . . *Chuckles*


View Profile
« Reply #7 on: January 10, 2008, 01:01:27 AM »

oh yeah, sorry bout that.
Logged

wanna see my artworks?

 > > > http://oratorium.deviantart.com/ < < <

Earth Valor : Progress 15%
Sally
Sallygirl :P
Remexos Team Member
Astral Trancist
*****

Level: 11
Offline Offline

Gender: Female
Posts: 1281


View Profile
« Reply #8 on: January 10, 2008, 03:01:13 AM »

why will anyone defame me :'(  :'(
Logged
Calintz
Guardian of Chaos
*******

Level: 87
Offline Offline

Gender: Male
Posts: 3322


A Pixel's Worst Nightmare


View Profile
« Reply #9 on: January 10, 2008, 05:34:54 AM »

Your doing a great job Fantasist!
Logged

Calintz: A Pixels Worst Nightmare
Fantasist
Astral Trancist
*****

Level: 123
Offline Offline

Gender: Male
Posts: 1932


Wretched Samurai! Once again you have eluded me!!


View Profile WWW
« Reply #10 on: January 10, 2008, 06:59:43 AM »

ty Calintz Happy

@Susys:
Quote
why do i have -1 energy
I have the same problem at RMRevolution. Dunno what the problem is. I'll give you energy if it helps Happy
Logged

I have stopped developing code for RMXP. And as of now, I am no longer going to update or even properly support my scripts. I just might, but don't count on it. So you collectors out there might want to download any of my demos and stuff before Sendspace deletes them from their server.

I hate to leave my work unsupported, but I'm just not willing to spend my mental resources on RGSS anymore. So, I welcome the other scripters here to use/adapt my scripts and post their modified versions if they want.

Sorry and thank you.

Justin
Guest
« Reply #11 on: February 13, 2008, 05:56:31 AM »

 Hey, I was wondering if someone can help me out with the player and event potition event. If its possible can someone explain to me how it works? So like how I can use it for other things like mini-maps and that dog thing. Im still n00b to this so help would be appretiated. ;D
Logged
Valcos
Astral Trancist
*****

Level: 45
Offline Offline

Gender: Female
Posts: 1317

Posts: 1337


View Profile
« Reply #12 on: February 13, 2008, 06:01:36 AM »

Hey, I was wondering if someone can help me out with the player and event potition event. If its possible can someone explain to me how it works? So like how I can use it for other things like mini-maps and that dog thing. Im still n00b to this so help would be appretiated. ;D

 ^
 |
 |  My bad, thats me  ;D. Didnt realize I wasnt logged in.  :-\
Logged

"Its not gay to get a blowjob from another man, its only gay to give one"
-Albert Einstein
Nortos
Has earned a custom title
Astral Trancist
*****

Level: 19
Offline Offline

Gender: Male
Posts: 1303


Celestial Bomb my Digital Ass


View Profile
« Reply #13 on: February 13, 2008, 06:51:48 AM »

basically the best use I've found for it is a conditional branch where the condition is them being more than say 1x and less than 5 x which would mean they are 1-5 tiles away from the event and I aint that sure about the mini map part but that's basic of it
Logged

Valcos
Astral Trancist
*****

Level: 45
Offline Offline

Gender: Female
Posts: 1317

Posts: 1337


View Profile
« Reply #14 on: February 13, 2008, 10:34:47 PM »

Oh. lol Tongue Not really sure what you meant exactly, but I guess I'll just fool around with it for a couple hours.
Logged

"Its not gay to get a blowjob from another man, its only gay to give one"
-Albert Einstein
Nortos
Has earned a custom title
Astral Trancist
*****

Level: 19
Offline Offline

Gender: Male
Posts: 1303


Celestial Bomb my Digital Ass


View Profile
« Reply #15 on: February 13, 2008, 11:43:24 PM »

check my stealth event system uses it in there
Logged

Valcos
Astral Trancist
*****

Level: 45
Offline Offline

Gender: Female
Posts: 1317

Posts: 1337


View Profile
« Reply #16 on: February 14, 2008, 07:02:37 AM »

Alright, thanks! ;D
Logged

"Its not gay to get a blowjob from another man, its only gay to give one"
-Albert Einstein
legacyblade
Moderator
Astral Trancist
*

Level: 74
Offline Offline

Gender: Male
Posts: 1551


There is a fate worse than hell


View Profile WWW
« Reply #17 on: February 14, 2008, 07:19:35 PM »

These are useful, thanks for sharing!
Logged

Sally
Sallygirl :P
Remexos Team Member
Astral Trancist
*****

Level: 11
Offline Offline

Gender: Female
Posts: 1281


View Profile
« Reply #18 on: February 16, 2008, 04:18:25 PM »

Quote
Range - distance between two points

that could help me in makeing arrows in my event ABS mini game Happy and spells
Logged
Fantasist
Astral Trancist
*****

Level: 123
Offline Offline

Gender: Male
Posts: 1932


Wretched Samurai! Once again you have eluded me!!


View Profile WWW
« Reply #19 on: February 20, 2008, 03:51:32 PM »

I said long back that i'll explain the function 'hypot', sigh, I've lost touch... maybe another time...

EDIT: Added "Get All Items".

PS: Do anyone even find this useful?

EDIT 2:

Added Shop Everything code.
« Last Edit: July 26, 2008, 06:54:35 AM by Fantasist » Logged

I have stopped developing code for RMXP. And as of now, I am no longer going to update or even properly support my scripts. I just might, but don't count on it. So you collectors out there might want to download any of my demos and stuff before Sendspace deletes them from their server.

I hate to leave my work unsupported, but I'm just not willing to spend my mental resources on RGSS anymore. So, I welcome the other scripters here to use/adapt my scripts and post their modified versions if they want.

Sorry and thank you.

Pages: [1] 2  All
  Print  
 
Jump to:  


*
*
Shoutbox
Latest Shouts
View All
Today at 04:15:43 AM Branden - No... it is very happy! Naughty
Today at 03:53:25 AM ProjectTrinity - That's a sad ending. D=
Today at 03:51:11 AM Branden - Thanks. Shy
Today at 03:44:29 AM Cait Sith - You helped a lot.
Today at 03:34:40 AM Branden - Wait... didn't I?
Today at 03:31:10 AM Cait Sith - Hey, don't blame me, this place took my innocence.
Today at 03:31:01 AM Branden - Well, it is Monday... Mondays make me horny. *sigh*
Today at 03:27:23 AM Calintz - I must say ... the two of you seem quite disturbed, Lol.
Today at 03:25:46 AM Branden - Then all conscious, and unconscious beings were raped. The end.
Today at 02:42:33 AM Cait Sith - How would you choose to end the story?

View All


RPG RPG Revolution HB Games Evermoon Designs Sandbox Game Maker Loveless Entertainment Decisive Games Cait Sith's Domain