Conditional Door Links

From OHRRPGCE-Wiki
Jump to: navigation, search


This article walks you through changing door links in the middle of your game, using tags.

A main reason you'll want to do so is to switch to an alternative version of a map. For example, when a town is attacked houses become damaged. Corpses may lie on the floor instead of the previous townpeople... In Vikings of midgard, one of the first heroic actions of the vikings is to save Ironwood Forest, which has been poisoned. If you edit the game, you'll see two maps! A first one for the poisoned forest and a second one after the quest.

Using separate maps is usually much easier than attempting to write a script to modify the map.

Multiple door links[edit]

You can create multiple door links leading from the same door as well as to the same door. When you stand on a door, Game.exe will search the door links from top to bottom until it finds one for the right door, and which meets both of the two tag conditions. If none do, then the door does nothing.

So beware that a door link won't work if another one masks it. You won't be told if it's impossible for a door link to be used.

Example[edit]

In our example

  • on the world map (map 0), door 4 leads to door 0 on map 5
  • on the village map (map 5) door 0 leads to door 4 on map 0
  • the destroyed village is map 4

We'll create additional door links on the world map that'll be used once the village has been destroyed after a cutscene.

First, place normal door(s) to exit from the destroyed village. Suppose the exit from map 4 is door 6. Go into the link door editor and add:

door 6 exit door 4 exit map 0

Now we'll need a tag. Enter the "Edit Tag Names" menu from the main menu. Pick a free tag and give it an appropriate name like "village destroyed". In this example, it'll be number 14.

Go back to editing the world map (map 0). Edit door links. Search for the village door link and modify it to:

Entrance door 4
Exit door 0
Exit map 5 
Require Tag 14=OFF (village destroyed)
Require Tag 0=ON (No Tag Check)

You now will add another door link:

Entrance door 4
Exit door 6
Exit map 4
Require Tag 14=ON (village destroyed)
Require Tag 0=ON (No Tag Check)

Now to test it. We want some way to set the tag, so create a new textbox in which you write something like

 It is terrible! The village have been attacked!

Edit the conditionals:

SETTAG: Always do the following
 set tag 14=ON (village destroyed)

Go back the edit map menu and edit the world map. Give the text box to an npc and place it on the map. You can now save your game and test the whole thing!

See also[edit]