Is it possible for the game to know if you ran from the last battle and do something about it?

From OHRRPGCE-Wiki
Jump to navigation Jump to search

There are two ways to make something different happen after running from a battle. Both require plotscripting.

After Battle Script[edit]

Make a script with one argument, and set it as your after battle script. It will be run automatically after every battle on the map, and the argument will be true if you won the battle, or false if you ran away (or died).

plotscript, after battle, victory=0, begin
  if (victory) then, begin
    # stuff that happens when you win
  else
    # stuff that only happens when you run away
  end
end

Fight Formation Command[edit]

The fight formation plotscripting command returns a value of true if you win or false if you run (or die). You can use this in an if statement.

  if(fight formation(35)) then, begin
    # stuff that happens when you win
  else
    # stuff that only happens when you run away
  end

Running Away versus Dying[edit]

When you run away from a battle or die, false is returned in both cases. To distinguish between the them, you can use a script like this:

script, party alive, begin
  variable(i)
  return (false) #assume everyone is dead
  for(i,0,3,1) do, begin
    if(get hero stat(i,stat:HP,current)) then (return(true))
  end
end

plotscript, fight the boss!, begin
  if(fight formation(32)) then, begin
    #happy cutscene!
  end, else, begin
    if(party alive) then, begin
      #ran away cutscene
    end, else, begin
      #dead cutscene
    end
  end
end