Here is what I want to do, but I'm not sure how.
If a certain tag is on (call it "monstertag"), then the foemap of a map changes so that it has completely different random encounters.
I'm imagining it working like this: There is an autorun script on the map, that says "If monstertag is on, then replace foemap." So when the hero enters the map, if that tag is on, the foemap will be different.
The other option would be to create identical maps with different foemaps, but that would be a pain.
Script to Edit Foemap
Moderators: marionline, SDHawk
- Willy Elektrix
- Liquid Metal Slime
- Posts: 910
- Joined: Sun Aug 15, 2010 11:30 pm
I think your best bet would be to run an Instead Of Battle Script. I've never used one, so I'm not sure on some of the specifics, but there oughta be a way to make it pass the formation you would've fought as an argument to a script.
The way I see it working, you'd have an instead of battle script that goes like...
And you could repeat that for every kinda foemap in the game, the most important command being RandomFormation which may or may not only be a thing in the nightlies.
I can't think of or see any commands relating directly to the foemap, but you might be able to work around it this way?[/url]
The way I see it working, you'd have an instead of battle script that goes like...
Code: Select all
script,InsteadOfBattle,WhoWouldIFight,begin
switch (WhoWouldIFight)
case (DesertBattles)
if (CheckTag (MonsterTag))
then (
FightFormation (RandomFormation (DesertAndMonsters))
)
Else (
Fight Formation (RandomFormation (DesertNoMonsters))
)
I can't think of or see any commands relating directly to the foemap, but you might be able to work around it this way?[/url]
There aren't yet any script commands to read/write the foemap. Right now the simplest solution if you want to read/write them would be to place them as zones instead. And you can store metadata about frequency and which formation set to trigger in the zone extra data.
In fact I was planning to eventually add battle-triggering options to zones, which would obsolete foemaps, and would allow this sort of flexibility.
"random formation" has been around for a long time.
The instead-of-battle script gets two arguments. That's documented here (silly, I know): http://rpg.hamsterrepublic.com/ohrrpgce ... t_a_Script
If you want the tag to swap between formation sets with different battle frequencies then you can't really use the instead-of-battle trigger. Instead you should use an each-step script and calculate yourself when to trigger a battle. Here's how the builtin triggering works:
In fact I was planning to eventually add battle-triggering options to zones, which would obsolete foemaps, and would allow this sort of flexibility.
"random formation" has been around for a long time.
The instead-of-battle script gets two arguments. That's documented here (silly, I know): http://rpg.hamsterrepublic.com/ohrrpgce ... t_a_Script
If you want the tag to swap between formation sets with different battle frequencies then you can't really use the instead-of-battle trigger. Instead you should use an each-step script and calculate yourself when to trigger a battle. Here's how the builtin triggering works:
Code: Select all
battle_formation_set = [battleset of the tile the player stepped on]
IF (not disabled) THEN
random_battle_countdown = random_battle_countdown - battle_formation_set.frequency
IF gam.random_battle_countdown <= 0 THEN
random_battle_countdown = random(40,160)
(trigger a battle)
END IF
END IF
Last edited by TMC on Fri Sep 04, 2015 2:14 pm, edited 1 time in total.
- Willy Elektrix
- Liquid Metal Slime
- Posts: 910
- Joined: Sun Aug 15, 2010 11:30 pm
This makes a lot of sense. I think I can make this work.TMC wrote:If you want the tag to swap between formation sets with different battle frequencies then you can't really use the instead-of-battle trigger. Instead you should use an each-step script and calculate yourself when to trigger a battle. Here's how the builtin triggering works:
Code: Select all
battle_formation_set = [battleset of the tile the player stepped on] IF (not disabled) THEN random_battle_countdown = random_battle_countdown - battle_formation_set.frequency IF gam.random_battle_countdown <= 0 THEN random_battle_countdown = random(40,160) (trigger a battle) END IF END IF
All the battles in my game have a fairly cumbersome script because special events happen before and after each battle, but I can use a similar idea to yours above to solve this problem.
Thanks!
Last edited by Willy Elektrix on Sat Sep 05, 2015 2:38 pm, edited 1 time in total.