Story System

STORY SYSTEM for OpenBoR 2.1

No permission to download

CRxTRDude

Member
Here it is folks, something that I've been doing the entire time after doranikofu brought it up. I figured, how it works and how to implement it. Now I give you Story System for OpenBoR. As the name implies, it is a system for displaying dialog and scrolling text and images.

New version:

NOTE!: Please update your indexed variables if they use variables 25-50! Adjust story_define.h if necessary.

Quick what's new:
Version 2.1
- Stable typewritten text. Tested on my Android 5.1 device. Almost 1:1 to the PC version (quick side note FPS in Android is 150 tops, FPS in Android is 250 tops).
- Beeping in typewritten text, similar to a game you guys might know. Can be disabled by dabbling in the source code.
Version 2.0
- Finally! After all this time, I finally made typewritten text! It's been years, I know.
- Added a new function _speed to control the typewritten text.
Version 1.3
- Fixed a couple of possible bugs in scrolling text by rewriting the text scrolling system.
- Fixed minor parser system bugs.
- Added new commands _noskip, _back.
- Replaced _pausemusic and _fademusic into _quickpausemusic and _fadepausemusic respectively since fademusic() and pausemusic() can be toggled to be turned on or off.
- Added multiple sprite system (thanks Piccolo!)
- Added substitution flags for player name and gender nouns
Version 1.2
- Fixed a bug where you skip a dialog and it will retain the text after the dialog closes. This is because the system uses text objects instead of drawstring functions. Thanks NickyP for pointing that out.
- Fixed a bug where the dialog needed to have the {dir} function (such as _white).
- Added white out functions _white and _normal to documentation.

I whipped up a quick demo. I placed it open (unpaked) to allow people to see how it works. I also placed there the story system in a zip for implementation. There are instructions both in the demo and the story system zip for more details.

If there are bugs and suggestions and improvements towards the system, feel free to message here or PM me. As much as possible though, message here, so that everyone can help.
 
Last edited by a moderator:
It was hard though, studying the code that Volcanic did, but when I did my runthrough for the analysis in the dialog code, I decided to go all out and change the entire thing instead.

I got problems with this and things I still want to implement as well.

I have to fix the white problem though, I thought it was bugged out, but it worked fine actually. I'll have to update my documentation for this feature too.

I also need to add support for image text background instead of drawbox for people who want bitmaps instead of vector boxes.

I also tested the functions
Code:
pausemusic(var)
and worked as intended; as well as
Code:
shutdown(var,message)
with message on, but it does not support things like variable replacement (%d or %s), which would be neat. (I didn't place it in the code though, but I tried and tested it and it worked).

Some cleanup and commenting though as well is needed.

BTW, are there things you can point out or suggestions that I can improve for the system? Since this is script and all and it's a mess though. I know that using indexed vars is the right decision for this one since it will not be kept in save, but there's some things that I need to use global vars about and I'm doubtful if they can be indexed as well, since there is no need for these in the savefile nor being persistent throughout the playthrough.

If only there was case in there, it would be less messier ;)
 
The only bug I saw is pressing Attack1 prematurely will skip all but the first sentence in the first set of dialogue.

Even still, excellent work CR!
 
You mean attack2? I set attack1 for run through the text and attack2 for the skip.

Anyway, I think it has something to do with the fact that I used text objects instead of drawstring functions which Volcanic used, not only that text objects are better than drawstring for displaying static images, but also it doesn't need to have the screen set up, which was a problem I faced when using drawstring when I replaced the text box image with drawbox.

It's got something to do with the stopping mechanism as well and I got the solution for it. I'll fix that before I go to bed, then will put over the updated version.  :)
 
@NickyP: Thanks for pointing the bug, Front page with the new link. It also comes with fixes and stuff as well.

I'll do some more updates for the system, but for now, I go get some rest. From where I'm at, good nyt guys.  :)
 
Check the readme in the demo for instructions. Majority of dealing with the system is manipulating with text files and only dealing the story folder contents as well as the story entity if you only just want the dialog. I centralized everything for the system's scripts so that they're isolated to the code itself. I want this to be just placed over games without putting too much code. The white script though for updated I might want to separate that too, but I'll do that later when I do a significant change of the code.

For the glitch effect, I want to say that it's an effect, but it's actually just the black shadow of the sprite doing an additive peeking. The background is actually the background for the grid level. You could make your own level background with just black and panels that are just black to avoid this. I'll try to find a way, probably investigating the drawing method.
 
I like it , compact and based on alias, i might use it for he-man later :)
First scrolling text is very choppy but last one with credits looks nice, would be better to hide lifebar , its not that easy tho, level type needs to be changed to 2 or somethin.I wanted to hide lifebars on he-man map but i left them eventually.Too bad such simple thing requires you to write own gameover logic.
 
Fantastic work, CRxTRDude! :D I like how the story system is implemented. It's gonna be helpful for creating it.

Here's a question. How about using different portraits showing characters' facial expressions and actions? Like, using different images with names with numbers for portraits and dialogues. For example, you have Kula.gif, Angel.gif, etc., in the portrait folder. But then you need to pick another images and rename them as Kula1.gif, Angel1.gif, etc. in the same folder. Plus, in the dialogue txt, it would be like this:

Kula 0 Nice_place_we_got_here! It's_like_some_AR_game.
Max 0 Only_this_time_it's_real,_right?
_pausemusic 1
Mandy1 0 This_is_getting_stranger_every_second. Let's_get_out_of_here.
Kula1 0 Not_yet,_this_might_be_fun.
_pausemusic 0
Angel1 1 Uh-uh,_not_so_fast_losers. You're_not_going_to_get_out_of_here_alive.
Mandy 0 We_don't_want_any_more trouble,_you_know.

(Dunno if it's possible, maybe I could try it out to test any time.)

I had a same thought as bWWd for hiding the HUD in the credits and the intro (level) screens. I know Pierwolf's KDEQ has the hidden HUD in a level txt.

EDIT:
I've been thinking about making animation with dialogues, but I know it will need frames for that and it seems it's gonna be complex when it comes to that. It's just an idea.

Look at 0:20-0:32, 0:43-0:54, 2:12-2:28, and 2:35-2:50, for conversational animation.

Ace Attorney Investigations: Miles Edgeworth CC09 Trailer
 
maxman said:

There's already a way to use different portraits for characters.

{name} {dir} {message1} {message2} {portrait}

By default, when you don't specify portrait, {name} will be set as the portrait. That gives convenience in specifying a portrait look.

Problem with this now is if you use _player as {name}, because it uses the player's name and we can't convey a different portrait for that character. I think I have an idea for this one though. Maybe the portrait can be syntaxed when you use _player as {name}.

eg.

_player 0 Do_you_want_some_exposition? Something_sang_through_a_song. happy

If your player chosen is "Kula", we can make the parser add happy to the phrase like so: "Kula"+"_"+"happy", therefore pointing the portrait to Kula_happy. This way, we can have different expression for players, therefore we can enforce a naming convention for the story system's portraits, but as usual, you can customize this.

For the animation, that's even more complicated, it would be better if we use animated gifs for portraits though if that's the case. We can then experiment with the animated gif functions that are not tested as of yet. Issue then is frame rate and memory and whether if it impacts the performance of the game with such placed.

With the hud, does he use a custom hud or is it the default OpenBOR hud?
 
LOL It's really a funny idea for the facial expression idea on the command. (_character *direction* *sentence1* *sentence2* *impression*) I will stick to the original way then.

He uses the custom hud for map stages with type 2. But I don't know if it will work for any non-map stages. Check this out for info. Dunno whether it'd be helpful.
 
maxman said:
Check this out for info. Dunno whether it'd be helpful.

This is what bWWd actually said too. I'll try it up and see what happens. This will be useful to the system since the way they go to their next level is by using jumptobranch. I'll add this now as well as the other logic as well. I also think that it needs to be documented as well.
 
Nice to see that you've already worked on this. In addition to multiple sprites for the same character, you could add support for multiple characters line.

In my mod I use ":" separators between images name to identify such lines.

Examples :
Victor_&_Sasquatch  victor8.png:sasquatch5.png: 0 Tee_hee_hee

bor%20-%200010.png



Zangief,_Victor,_Sasquatch zangief1.png:victor5.png:sasquatch1.png: 0 Mmm?

bor%20-%200011.png
 
Don't worry guys, an improved Story System is on its way. I have just polished the kinks and bugs as well as adding new features and other various stuff. I'll post it much later after I've completed documentation and modification of the system's components.
 
So what if player is a man instead of woman ,does his text change and others will use she/he , how wouldo you overcome this , or exchange their lines based on whhat character player will pick, so for example if player1 asks question then player 2 says yes if hes woman and says no if hes man, you know , different text based on who you are, cause it might be strange to use the same text for all player 1 characters.
 
If that's the case, how to determine what character the player uses? I've been wondering if I can call a script file in level.txt where they detect the name of the characters then determine their gender,setting an index var for the gender for players 1-4. From there, I can make use of what I learned in Piccolo's multiple character portraits to do some string slinging for indexes.
 
Back
Top Bottom