public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers
Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Linked Switches
  • Original author: Shaz
  • Original date: November 27, 2013
  • Source thread: https://forums.rpgmakerweb.com/threads/linked-switches.20349/
  • Source forum path: Game Development Engines > Ruby Game System (RGSS) Scripts > RGSS3 Scripts (RMVX Ace)

Summary

Linked Switches 1.0 Shaz​Introduction Partner to the Linked Variables script, this script allows you to 'link' a switch with some other element in your game, so when you refer to that switch to retrieve its value, it goes off to check the link and returns the appropriate value. It is the equivalent of doing a Control Switches to set a switch, and then using the result in a Conditional Branch, but removes the Control Switches step. By adding a link for the switch, you never need to do a Control...

Archived First Post

Linked Switches 1.0
Shaz
Introduction
Partner to the Linked Variables script, this script allows you to 'link' a switch with some other element in your game, so when you refer to that switch to retrieve its value, it goes off to check the link and returns the appropriate value. It is the equivalent of doing a Control Switches to set a switch, and then using the result in a Conditional Branch, but removes the Control Switches step.

By adding a link for the switch, you never need to do a Control Switches to set its value - it always does the check for you at the time you are referencing the switch (so it will always be completely up-to-date).

Versions
Code:
1.0  Nov 27 2013  Initial Release
How to Use
Paste into a new script slot below Materials.
Edit the init_links method to add a new array element for each switch you what to link, along with a script command to eval whenever that switch is referenced.

Follow this format:
 
Code:
@links[variable_id] = 'eval_command'
where eval_command returns either a true or false value.

Examples:
Make switch 1 ON when the leader’s HP is less than 50%:
Code:
@links[1] = '$game_party.leader.hp_rate < 0.5'
Make switch 2 ON when actor 5 is in the party but not a battler:
Code:
@links[2] = '$game_party.all_members.include?($game_actors[5]) && !$game_actors[5].battle_member?'
Make switch 3 ON when the player is on maps 5, 8 or 10 (maybe you want to run a parallel process common event on those maps):
Code:
@links[3] = '[5, 8, 10].include?($game_map.map_id)'
Script

Download Here

Known Issues
This is not reliable for using a switch as a condition on an event page, as the condition behind the link may change more often than event pages are polled to determine which one is active.

FAQ


Credit and Thanks
- Shaz

Author's Notes
I have added a check to ensure this still works with save files made prior to implementing this script.
If you add this script to a project that's half finished, you may go back and remove any commands that change the values in linked switches, but you do not have to - they will effectively be ignored.
Free to use in commercial games.
Give credit.

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download

License / Terms Note

Credit and Thanks - Shaz Author's Notes I have added a check to ensure this still works with save files made prior to implementing this script.

Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#039#rgss3#script-archive

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar