Having Problems with Maps

imaninja1991

New member
Okay, I have a character, Bishamon and I used a blink.c script so when he is hit he changes his palette to his alternative palette.

#include "data/scripts2/script.c"

void main()
{// Blink effect script
    void self = getlocalvar("self"); //Get calling entity.
    int Health = getentityproperty(self,"health");

    if (Health > 0){
changeentityproperty(self, "colourmap", 1);
changeentityproperty(self, "maptime", 14 + openborvariant

("elapsed_time"));
    }
}


It worked just fine, then I created a similar 2nd enemy type with the same character but different moves, I gave him a different palette so that player could distinguish between the 2. That's when thinks started not working. The blink.c script would not work for the original bishamon enemy. However what was strange was for the "2nd New Bishamon" Enemy, instead of changing to it's blink palette, it changed to Bishamon 1's palette.

In other words there are 3 palletes. Red is the original color of Bishamon, White is the blink pallete, blue is the new Bishamon Palette, however both have their alternative pal set to the white blink palette. The 2nd enemy has his "original palette" set to blue depsite the sprites being originally red. When 2nd Bishamon is hit his palette turns to red?? However that palette is not declared, and when original Bishamon is hit he will not change maps, I even tried setting the white map as his 2nd and 1st map and set map in levels, this character will still not change maps. I even moved blue map out of Bishamons folder, still didn't work. Does anyone have any solutions.
 
O Ilusionista said:
are you using drawmethod on any animation? I discovery if you rotate the sprite, it reverts to the default palette.

That is because the setdrawmethod() command has a ton of parameters (including one for palette). If you don't provide them all defaults will be used to prevent a crash.

There are several ways to get by this.

  • Get current palette first and pass it.
  • Passing -1 for the palette parameter tells OpenBOR to use current palette.
  • Just before the crash Utunnels added a set of individual drawmethod commands that only set one aspect (such as rotation) at a time. He also added some other amazing affects (tinting, overlay, etc.). Unfortunately I forgot the specfics. Hoping Utunnels shows up soon. If he doesn't, I'll go into SVN and document.
 
Yeah I am aware of the tons of parameters, I think its the command with more parameters on bor. I will try the -1 option to see if it works. And those new parameters could nice
 
I think I found the problem, when I added more sprites to the bishamon folder I used PalyApply and the blinking sprite accidently got it's palette changed to look like the same on as the red.
 
Oh it seems the posts got lost.


Here are the new drawmethod commands, I changed some of the from the old logic (like using 0~1.0 instead of 0~256 for scale to make it more user friendly)


drawmethod scale {scalex} {scaley}
If scaley is not specified, it is the same as scalex. For example, drawmethod scale 1.5 will scale the whole sprite by 1.5.

drawmethod scalex {scalex}
drawmethod scaley {scalex}

These 2 are subset of the previous scale command.

drawmethod flipx {0/1}

drawmethod flipy {0/1}

drawmethod shiftx {value}

Others may call that "shear" or "lean", but anyway, it is usually for gfxshadow, it is unlikely you need this. A value of 1.0 is the same as 256 in old drawmethod command.

drawmethod rotate {angle}

Rotate the sprite, clockwise.

drawmethod fliprotate {0/1}

If the rotation is affected by entity direction.

drawmethod fillcolor {color}

Like the old command. You can either use a raw integer value or in R_G_B format, the later has better compatibility obviously.

drawmethod remap {int}

Leave it alone or use -1 if you want to use current map. Don't use 0, because it means default palette.

drawmethod alpha {int}

Like above, use -1 or leave alone to avoid overriding.

drawmethod channel {r} {b} {b}

When using alpha 6, you can specify opacity for each channel (r, g or b), or leave the other 2 alone to set all the 3 channels.

For example the code below will grand the entity 25% opacity:

drawmethod alpha 6
drawmethod channel 0.25

drawmethod channelr {r}
drawmethod channelg {g}
drawmethod channelb {b}

These are subset of channel.

drawmethod tintmode {int}
drawmethod tintcolor {color}

These 2 will tint the sprite with given tintcolor, in alpha mode tintmode. The color use same format as fillcolor.

drawmethod clip {x} {y} {w} {h}

This one is on svn but is still experimental.
 
This is better now  ;D
Do you guys know what happened with this command  :
Loading level order.......... invalid loadingbg type -1!
I remember it was to make mod loading much faster but is it removed now ?
WHats the good parameter now to load fast without checking that loading bar ?
 
Can anyone tell me how to make it so the palette only flashes when the entity is hit.
void main()
{// Blink effect script
    void self = getlocalvar("self"); //Get calling entity.
    int Health = getentityproperty(self,"health");

    if (Health > 0){
  changeentityproperty(self, "colourmap", 1);
  changeentityproperty(self, "maptime", 14 + openborvariant

("elapsed_time"));
    }
}

I'm pretty sure the green line is the one I've got to edit, but after hours of looking at the script reference manual, all I've managed to get is a headache.  :-[
 
wasn't sure what you mean.  but imaninja seems to have another script included in the one he posted, so maybe somethings missing.
This is the blink script that I've been using.

void main()
{// Blink effect script
    void self = getlocalvar("self"); //Get calling entity.
    void Health = getentityproperty(self,"health");
    void vSelf = getlocalvar("self"); //Get caller.
    int  iTime = openborvariant("elapsed_time"); //Get current time.

    if (Health > 0){
changeentityproperty(self, "colourmap", 2);
changeentityproperty(self, "maptime", 10 + openborvariant("elapsed_time"));
changeentityproperty(vSelf, "invincible", 1); //Turn on invincibility.
changeentityproperty(vSelf, "invinctime", iTime + 100); //Set time ahead 5 seconds.
//changeentityproperty(vSelf, "maptime", 10 + openborvariant("elapsed_time"));
    }
}

declare it as takedamagescript in entity header

takedamagescript  data/scripts/blink.c


 
Sorry, It was late when I wrote that. Let me try a better explanation.
I didn't know how to use it properly, so I guessed it was an animation script.
When used that way the result was as follows:
   
if (Health > X ){
^ This line makes it so if the entity's heath is greater than X, it will flash between it's normal palette and its 1st remap. This is useful to make a entity flash when nearing death. A good example would be "Rocksteady" from the ninja/hero turtles arcade game. When he's close to being defeated he flashes between his normal palette and his remap.

I tried using the "didhitscript" like you said, but nothing happened.
I'm also using "Nopain" with the entity so its animations aren't interrupted when it gets hit. What I'm trying to do is make it so the entity using it flashes only when it gets struck by another entity. Any ideas how to get this going?
 
Vycks, that script already work exactly like you wanted. If it fails, there must be something wrong with the remap or alternatepalette you are using.
This blinking script specifically changes to 1st remap/alternate palette.

As for health, it is added to prevent blinking on last blow.
 
Lol! No worries. A BB pointed out what I was doing wrong. I'll put up a tutorial on OpenBoR Modding once I finish ripping the Nekketsu Kakutou Densetsu tiles. Did the double jump keyscript work for you? If it's good enough, I'd like to make a tut for that one too.
 
Back
Top Bottom