Invincibility Item

O Ilusionista

Captain 100K
Invincibility Item
This code makes invincible (for a while) the player who picks up this item. While the effect is active, the player will blink.

Save this code as iteminv.c and save in your scripts folder

Code:
void main(){
// Code to make invincible who picks up a certain item
// O Ilusionista - 2018.03.17
  int Time = openborvariant("elapsed_time"); // get the elapsed time
  void target = getlocalvar("damagetaker"); // get target entity (who picks the item)
  changeentityproperty(target, "invincible", 1); // make the entity invincible
  changeentityproperty(target, "invinctime", Time + 2000); // Set the invincible time to 2000 centiseconds
  changeentityproperty(target,"blink",2); // make the entity to blink while invincible
}

Them simply call it as didhitscript:
didhitscript data/scripts/iteminv.c

Note: add a "score" on the item header, or the engine will give a 1up to who gets this item.
 
Hi O Ilusionista, thank you for this script, I try it an it works perfectly ;). Do you know how I can make the player tint in red (like the dying spawn feature) instead of blinking please?
 
kimono blinking is easier because its a function that the engine already have.
To tint the char in red is doable, but it would require using a updatedscript / ondraw to tint it in red.
I can make some tests if you want.
 
Thanks O Ilusionista if you have some time to do some research for this red tint. I will retribute you with some sprites :p.
 
kimono I am kinda busy so I don't know when I will be able to do this :(
But why don't you take a look at DC's script about this? http://www.chronocrash.com/forum/index.php?topic=2236.0
 
Hi Ilu I want to use this for something else, how to change the damagetaker affects only to the player?
I need something like riseinv {int} {bi} effect but only for anim riseb

*edit
oh I got it working thank you Ilu for the script
Code:
anim	riseb
@script
  int Time = openborvariant("elapsed_time");

  if(frame==0){
  void self = getlocalvar("self");
  changeentityproperty(self, "invincible", 1);
  changeentityproperty(self, "invinctime", Time + 1500);
  changeentityproperty(self,"blink",2);
  }
	@end_script
 
Back
Top Bottom