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
 
Usei esse código num jogo e não funcionou, coloquei exatamente tudo como discutido sem alterar nada do que você fez e não deu certo.
Hey buddy, as I replied on your DM, you need to post here in english only.
Also, before proceeding, we need to know which build and which port are you using.
 
Oque esse código faz exatamente? estou procurando um de tornar o personagem invencível, sei que é possível faze-lo pois já vi em alguns jogos pelo Yotube porem, ninguém tem a camaradagem de ensinar mas vou testar esse seu, obrigado.
Translating:
What exactly does this code do? I'm looking for one to make the character invincible. I know it's possible because I've seen it in some games on YouTube, but nobody is kind enough to teach me how. I'll try yours, though. Thanks.

Buddy, two things before replying:
1 - English only, as I've explained to you. Its on the forum rules.
2 - Honestly, I don't like the statement "nobody has the camaraderie to teach". Remember that people are doing this for free and that can sound ungrateful, okay?

The code does exactly what is written in the topic: a character picks up this item and becomes invincible. This code was written for OpenBOR v3 and it works - so much so that I use it in my Avengers project.
 
Back
Top Bottom