Tags

From OHRRPGCE-Wiki
Jump to navigation Jump to search
Tags as ON/OFF switch

Tags are switch used to toggle standard functions ON/OFF (for you programmers, it's an array of booleans).

Various actions in your game can turn tags ON or OFF such as talking to an NPC, or picking up an item. Other things can be set to check a particular tag and only work depending on whether it's ON or OFF. To name a few, you can make an NPC who will only appear if a certain tags is ON, an item that a shop will only sell if a particular tag is OFF, a door that leads to one place when a tag is ON and another if it is OFF.
This way it is possible to keep track of what events have already happened in your game and make changes accordingly.

Some types of tags are toggled true-false automatically, such as made to detect whether an item is in the inventory or equipped by the Hero. Others are manually set to ON/OFF using Text boxes or scripts.

There are two preexisting tags, 0 and 1, which are special.
Tag 0 True/ON is used for things that will always work without any condition, the same as not checking Tags; Tag 1 is always False/OFF, for anything you'd like to disable without removing entirely, such as features only used for play-testing your game.
All other tags, 2 through 15999 are user-defined, and can toggle between 0/ON and 1/OFF using various triggers throughout a game.

When the game starts all user-defined tags Begin as False/OFF.

You can assign names to your tags to help you remember what they each mean. For example, if tag 10 is ON while you have at least one potion in your inventory, and OFF when you are out of potions, you can name it "have potions". Or if tag 14 gets turned on after you talk to the King, you can name it "Spoke to King"

Lock and Key Tutorial:

Lock and Key using tags

The following tutorial creates an NPC that disappears only on direct contact by the Hero and if a tag has been triggered. This tag could be triggered in a variety of ways such as purchasing an item, winning or loosing a battle, stepping on an invisible NPC, and so forth.

From the Main Menu, go to the Map Editor and select a map;
In Edit NPCs, create two motionless NPCs, one for the lock/barrier, and another for the key;

Have the NPC-key Display Text. From here add a new text box which says "Found Key" and with a conditional.
Set the conditional SETTAG: Always do the following, Tag = ON, name the new tag 'Has Key'.
Press ESC to go back until you've returned to the NPC editor and make the NPC-Key Usable Once so the Hero can only pick up one copy.
(Or, rather, to skip the need for a text box have the NPC give an item that sets an automatic tag ON when in inventory)

Now for the Lock portion.
Change the second NPC's activation type to either Touch or Use so it can't be passed/stepped on. This makes a removable barrier;
Go to the Text Box Editor and make two text boxes.
Have the first say something like "Door Locked", it doesn't need to do anything else.
Make the second say "Door Unlocked" and with the conditionals:
INSTEAD: If Tag 'Has Key' = OFF, then do the following: show textbox "Door Locked"
SETTAG: If Tag 'Has Key' = ON, then Set tag 4 'Door Open' = ON
(If you used an automatic inventory tag from an item, also remove the item here with ITEM: Always do the following, Remove...)

When the INSTEAD condition is met, the textbox will skip the rest of the conditional list and immediately jump to the other text box.

Back to the NPCs editor, have the NPC-lock summon the text box which says "Door Unlocked" and Appear if Tag 4 'Door Open' = OFF.
This will make the NPC-lock trigger it's own Appear Tag and disappear if used with the key, otherwise, do nothing but display a 'Locked' notification.


Doors[edit]

Tags are used to make conditional door links which can change in the middle of your game.
By default a new door link will not check any tags (seen as Require Tag 0=ON (Always)).

You may optionally specify two tags that must be checked before the door can be used. This allows you to make doors which are locked/unlocked or that lead to different places when a certain condition is met.

Using separate maps and altering a door link is usually much easier than attempting to manipulate a huge number of linked tags or write a script to modify the map.

NPCs[edit]

Using Appear When... two tags can be checked to enable or disable an NPC on the map.

To have a tag change the appearance of an NPC place two different NPCs on the same tile (placed facing different directions), have one appear with Tag ON, and the other while the same tag is OFF. The game will start with the Tag OFF, and show this NPC first until the tag is changed.

NPCs can set tags indirectly, either using automatic Tags when the NPC is a vehicle or item, and also by summoning a Text Box with conditionals which sets tags manually or uses Choice option to set tags.

Items[edit]

Items can have four types of automatically set tags:
Own Item - At least one of that item either equipped or in inventory.
Is in inventory - Only items in inventory, Equipped items are NOT considered part of the inventory.
Is equipped - Equipped by any character in the party, including inactive heroes.
Equipped by active hero Only currently equipped by the main Hero.

Items can not be modified by tags.

Text Boxes[edit]

Text Box conditionals to set tags

Use text boxes either with Choices or using Conditional: SETTAG to manually set tags.
All text Box conditionals are also Tag-dependent.


To check multiple tags chain several text boxes using the INSTEAD conditional. In the example below this is being used to dispense a particular item depending on an earlier choice by the Hero:

Text Box A
INSTEAD: If Tag 5 = ON... use Text Box B instead, otherwise ...
ITEM: Always do the following -give item A
Text Box B
INSTEAD: If Tag 6 = ON ... use Text Box C instead.
ITEM: Always do the following - give item B.
Text Box C
ITEM: Always do the following - give Item C.

One-Time Use Tags[edit]

NPCs can be set as usable only once which also uses an automatic ON/OFF tag system, previously referred to as 'One-Time use tags'. To avoid confusion with standard tags, these special One-timers are no longer worded as tags, but rather Flags.

The number displayed next to the Usable onetime setting is the unique tag ID number used for plotscripting purposes. One-Time flags work automatically and can only be manipulated with scripts, therefore, if you are going to want to manually manipulate your one-time-use flags, you might want to use a regular tag instead:

Name a tag. Then make the NPC only appear if this tag is OFF. Then edit the text box which is displayed when you activate the NPC, and in the "conditionals" screen, make the tag turn ON. The NPC will remove itself when used.

When you use the usable only once NPC, all copies of that NPC definition will be removed from the map (because they all share the same ID number!), and the usable only once flag will be turned on. If you want different copies of the NPCs to disappear independently, you have two choices. Either create multiple NPC definitions, or use the delete NPC script command instead of tags.

You can manually change or check a one-time-use flag using the set onetime and check onetime script commands.

Gallery of Tag Usage[edit]

  • Tags and Door Links
  • Tags and Attacks
  • Tags and Items
  • Tags and Menus
  • Tags and Shops
  • Tags and Vehicles
  • Tags and NPCs
  • Tags and Heroes

See Also[edit]