News: Create your own galactic empire! OGame at Chaos Project!

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

Level: 119
Offline Offline

Gender: Male
Posts: 1839


Stopped using RMXP (until furthur notice).


View Profile WWW
« on: January 08, 2008, 07: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, 05:53:33 AM by Fantasist » Logged

Stopped using RMXP until further notice.<br /><br /><br />“Understanding rules is important because you should know when and how to break them.”<br /> - ???<br /><br />
Nortos
Has earned a custom title
Astral Trancist
*****

Level: 20
Offline Offline

Gender: Male
Posts: 1308


Celestial Bomb my Digital Ass


View Profile
« Reply #1 on: January 09, 2008, 12: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: 10
Offline Offline

Gender: Female
Posts: 1260

Lodi Dodi We Loves The Skadi


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

yea acually u dont need a script for that one Tongue

wait a min ill show you Tongue
Logged

My Girl Loves to Skadi All the Time
Sally
Sallygirl :P
Remexos Team Member
Astral Trancist
*****

Level: 10
Offline Offline

Gender: Female
Posts: 1260

Lodi Dodi We Loves The Skadi


View Profile
« Reply #3 on: January 09, 2008, 01: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, 01:49:54 AM by Susys » Logged

My Girl Loves to Skadi All the Time
Nortos
Has earned a custom title
Astral Trancist
*****

Level: 20
Offline Offline

Gender: Male
Posts: 1308


Celestial Bomb my Digital Ass


View Profile
« Reply #4 on: January 09, 2008, 06: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, 08: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: 20
Offline Offline

Gender: Male
Posts: 1308


Celestial Bomb my Digital Ass


View Profile
« Reply #6 on: January 09, 2008, 12: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, 12: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: 10
Offline Offline

Gender: Female
Posts: 1260

Lodi Dodi We Loves The Skadi


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

why will anyone defame me :'(  :'(
Logged

My Girl Loves to Skadi All the Time
Calintz
Remexos Team Member
Guardian of Chaos
*******

Level: 81
Offline Offline

Gender: Male
Posts: 3252


A Pixel's Worst Nightmare


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

Your doing a great job Fantasist!
Logged

<a href="http://profiles.us.playstation.com/playstation/psn/visit/profiles/Derek16438"><img src="http://fp.profiles.us.playstation.com/playstation/psn/pid/Derek16438.png" width="230" height="155" border="0" /></a><br/><a href="http://www.us.playstation.com/PSN/SignUp">Get your Portable ID!</a>

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

Level: 119
Offline Offline

Gender: Male
Posts: 1839


Stopped using RMXP (until furthur notice).


View Profile WWW
« Reply #10 on: January 10, 2008, 05: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

Stopped using RMXP until further notice.<br /><br /><br />“Understanding rules is important because you should know when and how to break them.”<br /> - ???<br /><br />
Justin
Guest
« Reply #11 on: February 13, 2008, 04: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
Remexos Team Member
Astral Trancist
*****

Level: 45
Offline Offline

Gender: Female
Posts: 1303

Posts: 1337


View Profile WWW
« Reply #12 on: February 13, 2008, 05: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: 20
Offline Offline

Gender: Male
Posts: 1308


Celestial Bomb my Digital Ass


View Profile
« Reply #13 on: February 13, 2008, 05: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
Remexos Team Member
Astral Trancist
*****

Level: 45
Offline Offline

Gender: Female
Posts: 1303

Posts: 1337


View Profile WWW
« Reply #14 on: February 13, 2008, 09: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: 20
Offline Offline

Gender: Male
Posts: 1308


Celestial Bomb my Digital Ass


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

check my stealth event system uses it in there
Logged

Valcos
Remexos Team Member
Astral Trancist
*****

Level: 45
Offline Offline

Gender: Female
Posts: 1303

Posts: 1337


View Profile WWW
« Reply #16 on: February 14, 2008, 06: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
Professor Legacyblade
Moderator
Astral Trancist
*

Level: 69
Offline Offline

Gender: Male
Posts: 1323


MWAHAHAHAHA!


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

These are useful, thanks for sharing!
Logged

Like fantasy? Come to my fantasy writing site, home of Myriad Souls and my  free stories.


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

Level: 10
Offline Offline

Gender: Female
Posts: 1260

Lodi Dodi We Loves The Skadi


View Profile
« Reply #18 on: February 16, 2008, 03: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

My Girl Loves to Skadi All the Time
Mad Scientist Fantasist
Astral Trancist
*****

Level: 119
Offline Offline

Gender: Male
Posts: 1839


Stopped using RMXP (until furthur notice).


View Profile WWW
« Reply #19 on: February 20, 2008, 02: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, 05:54:35 AM by Fantasist » Logged

Stopped using RMXP until further notice.<br /><br /><br />“Understanding rules is important because you should know when and how to break them.”<br /> - ???<br /><br />
Pages: [1] 2  All
  Print  
 
Jump to:  


*
*
Shoutbox
Latest Shouts
View All
Today at 05:48:49 AM Professor Ryexander Elm - lol
Today at 05:29:59 AM Flower Lady WhiteRose - Of course, so do the not so great ones.
Today at 05:26:47 AM Flower Lady WhiteRose - Fantastic. Every great journey begins with a single step.
Today at 05:25:43 AM Professor Ryexander Elm - it dose mean that we will have a functioning windowing system though
Today at 05:25:21 AM Professor Ryexander Elm - well sorta
Today at 05:22:30 AM Flower Lady WhiteRose - *golf clap* Great job! Once you get these windows finished, we should be able to create at least a semi-functional build of the game, right?
Today at 05:21:17 AM Elite Four Aqua - COol
Today at 04:49:42 AM Professor Ryexander Elm - Remexos members check the window thread scroll bars are working!
Today at 04:46:16 AM Professor Ryexander Elm - why are you suddenly ofline in MSN G_G!
Today at 04:23:08 AM Trainer Branden - Zy, you got proof? Besides the fact I sucked upon yours? Sarcasm

View All


RPG RPG Revolution ZVC Studios Time Stop Gamez HGW Development Evermoon Designs Sandbox Game Maker Loveless Entertainment