Story System

STORY SYSTEM for OpenBoR 2.1

No permission to download
The tutorial is great!

Now i have some specific problems, and i need your help.
When i create the dialogue with a character with a long name, the portrait dont appear.
Ex:  THE_CHOSEN_ONE

Other problem is the mod goes inestable. If i quit the game and restart, some times, the text of intro dont appear, or when  the game start and comes the first dialogie, the next dialogue never continues.
 
Remember to use _ instead of spaces in order for text with spaces to work.


I see that you like the tutorial, thanks!
 
The tutorial is wonderful!

This exact detail at every step, you just have to try without rush.

Thanks my friend!
 
nsw25 said:
Hey CRxTRDude Thought id post public with this issue so it may help others with similar problems. heres issue im facing

heres story text file

Code:
Punk 1 The_masters_will_not_be_happy, that_you_are_resisting! punk2
_player 0 I_like_to_play_hard_to_get! 2
Punk 1 We_will_return_you_to, the_alien_breeding_program. punk1 
Punk 1 mmmmmm, but_first_we_have_other_urges. punk1
_player 0 Its_a_hands_off_policy, here_you_mutated_creeps! 
end



Player is called asia, and her second available image (in this case Asia_2.gif) is not working as you will see in second line of text, instead plays asia.gif and displays number 2

2mrcupi.png


Other issues is 'end' is not working as its supposed to, instead it displays punk1.gif image for some reason and has following error



aauqe1.png


I have also tried

...
end

which was recommended and tried having a blank line before end, neither work... its very frustrating because I set it up the same as other text files yet the system seems buggy ?

and that didn't work either....

I have the same oroblem when add a second image for the same character, only shows the original.

Any idea?
 
Share the text file of the script you're talking about. Don't quote it, just give the file itself.

And again, don't forget to add an empty line after 'end'.
 
Ok!

Here the dialogue file (it's only a test):
Code:
Chosen One 0 Que_es_este lugar?
_fadepausemusic 1
Carolina 0 No_veo_a_nadie.
_fadepausemusic 0
Amazon 1 Nadie_saldra_vivo_de_aqui!
Kitana 0 Me_parece_que_alguien_quiere_morir.
_quickpausemusic 1
Amazon 1 Eso_lo_veremos!
Jago 0 Sera_una_muerte_rapida.
Liu_Kang 0 Casi_no_lo_sentiras.
Tusk 0 Es_hora_de_que_corra_sangre.
Batman 0 Que_empieze_la_fiesta.
Midas 0 O_podria_ser_algo_muy_doloroso.
Midas 0 Tu_vas_a_sufrir! Angry
Raiden 0 Es_tan_solo_una_enemiga.
_white 0
Carolina 0 Acaso_estan_todos_locos?
_playmusic 0	data/music/1boss.bor
_normal 0
end

 
I assumed you watched the video:

Use _ on the second message if you choose it to be empty, for example:

Code:
Carolina 0 No_veo_a_nadie. _

Your names also have the same rules applied as messages, use underscores instead of spaces.
 
Well... I update my mod to the last build and now the sytem works perfect and stable with your STORY SYSTEM.

But, the STORY SYSTEM continues without show my second image of the characters.
Yes, i see the video tutorial a few times, but cant find the problem.

The truth that this beats me, I do not understand what happens here.
What I mean is simply that "Midas_2.gif" file, appears in this line:
Midas 0 Tu_vas_a_sufrir! 2

There is something that confuses me even more, in this dialogue you put the image "happy" Kula, in 2 different ways in the same dialog:

_player 0 Not_yet,_this_might_be_fun. _ happy
_fadepausemusic 0
Angel 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.
Max 0 We_just_want_to_get_out_of_here.
Angel 1 Really?_I_thought_you_guys were_just_pulled_in?
_player 0 Oh_boy,_a_big_boobied_chick that's_going_to_get_her_butt_kicked! happy

1) _ happy
2) happy

What is the difference?
I tried both ways and no work for me.

Here my test dialogue:
Code:
Chosen_One 0 Que_es_este_lugar?
Carolina 0 No_veo_a_nadie. _
_fadepausemusic 0
Amazon 1 Nadie_saldra_vivo_de_aqui!
Kitana 0 Me_parece_que_alguien_quiere_morir.
Amazon 1 Eso_lo_veremos!
Jago 0 Sera_una_muerte_rapida.
Liu_Kang 0 Casi_no_lo_sentiras.
Tusk 0 Es_hora_de_que_corra_sangre.
Batman 0 Que_empieze_la_fiesta.
Midas 0 O_podria_ser_algo_muy_doloroso.
Midas 0 Tu_vas_a_sufrir! 2
Raiden 0 Es_tan_solo_una_enemiga.
Carolina 0 Acaso_estan_todos_locos?
end

Other problem comes when a player make a special move with a blue shadows.
The intro, and the portraits of the story system shows with wrong colors, almos blue colors, but rarely the gane not crash.

In the log says:
Code:
Warning: 27 script variants are not freed, dumping...
openbor_loadsprite
openbor_allocscreen
openbor_allocscreen
openbor_loadsprite
openbor_loadsprite
openbor_array
openbor_loadsprite
openbor_loadsprite
openbor_loadsprite
openbor_array
openbor_loadsprite
openbor_array
openbor_loadsprite
openbor_array
openbor_loadsprite
openbor_array
openbor_loadsprite
openbor_array
openbor_loadsprite
openbor_array
openbor_loadsprite
openbor_array
openbor_loadsprite
openbor_array
openbor_loadsprite
openbor_array
openbor_loadsprite

Release game data............	Done!
Release timer................	Done!
Release input hardware.......	Done!
Release sound system.........	Done!
Release FileCaching System...	Done!

**************** Done *****************
 
That's because, again, I use '_' as the second message.

Note: (color coded for complete understanding)

Code:
[color=red][name][/color] [color=yellow][dir][/color] [color=pink][message1][/color] [color=orange][message2][/color] [color=green][portrait][/color]

Message2 can be left blank like this:

Code:
[color=red]Nikki[/color] [color=yellow]0[/color] [color=pink]This_is_message_1[/color]  [color=green]nikki_happy[/color]

Notice orange (message2) is empty there.

But to avoid confusion, because we will eventually get confused especially when dealing with a lot of lines of dialog, we use '_' instead. Like so:

Nikki 0 This_is_message_1 _ nikki_happy



I also forgot to say that [name]_[portrait].png only works when you use '_player' as [name] and the current player has [name]_[portrait].png as its format name. When using character names as [name], that's the time you use the full filename.

Example: (assuming player is Kula, so therefore I got Kula_[portrait].png)

Kula as name.
Code:
[color=red]Kula [/color][color=yellow]0 [/color][color=pink]This_is_message_1 [/color][color=orange]this_is_message_2 [/color][color=green]kula_happy[/color]
Kula as player and using _player as name.
Code:
[color=red]_player [/color][color=yellow]0 [/color][color=pink]I'm_now_using_player [/color][color=orange]I'm_awesome [/color][color=green]happy[/color]

Notice the way I use the portrait whenever I use 'Kula' as full name, but I just remove 'kula_' when I use _player.

Sorry if this confuses you, but that's how the script was developed when Volcanic used it too and this is the only practical way to do this, and sorry that the tone of this is slightly harsh (i think), but I addressed most of it already in the video (except for _player though, which by then I should revise the video again real soon), so I apologize for that. I'll try to explain this better in the coming days, but right now, I'll just take some rest off first. I'll update the video once I'm good.



See your PM in just a moment.
 
This time works ok, thanks.
About the blue shadows,  i use all this scripts for thath:
trailer..c
trailer.h
traileru.c

First add the line in the character with personal trailer.c:
animation data/chars/chosen/trailer.c
Then here every scripts:

trailer.c (chosen_one)
Code:
#include "data/scripts/trailer.h"



void main()
{
	int i, j, k;
	void spr;
	int facing, cd;
	float a, z, x;
	
	void ent = getlocalvar("self");
	int anim = getentityproperty(ent, "animationid");
	void map;
	int elapsed_time = openborvariant("elapsed_time");

	if(anim == openborconstant("ANI_FREESPECIAL5")){ map = getentityproperty(ent, "colourtable", 0);}
	if(anim == openborconstant("ANI_FOLLOW8")){ map = getentityproperty(ent, "colourtable", 0);}
	if(anim == openborconstant("ANI_FOLLOW9")){ map = getentityproperty(ent, "colourtable", 0);}
	if(anim == openborconstant("ANI_FREESPECIAL8")){ map = getentityproperty(ent, "colourtable", 0);}
	setglobalvar("blahblah.map", map);


	if(elapsed_time%trailerd==0)
	{
		if((anim == openborconstant("ANI_FREESPECIAL5")) || (anim == openborconstant("ANI_FOLLOW8")) || (anim == openborconstant("ANI_FOLLOW9")) || (anim == openborconstant("ANI_FREESPECIAL8")))
		{
		spr = getentityproperty(ent, "sprite");
		x = getentityproperty(ent, "x");
		z = getentityproperty(ent, "z");
		a = getentityproperty(ent, "a");
		facing = !getentityproperty(ent, "direction");
		for(k=1; k<=trailermax; k++) //find an empty trailer slot
		{
			if(getglobalvar("trailer"+k+".s")==NULL())
			{
				setglobalvar("trailer"+k+".s", spr);
				setglobalvar("trailer"+k+".x", x);
				setglobalvar("trailer"+k+".z", z);
				setglobalvar("trailer"+k+".a", a);
				setglobalvar("trailer"+k+".f", facing);
				setglobalvar("trailer"+k+".c", trailerc*trailerd);
				break;
			}
		}
	}
	}
}

trailer.h
Code:
int trailermax = 50; total trailers the engine can handle
int trailerc = 5;  totally 5 trailer images for each character
int trailerd = 15;  delay to spawn next trailer, so trailer lasts for trailermaxtrailerd

traileru.c
Code:
#include "data/scripts/trailer.h"

void main()
{
	int i, j, k;
	void spr;
	int facing, cd;
	float a, z, x;
	float sx = 256;
	float sy = 256;
void map = getglobalvar(blahblah.map);
	for(i=1; i=trailermax; i++)
	{
		spr = getglobalvar(trailer+i+.s);
		if(spr)
		{
			cd = getglobalvar(trailer+i+.c);
			if(!cd) 
			{
				setglobalvar(trailer+i+.c, NULL());
				setglobalvar(trailer+i+.s, NULL());
				setglobalvar(trailer+i+.x, NULL());
				setglobalvar(trailer+i+.z, NULL());
				setglobalvar(trailer+i+.a, NULL());
				setglobalvar(trailer+i+.sx, NULL());
				setglobalvar(trailer+i+.sy, NULL());
			}
			else
			{
				if(openborvariant(game_paused)==0)
				{
					setglobalvar(trailer+i+.c, cd-1);
				}
				x = getglobalvar(trailer+i+.x);
				z = getglobalvar(trailer+i+.z);
				a = getglobalvar(trailer+i+.a);
				if ( getglobalvar(trailer+i+.sx) != NULL()) { sx = getglobalvar(trailer+i+.sx); }
				if ( getglobalvar(trailer+i+.sy) != NULL()) { sy = getglobalvar(trailer+i+.sy); }
				facing = getglobalvar(trailer+i+.f);
                                ,entity ,flag ,scalex ,scaley ,flipx ,flipy ,shiftx ,alpha ,colourmap ,fillcolour ,rotate ,rotateflip ,transparencybg
                                setdrawmethod(NULL(),1, 256,256,facing,0,0,6,0,0,0,0,0,getglobalvar(trailer+i+.colormap));
                                setdrawmethod(NULL(),1, sx, sy,facing,0,0,6,0,0,0,0,0,map);
                                drawsprite(spr, x-openborvariant(xpos), z-a-openborvariant(ypos), z-i, 0);

				setdrawmethod(NULL(), 1, 256, 256, facing, 0, 0, 6, 0);
				drawsprite(sprite, int x, int y, int z, int sortid)
				drawsprite(spr, x-openborvariant(xpos), z-a-openborvariant(ypos)-3, z-i, 0);
                                setdrawmethod(NULL(),0, 256, 256,0,    0,0,0,0,0,0,0,0,NULL());
			}
		}
	}
}

And  finally add this line in every level:
updatescript data/scripts/traileru.c

You think you can update this to work properly with your STORY SYSTEM?
 
CRxTRDude said:
How would I go over a for loop with this? Is it okay if you would care to help with that? Also, how efficient it would be?

I would run a loop from 0 to maximum text indexes, and get the textobject's text property of each index. That would tell you if the index you want is in use or not. Use an array to store the available ones, checking each time you use them and updating as necessary.

[list type=decimal]
[*]Find how ever many indexes you need.
[*]Each available index value is placed into an array that you then access with your own internal index system.
[/list]

Array example:
Code:
name        key             value
index_array <your index 0>  <available text index X>
index_array <your index 1>  <available text index Y>
index_array <your index 2>  <available text index Z>
...         ...             ...
...         ...             ...

This effectively gives you your own internal index system separate from the engine's, and that way you don't need to worry about reserving the engine text indexes at all. They're handled dynamically.

Here's an untested function that will return the first available index. Barring any silly typos it should do the job.

Code:
#define FALSE           -1
#define MAXTEXTINDEXES  50
#define VT_EMPTY        openborconstant("VT_EMPTY")

int find_index()
{
    /*
        find_index
        Caskey, Damon V.
        2015-02-06
        
        Find and return the first available text index.
        Returns FALSE if no indexes found.
    */

    int result;
    int i = 0;
    void text;


    for(i; i < MAXTEXTINDEXES; i++)
    {
        text = gettextobjproperty(i, "text");
        
        // Is property empty? If so the index is unused and avialble.
        if(typeof(text) == VT_EMPTY)
        {
            // Return index.
            return i;
        }
    }
    
    // If we got this far, no indexes were found. Must be all used up.
    log("find_index: No available indexes found.");
    return FALSE;
}
 
Thanks DC!
I'll check this carefully.
While I have learned more about the scripts, I am still far from understanding how they work exactly.
I appreciate all your help, now I'll see what I can do with this.
 
NP, also just fixed a typo that would have broken the function - there may be more I didn't see since I whipped this up from an iPad while in doctor's office.  :P

DC
 
Thanks for that one DC! I'll try and experiment with that when I have the time. If it works, I'll give you a heads up.

BTW, would it be a nice time to release a new release for OpenBOR now that Plombo did this nice job regarding mem leaks?

@dantedevil, i might check that out too after I got my work over DC's indexing system.
 
Thanks  both!
I don't understand how use the new script exactly.
I try creating a new file with the script "findex.c", and include in updated.c .
But not work.
 
W hat DC said is that there might be some things that can be fixed for the script. I'll try to check this out tomorrow though, I'm kind of busy these days.
 
If you guys are struggling with screwed up colormaps after using the story system, there is a way to fix that (thanks to Dantedevil for pointing this out).

I just recently rediscovered that NULL(), when set as entity in setdrawmethod, affects the entire global drawmethod. Since the story system uses screens, and screens are usually tied into the global drawmethod, this might screw up lots of things, from the alpha to the color map.

One way to remedy that is to put a setdrawmethod on endlevel.c that will revert back the drawmethod of the global screen to normal whenever the game is exited.

For example:

Code:
#include "data/scripts/story/story_clear.c"

void main()
{
   clearStory();
   setdrawmethod(NULL(),0,256,256,0,0,0,0,0,0,0,0,0,NULL());
}

I hope that this will help some people, dantedevil tested this and it works, so give it a try if the colormapping or alpha of your scrolling texts or dialogs are screwed up.

Again, thanks for all the people using this system on their mods, any questions, just reply on this topic or you can PM me personally. Thanks again!  ;D
 
I just recently rediscovered that NULL(), when set as entity in setdrawmethod, affects the entire global drawmethod.
Yeah, uTunnels said that a long time ago. I think I've already added it to the manual.
 
Not only in the manual, but the Wiki also has it already, so I thought 'rediscovered' was the right term for it, since it's already been documented on several occasions.
 
Back
Top Bottom