Need help with proper Silhouette() usage
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Code

I'm trying to use the handy built-in Silhouette function to color a character purple when he's poisoned, but I'm just getting a big block of purple instead of the character-shaped purple splotch I want. Do I need to make a mask image?




temp=NewImage(100,100);

SetLucent(25);

TGrabRegion(0,64*character_action[i][1],64,64+(64*character_action[i][1]),character_animation[party[i]].x_pos[character_action[i][0]][character_action[i][1]],character_animation[party[i]].y_pos[character_action[i][0]][character_action[i][1]],character_animation[party[i]].sprite_image[character_action[i][0]],screen); //the character

TGrabRegion(0,64*character_action[i][1],64,64+(64*character_action[i][1]),0,0,character_animation[party[i]].sprite_image[character_action[i][0]],temp); //a dummy image for silhouette() to work with

Silhouette(character_animation[party[i]].x_pos[character_action[i][0]][character_action[i][1]],character_animation[party[i]].y_pos[character_action[i][0]][character_action[i][1]],rgb(150,0,150),temp,screen);


Can someone tell me what I'm doing wrong? Thanks!

Posted on 2005-08-06 00:32:04

CrazyAznGamer

I suggest HookEntityRendering a function while the player is poisoned.

Demonstration of what I mean:

//Function for coloring entities. w00t!
//Includes bonus lucency factor!!!!!
void ColorChr(int entity, int color, int lucency)
{
int mask=NewImage(100,100) //Until there is a way of discerning the entity's frame width and height, this'll do.
int RectFill(0,ImageWidth(mask),0,ImageHeight(mask),
RGB(255,0,255),mask); //ImageWidth and ImageHeight in case you want to change the mask's size.
BlitEntityFrame(0,0,entity,entity.frame[entity],mask); //entity.frame is sorta risky, since I don't know too much about that variable, but it should work. Or else, just use what you typically use.
If(!lucency)
{
Silhouette(entity.x[entity]-xwin,
entity.y[entity]-ywin,color,mask,screen);
}
Else
{
BlitEntityFrame(entity.x[entity]-xwin,
entity.y[entity]-ywin,entity,
entity.frame[entity],screen); //Blit the entity onto screen
SetLucent(lucency);
Silhouette(entity.x[entity]-xwin,
entity.y[entity]-ywin,color,mask,screen); //Blit the lucent silhouette over the entity
SetLucent(0);
}
FreeImage(mask); //Very important. Never forget.
}

//Use the above function to make custom functions for your purpose, such as...
void PoisonChr()
{
ColorChr(event.entity, RGB(141,67,152), systemtime % 100); //Cool lucency effect ;D
}

//And then....
HookEntityRender(entity, 'PoisonChr') //do this while the entity is poisoned, and replace 'entity' with your character handle.

Hope that helped.

Posted on 2005-08-06 11:46:00

CrazyAznGamer

By the way, it's not tested, so use with caution.

Posted on 2005-08-06 11:51:19

Overkill

I think your problem lies with SetLucent() also affecting TGrabRegion(). And also the fact that you should use GrabRegion() if you want transparency to be carried to the new image. So, try moving SetLucent() right above the Silhouette and change the TGrabRegion()s.

Posted on 2005-08-06 12:00:58

Code

Thanks for the help guys. I took your advice, Overkill, one of those TGrabRegion()s is now just a GrabRegion() and I put SetLucent() above Silhouette(). It's working much better. Seems obvious to me now.

CrazyAzn: I was just coloring images at this point, but I'll definitely put your entity coloring code to good use if I want to poison characters on the map screen. >)

Posted on 2005-08-07 15:43:28


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.