Invisible Enemies?

Yeah sorry for the lack of details I was in the middle of something when I made the topic but I'm looking to add enemies are initially invisible but once hit they become visible, so they would function like any other enemy with the exception being the player won't see them at first but they'll be introduced with a cut scene so the player isn't completely oblivious to them
 
Check out Drawmethod Channel. First set alpha mode to 6 (50% averaged opacity). Then you can use the channel settings to adjust opacity of the RGB color channels individually. 0 is almost completely transparent, 255 is fully opaque. Note if you set all three to 255 they will default back to 50% for backward compatability.

Set all 3 to ~25 for a wicked looking predator effect. Go down to ~10 for a true invisibility. The player can still see them, but only with extreme difficulty.

You can also do this using alpha masking if you like.

DC
 
First, I want to thank all the members that are participating to this topic. I wish  my Tracker (SOR Predator) character activate his stealth cloak after his defensive special.
bg5hrc.png

Here is defensive anim:
Code:
anim special #DEFENSIVE SPECIAL
	fastattack 1
	jugglecost 5
	forcedirection 0
	energycost 20 2
	loop	0
	delay	8
	offset	57 115
	sound	data/sounds/kof/Fire.wav
	frame	data/chars/tracker/dspecial1.gif
	attack1 10 64 100 40 16 1 0 0 20 12
	frame	data/chars/tracker/dspecial2.gif
	attack1 5 44 110 40 16 1 0 0 20 12
	frame	data/chars/tracker/dspecial3.gif
	attack1 12 18 85 43 16 1 0 0 20 12
	frame	data/chars/tracker/dspecial4.gif
	attack1 21 16 76 47 16 1 0 0 20 12
	frame	data/chars/tracker/dspecial5.gif
	attack1 12 18 85 43 16 1 0 0 20 12
	frame	data/chars/tracker/dspecial4.gif
	attack1 0 0 0 0 0 0 0 0 0 0
	frame	data/chars/tracker/dspecial3.gif
	frame	data/chars/tracker/dspecial2.gif
	frame	data/chars/tracker/dspecial6.gif
	drawmethod alpha 6
        drawmethod channelr 0
        drawmethod channelg 0.25
        drawmethod channelb 0 
        gfx shadow 0	
        stealth 1 0
	frame	data/chars/tracker/dspecial7.gif

It works on dspecial7.gif but I wish that the cloak is activated permanentely until he's getting hit.
Any idea how can I set it? :)
 
I would go with NSW25 suggestion - if this will be used by just one enemy, make an alternate model (weapon) with the cloak turned on.
He would lose the weapon on hit, plus returning to normal.

There is a way to set the the drawmethod using script, which would be active all the time - but this will ignore any other drawmethod applied on this caracter.

You could even using a script to set a variable on hit and set an drawmethod using ondrawcript, but since this will run in every time the sprite is drawn on the screen (at least, it will be check each time), this could consume more resources than its needed. It would be needed an more experienced coder like Damon Caskey to tell you if this consumption is worth the trouble.
 
Drawmethod is set and forget, so you don't have to use an ondraw event to check over and over like that. Just setting it when you want the cloak and unsettling it on hit would do the job.

That's how I would do it because it's easy for me and I prefer to avoid the headache of alternate models for something like that. But if you aren't comfortable with script, the model method will work just fine too.

DC
 
nsw25: Thanks for this possibility, it's the easier way to have the stealth cloak as a weapon but the character always wears the stealth cloak and can activate/desactivate at will. Moreover,
Tracker/Predator uses weapons and can be invisible :)
Damon Caskey and O Ilusionista: Thanks for taking care of this post. I think the best solution is activating by script the following commands:
Code:
drawmethod alpha 6
        drawmethod channelr 0
        drawmethod channelg 0.25
        drawmethod channelb 0
        gfx shadow 0	
        stealth 1 0
And an another script that can cancel this modifications. I can retribute the person that can make this with my poor skills in pixelart if needed :)
 
kimono your example combines 3 things:
1- Drawmethod (alpha)
2- Type of shadow
3- Stealth

For the 1, you would need to use changedrawmethod(entity, propertyname, value); and set all options you want there.
For the 2, you would need to use changeentityproperty(entity, propname, values) and set the "gfxshadow" option
for the 3, you would need to use again changeentityproperty(entity, propname, values) but setting the "stealth" option.

You can combine the 3 into a single function with a switch turn it on and off.

I am doing this from my memory so I don't know if its right  - plus, I don't know which type of information the channel receives (from 0 to 255? decimal?)
Try to add this code in your animation script

Code:
void GoStealth()
{
void self = getlocalvar("self");
changeentityproperty(self, "stealth", 1);
changedrawmethod(self, "alpha", 6);
changedrawmethod(self, "channelr", 0);
changedrawmethod(self, "channelg", 0.25);
changedrawmethod(self, "channelb", 0);
changedrawmethod(self, "gfxshadow", 0);
}
And call it using
@cmd GoStealth

Try to see if it works. Then we can make the opposite direction to turn it off and made a better function.
 
O Ilusionista said:
I am doing this from my memory so I don't know if its right  - plus, I don't know which type of information the channel receives (from 0 to 255? decimal?)

Text commands sanitize input, script only accept the actual int value (0-255).

DC
 
O Ilusionista:
Here are the scripts used by Tracker/Predator character:
Code:
##SCRIPTS
didblockscript		data/scripts/didblock/tracker.c
didhitscript		        data/scripts/didhit/tracker.c
onblockpscript		data/scripts/onblockp/platform.c
onmodelcopyscript 	data/scripts/onmodelcopy/modelcopy.c
ondrawscript		data/scripts/ondraw/tracker.c
animationscript	 	data/scripts/script.c
keyscript			data/scripts/key/tracker.c
takedamagescript	data/scripts/takedamage/addmp.c

I tried to put the script only in key/tracker.c (and not in main.c) since he's the lone fighter to have a stealth cloak.
I've got the following error:
Property name 'gfxshadow' is not supported by drawmethod
I deleted the line referred to gfxshadow and:
Script compile error: can't find function 'GoStealth'
If I put to main.c, I've got an error with other characters.
 
So I finally got back around to trying to make this work for me and I can't seem to get full transparency at all I'm using drawmethod alpha 6 and channel  -25 but no matter what I change the channels to the opacity doesn't change. Any thoughts or suggestions?
 
kimono said:
I tried and I've got the following error:
Script compile error in 'data/scripts/key/main.c': changedrawmethod
I tried with changedrawmethod(self, "channelg", 0.25) and 1 value and I've got the same error.
kimono
I don't know if will fit for your purpose, but Yamato use invisibility in some moves, with the stealth factor included
 
Back
Top Bottom