Post new topic    
Meat, Cheese, and Silicon
Send private message
So I made a lil somethin' 
 PostTue May 31, 2016 5:34 am
Send private message Reply with quote
Explanation of what it is/does in the script itself. Which is below.

So there you have it.

Code:

#   TacoBot's Universal Better Encounter System (TUBES)
#     A super cool replacement to the OHRRPGCE's foemapping system that
#     comes with a side of rice and beans!
#
##### Benefits over regular foemapping system:
#
# * MANY more encounter sets (4,294,967,294 as opposed to 255!)
# * Set as many encounter rates to a single foemap as you'd like! (Rates
#   aren't dependent on formation set)
# * More control over encounters! Want to make enemies appear only if 3
#   globals are set to certain values? No problem!
# * Encounters can do anything scriptable! Want an encounter to show a
#   textbox, give you an item, create an npc, etc.? No problem!
# * Up to 100 "occurences" per encounter set Want more? Good heavens,
#   that's a lot of encounters... but you can do it, no problem!
# * Up to 15 encounter sets per tile (zone limitation)
# * Up to 9999 encounter sets per map!
# * Ability to call foemap any time! (Default foemap only works like an
#   "each step" script)
#
##### How to use at map level:
#
# Use zones between battleZoneStart and battleZoneEnd
#
# Set extra data like so:
#
# Extra data 0: battleZoneID (arbitrary constant that identifies the
#               zone as a foemap)
# Extra data 1: Encounter chance (% chance of encounter every step [or
#               whenever you call the script])
# Extra data 2: Encounter set (defined way down below)

define constant, begin
   1337, battleZoneID  ### Completely arbitrary. Set it to a number that zones in battle zone range would never use otherwise.
   1, battleZoneStart ### Start of battle zones.
   9999, battleZoneEnd  ### End of battle zones.
end

global variable, begin
   300, encounterMultiplier ### Modifier for encounter rates. Eg: 1 = Default rate, 2 = 2x rate, etc. Set this to something in your new game script. Set to 0 to disable all encounters.
end

### Call this in your eachstep script for any map on which you'd like encounters (or put if somewhere else if you want to be creative)

plotscript, battleZoneCheck, begin
   # Prevent division by zero
   if (encounterMultiplier > 0) then (
      variable(i, zoneUnderfoot)
      for (i, 0, 14) do (
         zoneUnderfoot := zoneAtSpot(heroX(me), heroY(me), i)
         if (zoneUnderfoot >= battleZoneStart && zoneUnderfoot <= battleZoneEnd) then (
            if (getZoneExtra(zoneUnderfoot, 0) == battleZoneID) then (
               variable(chance, set)
               chance := getZoneExtra(zoneUnderfoot, 1)
               set := getZoneExtra(zoneUnderfoot, 2)
               fightSet(chance, set)
            )
         )
      )
   )
end

##################################################
# WARNING! WORLD'S LARGEST SWITCH CASE INCOMING! #
# I can't think of any better way to implement   #
# this without arrays. If you can, I'd love to   #
# hear about it.                                 #
##################################################

plotscript, fightSet, chance, set, begin
   seedRandom()
   variable(rand, encounter)
   rand := (random(1, 100) / encounterMultiplier)
   encounter := random (1, 100) ### Use this to determine the encounter. Use a range between 1 and 100 (change this if you need more than 100 encounters for some esoteric purpose).

   if (rand <chance>= 66) then (
               fightFormation(1)
            ) else if (encounter >= 33) then (
               fightFormation(2)
            ) else (
               fightFormation(3)
            )
         )
         
         ### 1: Example 2 - Fights one formation 75% of the time, and one 25% of the time.
         case (1) do (
            if (encounter >= 75) then (
               fightFormation(4)
            ) else (
               fightFormation(5)
            )
         )
         
         ### 2: Fight a formation 90% of the time, show a textbox 10% of the time.
         case (2) do (
            if (encounter >= 90) then (
               fightFormation(6)
            ) else (
               showTextBox(42) ### "You stumble upon a wandering merchant (or something)"
            )
         )
         
         ### Fallback
         case (else) do (
            ### Absolutely nothing.
         )
      )
   )
end


And an example newgame script that's quite necessary:

Code:

plotscript, newgame, begin
   encounterMultiplier := 1
end

Sent from my iPhone
Meat, Cheese, and Silicon
Send private message
 
 PostTue May 31, 2016 8:23 pm
Send private message Reply with quote
nimunimu
Sent from my iPhone
Metal King Slime
Send private message
 
 PostThu Jun 02, 2016 10:57 am
Send private message Reply with quote
Cool! That's not too hacky; I think it's pretty practical.
You're going to have to edit your post to repost the script, and this time tick "Disable HTML in this post". It mangles < and > in the script without that.
Now that you changed from "read zone" to "zone at spot" you can remove the comment "(which should be a somewhat small range, or the game will chug)".

It might be a good idea to provide an example newgame script that sets encounterMultiplier to 1, because it won't work without that.

Rather than use a whole bunch of switch statements you could use regular formation sets defined in Custom. For example if the set number (in the zone extra data) is <= 255 then use a normal formation set, otherwise for anything higher, looking it up with a switch statement, for special effects.

The engine tries not to trigger two random battles too close together. It does this by using a countdown from a random starting point.

Finally I just noticed: whoa, you wrote a HOWTO chapter! Thanks for writing it, we really could do with progress on a new HOWTO. It's definitely more work to put a chapter together than it looks like.
I haven't checked the zip file you uploaded; why's it marked chapter 3-2? Anyway, it should probably have an explanation rather than just being linked.
Meat, Cheese, and Silicon
Send private message
 
 PostThu Jun 02, 2016 2:54 pm
Send private message Reply with quote
Thanks for the script help! I'll modify it a little and get back to you on that one. I could probably put together a countdown-type thing and use that instead.

And yeah, I did write a chapter, thanks for noticing (teehee). I also went back and finished the unfinished chapters before that one, and updated the screenshots to Callipygous. And the file is called "Chapter 3-2" because it's for chapter 3 part 2. At this point it's just and .rpg file with the directory layout shown in the "getting started" chapter. I thought it was saying there'd be an example file for each part showing the changes made, but if I'm wrong I can fixerupper in a jiffy.

I'm planning on helping with more chapters, but finals are drowning me at the moment.
Sent from my iPhone
Metal King Slime
Send private message
 
 PostFri Jun 03, 2016 12:12 pm
Send private message Reply with quote
Holy moly! The Recent Changes page was only showing the last 50 changes, so I missed your huge amount of other work too! Fantastic! I like the visual approach you took to showing things like the parts of the sprite editor GUI. And the fact that the screenshots are 1-2 decades more recent than the old ones :)

Yeah, I got completely confused that the new HOWTO has the chapters split into parts, which aren't shown in the list of chapters in the footer. (I think we really need to rename all the "Part X - Doing stuff" articles to "Chapter Y/Part X - Doing stuff", and put links in the footer.) You're right that the file links are explained, but it's probably worth having a terse description because not everyone will read the whole introduction (which is pretty long; having lots of unnecessary text just creates an obstacle for readers. Maybe not everything should be explained).
Meat, Cheese, and Silicon
Send private message
 
 PostFri Jun 03, 2016 4:02 pm
Send private message Reply with quote
Haha, thanks mango. Yeah, I noticed that the screenshots were a little out of date. For most it didn't matter, but some menus had a huge amount of new stuff added. Also, some of the screenshots were microscopic.

And I concur about the footer. When I was navigating around, I got mixed up between chapters and sections (doesn't help that all of the pictures in chapter 3, part 2 are labelled "chapter 4")

And consider the terse explanation added.
Sent from my iPhone
Liquid Metal King Slime
Send private message
 
 PostFri Jun 03, 2016 4:32 pm
Send private message Reply with quote
I don't think any howto chapters should contain numbers in their titles.

They should be named like "How to do foo and baz" or "How to make a blarg"

Any chapter and section numbers belong only in the main HOWTO page that links to the list of howto articles.

Code:

* Chapter 47 [[How to do foo and baz]]
* Chapter 48 [[How to make a blarg]]


(EDIT: Not suggesting I think this change is important, just throwing out my opinion. And renaming all the screenshots with "chapter" in the name definitely doesn't seem worth the effort)
Red Slime
Send private message
 
 PostFri Jun 03, 2016 4:52 pm
Send private message Reply with quote
Taco Bot wrote:
but finals are drowning me at the moment.

Ohoho since when did you study for those?

Anyway, if y'all want some feedback from a non-OHRRPGCE user, the whole HOW2 shebang is kinda confusing. I didn't realise I was supposed to be downloading and using a .rpg file until I saw the file down at the bottom.

And sure enough, the scary, big introduction told me I should have downloaded that file. Still, it might be more useful if there was a link up at the top.
reinterpret_cast<ClassB>(a);
Meat, Cheese, and Silicon
Send private message
 
 PostFri Jun 03, 2016 5:19 pm
Send private message Reply with quote
shh u bagel

And you're just supposed to be following along. The rpg file is so you can figgle out what's happening if you're lost beyond all hope.

But you're very right. The big scary introduction is exactly that.
Sent from my iPhone
Meat, Cheese, and Silicon
Send private message
 
 PostMon Mar 06, 2017 5:14 am
Send private message Reply with quote
So I've updated this script and added an example rpg file to go with it.

New features:

1. Uses a step based system instead of random chance. Set a range and it'll countdown to a battle. This is a much more reasonable system than using a random chance every step, and closer to the vanilla encounter system.

2. Compatibility with normal encounter sets. If set is between 1 and 255, use the normal encounter sets.

3. RPG file demos some of the stuff you can do with the system (textboxes, teleports, etc.)

linky link https://www.slimesalad.com/forum/viewgame.php?p=127433
Sent from my iPhone
Display posts from previous: