Author Topic: [XP] Self-Variables  (Read 4939 times)

DrakoShade

  • Guest
[XP] Self-Variables
« on: January 12, 2010, 04:09:23 PM »
Self-Variables
Authors: DrakoShade
Version: 1.0
Type: Interpreter Expansion and Event Control Modification
Key Term: Game Utility

Introduction

This script adds Self-Variables (like Self-Switches, but more than two options) to your events.  Treat them like what they are--  a hybrid between Global Variables and Self-Switches.  Each event will only want to look at and modify its own, so you can make a single event that uses @self_variable[1], copy-and-paste it 50 times on 10 different maps, and each one of them will be looking at its very own @self_variable[1], for whatever internal conditional branches or page conditions you told the original to use.

It's easy to use from within events, requiring a script call no more difficult than accessing a local variable in a script: @self_variables[X].  Even from an event that doesn't own the variable, it's possible with $game_self_variables[[map_id, event_id, variable_id]].

Features

  • Self-Variables for every event in the game.
  • Can use a Self-Variable in place of a Global Variable as a page condition (optional.)
  • Events access their own self-variables with very simple script commands.
  • An event's self-variables can be accessed from outside without much difficulty.

Screenshots

It's very difficult to screenshot a back-end improvement.

Demo

No demo.  The script should speak for itself if you have need of it.

Script

(click to show/hide)

Instructions

Paste above Main.

Calling an event's self-variables from outside said event requires a call to $game_self_variables[[map_id, event_id, variable_id]].  From within the event (in a Call Script box), it only needs a simple @self_variables[variable_id].

Compatibility

Untested with any version of SDK.
Incompatible with anything else that alters the refresh method of Game_Event.

Credits and Thanks

  • Me
  • Myself
  • I
  • Vodka.  Specifically, Stoli.

Author's Notes

Have fun.

Offline Aqua

  • Lexima Warrior
  • *******
  • Posts: 2554
  • LV: 118
  • Gender: Female
  • Quack!
    • View Profile
Re: [XP] Self-Variables
« Reply #1 on: January 12, 2010, 10:01:26 PM »
Ooh... nice :o
I've been wondering about this for a bit.

You should add credits within the script though...
Wouldn't want your credits to go lost D:

Offline Holyrapid

  • Astral Trancist
  • *****
  • Posts: 749
  • LV: 0
  • Gender: Male
  • Credit to FreshL on Deviantart
    • View Profile
    • My new Youtube channel!
Re: [XP] Self-Variables
« Reply #2 on: January 13, 2010, 08:49:56 AM »
This can be useful. DonĀ“t need to use like a thousand varibles just because events need different variables. Nice work :)

Offline cdaz

  • Trained Member
  • *
  • Posts: 15
  • LV: 1
    • View Profile
Re: [XP] Self-Variables
« Reply #3 on: August 30, 2015, 06:52:39 AM »
This is look awesome but I little confuse how actually use it.
I mean how to Control this Self-Variable and how to check it value.

I want to use it to make some simple HP system.
by use Self Variable start with 0 and increase every time player push action button on it.
When Self-Variable = 4 then erase event.

If there are some demo I think may be easier to understand how it work.

I made this event

Quote
@Script @self_variables[1]=0
@Condition Brunch : Script @self_variables[1]=0
@Text: Hello
@Brunch End

But noting Happened.

Offline ForeverZer0

  • CP's Pedophile
  • Global Moderator
  • Guardian of Chaos
  • ****
  • Posts: 3248
  • LV: 294
  • Gender: Male
  • Remember you are unique, just like everyone else.
    • View Profile
Re: [XP] Self-Variables
« Reply #4 on: August 30, 2015, 06:48:15 PM »
The condition should use 2 equal signs.
Code: [Select]
@self_variables[1]==0
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.