Documentation Project

O Ilusionista said:

White Dragon would be the person to ask about base maps. His coding style and mine are quite different and I might misinterpret what he really means.

In any case, sooner or later I'm going to wipe out ALL property access functions, be it entities, models, levels, whatever. Utunnel's, White Dragon's, mine - it's all going to go. It will all get replaced with a much simpler to use object style using constants (see my animation property work in progress for an example).

Multiple parameter function calls and string references should have NEVER been allowed - I blame myself for that one.

That's one (and just one) of the reasons I haven't been super keen to go through and document it all. I don't want the community getting too used to a style that's going to get changed anyway.

DC
 
I was searching for a non-kill setup in OpenBOR and I discovered that its not on the documentation.
Can any give me some more info about those things bellow?

NOKILL
nokill {bool}
The attack won't kill the target but will leave 1 HP.
Animation property, right? This will make all the attacks on the animation to not kill? Can we turn it on and off on the same animation, so one attack kills and other no?

nopain {bi}
Used to make the character not playing his/her PAIN animation when hit by a non-knockdown attack. He will continue what he is doing when attacked.
Entity header, right?

 
Nokill is an animation property and it has to be set with the attack command like this like this:
Code:
      attack4 100 90 25 40 15 1 0 0 25
      nokill 1
      dropv 3 2
      staydown 150 150

Now if you will have more attacks on an animation, i think you just should not include  nokill on them instead of nokill 0. But you better testing this one since i'm not sure anymore. Utunnels did explain this back then, but since hes account is inactive(guest), we can't browse hes posts from hes profile  :-\


And nopain is a Entity header command.

 
I finally managed to understand how Drawmethod Clip works:

drawmethod clip {x} {y} {w} {h}
~This one is on svn but is still experimental.

X - Start point in x axis (horizontal)
Y - Start point in y axis (vertical)
W - Width of the cropped area (horizontal)
H - Height of the cropped area

Note: All values starts at the IMAGE EDGE, not from the image axis, so it will start at the top left position.
The easiest way to get those values would be using OpenBORstats or other editor and draw a attackbox/body box where you want .

fN7jZkH.png


Important info: Gfxshadow will still show the whole sprite, not only the cropped area. And Mirror won't show the sprite at all.
I will add this info into the manual.
 
It seams that changedrawmethod isn't at the OpenBOR manual and I want to include it.
But I need help to undestand what each values does, specially the ones in bold.

// ===== changedrawmethod ======
enum drawmethod_enum
{
_dm_alpha, // Defines which alpha blending effect will be used. 0 means no alpha effect. -1 means the entity(if given) will use its own alpha value.
_dm_amplitude, // Sets the amplitude of sine wave for water effect
_dm_beginsize, //  Sets size multiplier of upper border. The upper border should be smaller than lower one cause the former is farther
_dm_centerx,  // Change the sprite x axis?
_dm_centery, // Change the sprite y axis?
_dm_channelb, // Defines the value for the B (blue) channel
_dm_channelg, // Defines the value for the G (green) channel
_dm_channelr, // Defines the value for the R (red) channel
_dm_clip, // ??
_dm_cliph, //  Defines the width of the cropped area (horizontal)
_dm_clipw, //  Defines the start point in x axis (horizontal)
_dm_clipx, //  Defines the start point in y axis (vertical)
_dm_clipy, //  Defines the height of the cropped area
_dm_enabled, // Enables the effect? What is the difference from FLAG?
_dm_endsize, //  Sets size multiplier of upper border of Water mode
_dm_fillcolor, // Is the colour used by the entire sprite. 0 means don't fill the sprites.  An integer value, from 0 to 255, specify a color index in your palette. It can be used with alpha, fill current frame with this color. You can either use a raw integer value or in R_G_B format, the later has better compatibility obviously.
_dm_flag, // defines whether the drawmethod is active, when set to 0, the drawmethod will not take effect.
_dm_fliprotate, // is binary value. When it is set to 1(should be only 0 or 1, not other values), the entity will change the rotate value when the direction is changed(entity's direction, if you use flipx for the frame, it is not affected), the rotate value will be 360-original, so
_dm_flipx, // defines whether the sprite will be flipped left/right. 0 means don't flip and 1 means flip. An integer value, when set to 1, the frame will be flipped leftright.
_dm_flipy, //  defines whether the sprite will be flipped top/bottom. 0 means don't flip and 1 means flip. An integer value, when set to 1, the frame will be flipped updown.
_dm_perspective, // Defines z depth effect it should have (Water mode)
_dm_remap, // Defines which colourmap will be used. 0 means no colourmap. -1 means the entity(if given) will use its current colourmap.
_dm_reset, // Reset any previous active drawmethod ??
_dm_rotate, // Is the rotate angle(clockwise), the range is from 0 to 359.
_dm_scalex, // Defines how the sprite will be stretch in x direction: sizex = original_sizex * scalex / 256
_dm_scaley, // Defines how the sprite will be stretch in y direction: sizey = original_sizey * scaley / 256
_dm_shiftx, // defines how the sprite leans, like lightx in gfxshadow feature
_dm_table, // Defines the colour table
_dm_tintcolor, // Will tint the sprite with given tintcolor, in alpha mode tintmode
_dm_tintmode, // Defines the tintmode
_dm_transbg, // Controls if the background color (index 0) is transparent or not?
_dm_watermode, // Determines water effect. Currently there are 3 modes.
_dm_wavelength, // Determines length of sine wave in pixels. It's repeated since it's sine wave. Only apply if {watermode} is not 3 (see below)
_dm_wavespeed, // Determines the moving speed of sine wave. Only apply if {watermode} is not 3 (see below)
_dm_wavetime, // ??
_dm_xrepeat, // Determine how many times the image will repeat in X axis. Setting 0 will make layer not drawn at all (it will become palette holder). Setting -1 will make it repeat forever
_dm_xspan, // ??
_dm_yrepeat, // Determine how many times the image will repeat in Y axis. Setting 0 will make layer not drawn at all (it will become palette holder). Setting -1 will make it repeat forever
_dm_yspan, // ??
_dm_the_end, // ??
};

Any help is appreciated
 
O Ilusionista said:
_dm_centerx,  // Change the sprite x axis?
_dm_centery, // Change the sprite y axis?

This is the sprite's offset. For an entity's animations this is initially the same as the frame offset. Otherwise both are 0.
_dm_clip, // ??

Accepts all clipping attributes at once. Multiple argument attributes are not good practice and this will likely be depreciated. Leave it alone and use the individual clip attributes instead.

_dm_enabled, // Enables the effect? What is the difference from FLAG?

Redundant - both do the same thing. Use enabled - I'll eventually depreciate flag.

_dm_reset, // Reset any previous active drawmethod ??

Resets all attributes to their default values.

_dm_table, // Defines the colour table

Pointer to color table in use by sprite. As always, if you apply a color table with cells that don't line up with the sprite's original table, you'll get Rainbow Dash with a hangover.

_dm_transbg, // Controls if the background color (index 0) is transparent or not?

Behavior of the transparent color. 0 = Display the transparent color. 1 = Do not display transparent color. It's more efficient to display the transparent color, so use this option where your module design permits. Good candidates are the last layer in backgrounds, certain panels, signs, and so on.

_dm_wavetime, // ??

(elapsed_time + text_time) * wavespeed each time a layer in the level is drawn. Has no functionality, it's mostly a debugging tool.

_dm_xspan, // ??
_dm_yspan, // ??

For background layers, controls spacing. See xspan and zspan.

_dm_the_end, // ??

That's not really a drawmethod attribute. It's just a hacked in final value for enumerator bracket you were looking at.

DC
 
O Ilusionista said:
Thanks, DC. I will add this info to both manuals.
All of them works for SETDRAWMETHOD too, right?

Probably, but I don't really care if they do or don't. See also - multiple attribute methods aren't getting active support and will be removed sooner or later.

DC
 
magggas said:
Now if you will have more attacks on an animation, i think you just should not include  nokill on them instead of nokill 0. But you better testing this one since i'm not sure anymore. Utunnels did explain this back then, but since hes account is inactive(guest), we can't browse hes posts from hes profile  :-\

Confirmed: nokill can be set on and off on the same animation.

Question:
changeshadowcolor(int colorindex)

~Change gfxshadow color.
~Note, gfxshadow use alpha 2, same as shadow.

Which index? From the global palette?
 
Guys, I want to talk about the "load" command. There are some missing info about this at the manual.

Long time ago, uTunnels shared this information:
utunnels said:
Another hint is use load switch in a level. For example:

load Effect1 3
load Effect2 3
....

After this level, the model will be unloaded as well as its sprites. This is useful when you spawn level specific boss character or  anmated panels/visual effects.

And it works (I use it myself). But OpenBORStats says that you can unload an entity too
to unload an entity
load nameofentity 1

But WhiteDragon gave more information about it, and here we have some differences
White Dragon said:
O Ilusionista said:
load Effect1 3
What the value after the name means? Can someone explain what each value does?
So I can update the manual.

quote!
I know:
load "entity_name" 0 # -> load entity for any level
load "entity_name" 1 # -> load entity for current level only

but other? 2 flag? differences between 1 and 3?

Can anyone give more information about this?

EDIT: reading the source code, it looks like we have a scripted function to unload models
Code:
int free_model(s_model *model)
Am I right?
 
I'm looking through the source code to confirm load commands - and will normalize it once I do.

DC
 
Thanks Dc. I went throught the source code and didn't find it, but I've found some interesting stuff. Like grabdistance affects the Get animation area of effect
 
O Ilusionista said:
Thanks Dc. I went throught the source code and didn't find it, but I've found some interesting stuff. Like grabdistance affects the Get animation area of effect

Grabdistance affects a ton of things by default - I don't even remember all of it, but thankfully it can all be overridden. I believe it's from the original BOR when Roel crammed as much information as he could into few variables as possible, presumably to save memory.

DC
 
OK, I found the logic, and infuriatingly - it wasn't commented at all. Nor were any of the support functions, to the point I outright rewrote one of them from the ground up.

Anyway, here is the relevant logic, it is located in the unload level function. So when a level is unloaded, a loop runs over each model, the model's "unload" attribute, (set by the second argument of load command) is read, and action is taken accordingly...

Code:
do
        {
            if(!temp)
            {
                break;
            }
            if((temp->unload & 2))
            {
                cache_model_sprites(temp, 0);
            }
            if((temp->unload & 1))
            {
                free_model(temp);
                temp = getCurrentModel();
            }
            else
            {
                temp = getNextModel();
            }
        }
        while(temp);

0 = Nothing. The model is left alone (IOW, remains loaded) and loop moves on. This is the default action.
1 = Unload model only. The model is unloaded, but unless I am mistaken in my logic read through - the sprites are not. Pretty pointless unless the model has a lot of script attached to it.
2 = Unload sprites only. The mode remains loaded, but its sprites are removed from memory.
3 = You'll notice there there is no third option, but because bitwise logic is in play, 3 effectively means "1 and 2".

 
Accidentally, I found something that is not documented - "tospeedup". According to what is commented in the source code, this would be:
tospeedup          = 0;          // If set will speed the level back up after a boss hits the ground

I tried to add it at the boss header as "tospeedup 1", but nothing happens.

There is a code which runs in the level unload which set it to 0
Code:
    tospeedup = 0;    // Reset so it sets to normal speed for the next level

So how can I set it as 1, for example? It's a openborvariant?
 
Looking at the source, it's unneeded and best left alone, because I'm probably going to remove it. If you want to disable the slow motion effect after a boss is beaten, just use your script to turn the slow motion off the same way you'd turn it on.

DC
 
Hi Ilu just wanted to mention there is no details for text objects but you have covered drawstring.
 
msmalik681 said:
Hi Ilu just wanted to mention there is no details for text objects but you have covered drawstring.
In the manual, you mean? Since you use it a lot on your mod, it would be good to share information with us, so we can update the manual.
 
I have never written anything like this before so please correct anything that does not look right. This should cover everything I know about text objects.

settextobj(index, x, y, font, z, text, time)

index - integer value if multiple text objects have the same index they overwrite each other the order they are called.
x - integer value relative to the screen not the stage.
y - integer value also relative to screen.
font - integer to pick the font to display.
z - integer value to set the text layer.
text - string value the text to display should be in quotes like "this". you can also call script text variables to see what value they hold just remember to add ""+ before the variable if it is a integer or float value.
time - integer value that is optional to set how long the text displays if not defined the text will stay on screen.

example 1:
Code:
settextobj(0, 120,  80, 4, 999999999, "msmalik681"); // this one is permanent.
settextobj(1, 120,  180, 5, 999999999, "is cool", 1000); //this one is displayed for 10 seconds.
settextobj(2, 120,  280, 5, 999999999, getentityproperty(getplayerproperty(0, "entity"), "name")); //this will display player one's name.
settextobj(2, 120,  380, 5, 999999999, ""+getentityproperty(getplayerproperty(0, "entity"), "mp")); //this will display player one's mp.

gettextobjproperty(index, property)
changetextobjproperty(index, property, value)

list of properties:
"font"
"text" *warning this will crash the engine if there is no valid text object first check one of the other values to confirm there is a valid text object.
"time"
"x"
"y"
"z"

example 2:
Code:
//these will modify the text objects from example 1
changetextobjproperty(0, "text", "Malik"); //change the displayed text in text object 0.
changetextobjproperty(1, "font", gettextobjproperty(0, "font")); //get the font from text object 0 and apply to text object 1.
 
Back
Top Bottom