So I made a lil somethin'

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

So I made a lil somethin'

Post by Taco Bot »

Explanation of what it is/does in the script itself. Which is below.

So there you have it.

Code: Select all

#   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 &#40;zoneUnderfoot >= battleZoneStart && zoneUnderfoot <= battleZoneEnd&#41; then &#40;
				if &#40;getZoneExtra&#40;zoneUnderfoot, 0&#41; == battleZoneID&#41; then &#40;
					variable&#40;chance, set&#41;
					chance &#58;= getZoneExtra&#40;zoneUnderfoot, 1&#41;
					set &#58;= getZoneExtra&#40;zoneUnderfoot, 2&#41;
					fightSet&#40;chance, set&#41;
				&#41;
			&#41;
		&#41;
	&#41;
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&#40;&#41;
	variable&#40;rand, encounter&#41;
	rand &#58;= &#40;random&#40;1, 100&#41; / encounterMultiplier&#41;
	encounter &#58;= random &#40;1, 100&#41; ### Use this to determine the encounter. Use a range between 1 and 100 &#40;change this if you need more than 100 encounters for some esoteric purpose&#41;.

   if &#40;rand <chance>= 66&#41; then &#40;
               fightFormation&#40;1&#41;
            &#41; else if &#40;encounter >= 33&#41; then &#40;
               fightFormation&#40;2&#41;
            &#41; else &#40;
               fightFormation&#40;3&#41;
            &#41;
         &#41;
         
         ### 1&#58; Example 2 - Fights one formation 75% of the time, and one 25% of the time.
         case &#40;1&#41; do &#40;
            if &#40;encounter >= 75&#41; then &#40;
               fightFormation&#40;4&#41;
            &#41; else &#40;
               fightFormation&#40;5&#41;
            &#41;
         &#41;
         
         ### 2&#58; Fight a formation 90% of the time, show a textbox 10% of the time.
         case &#40;2&#41; do &#40;
            if &#40;encounter >= 90&#41; then &#40;
               fightFormation&#40;6&#41;
            &#41; else &#40;
               showTextBox&#40;42&#41; ### "You stumble upon a wandering merchant &#40;or something&#41;"
            &#41;
         &#41;
         
         ### Fallback
         case &#40;else&#41; do &#40;
            ### Absolutely nothing.
         &#41;
      &#41;
   &#41;
end
And an example newgame script that's quite necessary:

Code: Select all

plotscript, newgame, begin
   encounterMultiplier &#58;= 1
end
Last edited by Taco Bot on Thu Jun 02, 2016 3:06 pm, edited 2 times in total.
Sent from my iPhone
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

nimunimu
Last edited by Taco Bot on Thu Jun 02, 2016 3:06 pm, edited 3 times in total.
Sent from my iPhone
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

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.
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

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
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

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).
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

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
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

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: Select all

* Chapter 47 &#91;&#91;How to do foo and baz&#93;&#93;
* Chapter 48 &#91;&#91;How to make a blarg&#93;&#93;
(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)
Last edited by Bob the Hamster on Fri Jun 03, 2016 4:34 pm, edited 1 time in total.
User avatar
spheroidal_defence
Red Slime
Posts: 25
Joined: Mon Aug 04, 2014 10:13 pm
Location: CCCP

Post by spheroidal_defence »

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);
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

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
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

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
Post Reply