Blizzard's little tricks

Started by Blizzard, January 12, 2008, 12:50:57 pm

Previous topic - Next topic

Ryex

my contribution

Change Another Event's Self Switches


module Ryex #you can really name it wtat ever you want you don't have to use my name
 def self.flip_switch(event_id, switch, state)
   key = [$game_map.map_id, event_id, switch]
   $game_self_switches[key] = state
   $game_map.need_refresh = true
 end
end


called like this
Ryex.flip_switch(<event_id>, <Self_switch can be "A", "B", "C", or "D">, <state/ can be true or false>)


while this code is simple it open a whole lot of possibilities in the world of event systems. like this code

Spoiler: ShowHide

class Game_Event
 attr_reader :id
end

module CP
 
 def self.first_event_comment(event, comment)
   return (event.list.is_a?(Array) && event.list[0].code == 108 &&
        event.list[0].parameters[0] == comment)
 end
 
 def self.find_first_event(dir = $game_player.direction, range = 1, string = '')
   case dir
   when 2
     (1..range).each {|i| $game_map.events.each_value {|event|
     if event.x == $game_player.x && event.y == $game_player.y + i &&
         CP.first_event_comment(event, string)
       return event.id
     end}}
   when 4
     (1..range).each {|i| $game_map.events.each_value {|event|
     if event.y == $game_player.y && event.x == $game_player.x - i &&
         CP.first_event_comment(event, string)
       return event.id
     end}}
   when 6
     (1..range).each {|i| $game_map.events.each_value {|event|
     if event.y == $game_player.y && event.x == $game_player.x + i &&
         CP.first_event_comment(event, string)
       return event.id
     end}}
   when 8
     (1..range).each {|i| $game_map.events.each_value {|event|
     if event.x == $game_player.x && event.y == $game_player.y - i &&
         CP.first_event_comment(event, string)
       return event.id
     end}}
   end
   return 0
 end
 
 def self.trigger(string, range, switch)
   event_id = self.find_first_event($game_player.direction, range, string)
   return if event_id == 0
   key = [$game_map.map_id, event_id, switch]
   $game_self_switches[key] = true
   $game_map.need_refresh = true
 end
 
end


called like
CP.trigger(<string your searching for>, <range in fount of player>, <switch to turn>, 

it searches the number of squares specified in the range for events that have the specified string in a comment in the first line, then it turns a self switch in the first event it finds.
this small piece of code allows people to use common event called form skills and other places to target very specific events on any map, cool right?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Aqua

*gasp*
With this... a hookshot for Blizz-ABS /should/ be possible!!! :O

*levels up*

Ryex

thanks but you should lv up blizz too because he helped me with the second part
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

fugibo

Ry, you realize you can speed that up slightly by using more inline code, right? For example:

    key = [$game_map.map_id, event_id, switch]
    $game_self_switches[key] = state

can be

    $game_self_switches[[$game_map.map_id, event_id, switch]] = state

Zeriab

Good work Ryexander :D
The difference insignificant and I find the split method easier to read. I prefer the presented version.

Blizzard

:???: Hookshot = Event that runs on a specific flail weapon. Did nobody notice that yet?

Also, I think this topic is going the wrong way.
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.

Ryex

Quote from: Blizzard on June 15, 2009, 06:25:01 pm
:???: Hookshot = Event that runs on a specific flail weapon. Did nobody notice that yet?

Also, I think this topic is going the wrong way.


I think Aqua meant the hookshot from Zelda where you could stick it into walls / other objects and get pulled to them, so you could stick it into a rock on the other side of a gap and get pulled across... and theoretically yes that you could do

and what do you meant by 'going the wrong way'
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

This topic isn't about scripts. It's about what simple small useful things you can do with RPG Maker, yet people are stupid enough to make scripts for that kind of functionality.
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.

Zeriab

Terrain tags <3
Self-switches in common events <3

:3

http://paste-bin.com/view/ea2858c4

>_>

*runs*

Memor-X

just wondering, i know that you can store more that numbers in a variable but can you make a variable as an array or can you only do that in scripts

Blizzard

$game_variables[ID] = [1, 2, 3]

Now it's an array containing 1, 2 and 3. Just be careful when not using variables what they were intended for: numbers.
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.

Calintz

Hey Blizzard, does that command line work as syntax for the "call script" command??

G_G


Calintz

Thanx =D
That will shorten up CACCES.

winkio

This is somewhat random, and I don't know how useful, but you can make faster/slower bgs sounds by pitching it higher or lower.  So, you could get a really fast river or a really slow river just by pitching the river bgs.  Could be used to make a part like in ff7 where you cant cross a bridge when the wind is blowing really hard, or else you get blown off.  Just thought I'd throw this out here.

Shining Riku

Hey, I need some help with an issue I found with an event/script system I set up.

Initially I created it using Blizz's trick for assigning an actor's name to a variable. Using that trick I set up a multi-strike skill system that'd make the person using the skill use it again three more times for example.

However, it seems once the game stores the whole party's names in the variables I have, they don't reset when the party gets switched around/party members removed, and the like.

So basically once it stores those names in the variables the first time, it saves those settings! I can't get the variables to reset, and I was wondering if there was some way to, well, reset variables the hard way and clean them all out. This is the script sniplet I used in the Script commands. Once this gets fixed (if it does) I'll post the multi-hit system.

Spoiler: ShowHide
$game_variables[1] =
$game_party.actors[0].name


So after I do this, if the name it stores is "Joe", it stores Joe permanently and if I make Joe switch slots with Bob, Bob ends up being forced to use the remainder of Joe's attacks when he uses the multi-strike skill.

Did I explain enough? Too long winded and complicated? I seriously would like to know if there's a way to get the game to reset that variable...because it's making a few of my skills completely useless and I've done everything I can to make it work. >_>

winkio

you set one variable to another.  It keeps the value that you set it to until you change it, in this case, Joe.  It you switch slots, you need to reset it the exact same way,

$game_variables[1] =
$game_party.actors[0].name

So just call that each time you switch slots.

Shining Riku

July 31, 2009, 11:09:00 pm #97 Last Edit: August 02, 2009, 01:04:21 pm by Shining Riku
I have it so each time the skills are used, it assigns those values and it should be reseting them, but it isn't.

It's in a common event, and that common event is run every time that skill is used. I have multiple people using the same system though with different skills. So, to prevent dumb stuff from happening I have a different set of skills and common events for every multi-hit skill.

So for whatever reason it won't reset, even with everything being checked every time the skills are used.
EDIT:

OMG...I figured out my issue. It's so stupid. I'm sorry I bothered you guys, but for whatever reason it helps me to figure out what I've done. Thanks for lending an ear. :D

Shining Riku

August 05, 2009, 12:58:24 am #98 Last Edit: August 05, 2009, 01:04:07 am by Starrodkirby86
I promised I'd post my skill system so here it is. No need to credit me, but don't steal it, k'?  :(

Stuff needed: 5 variables, the skills to be used for the Multi-Hit, and a common event.

Step 1: First, you need to create the multi-hit skill in your skills tab. Give it an MP cost. After it's set up copy that same skill and paste it into an empty slot and remove the MP cost from it unless if you want the skill to take additional MP for every attack.

Step 2: Now that your SKILL is set up, now go create a Common event. You can name it whatever you want, but I name my common events after the skills just for reference. Set up the common event like this:
Spoiler: ShowHide

Spoiler: ShowHide

Keep in mind this system is actor specific! Only actors named Bob can use this one in the example.

Step 3: Your common event is almost finished. Now, to make it work, change the Bob to the name of your actor that will be using the skill. Each slot is for one of the four positions in your party. In the first conditional branch, put in some Forced Actor actions like this:
Spoiler: ShowHide


Now when Bob uses Sword Dance, if he's the first person in the party He'll use it once. You could make him use it a hundred times if you wanted. Anyhow, notice the Variable the branch is calling is a 1. That's the actor's position in the party. Make the forced actions be used by the first actor, and always have it "execute now" You could have him use a whole bunch of different skills if you wanted! The possibilities are endless.

I'm going to have Bob use sword dance 3 times. This is what you do:
Spoiler: ShowHide


Now, he's covered no matter what position he has in the party. He'll use the skill three times after the first skill activates it, going for a grand total of four strikes. I explained this as best as I could.

Step 4: Now, all you need to do is connect this common event to your first Sword Dance skill in the skill setup tab. Now you need to Make sure Bob learns the skill, the one with the MP cost and the common event attached to it.

You're finished. Now test it out and have fun. There are many MANY things you can do with this system, but it takes some eventing knowledge to pull it off. PM me if you have any questions!  ;)

Hot! Lemme cover those images in spoilers first, they're burnin' my eyes off~ ~Love, Starrodkirby86

lonely_cubone

Sorry if this is a necropost, but I was hoping I could get some help using one of these.

I'm making a game where there are 4 main characters. At first you play as all of them seperately, but they eventually all meet each other. I'm currently using trick 5b (actually 5a #2) where you store the parties in variables and make new ones. However, is there some way to combine all of the parties at some point, including their items, gold, etc.?