Skip to content

Instantly share code, notes, and snippets.

@dbaldan
Created August 17, 2018 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dbaldan/946bc97b93c860f7374d03d1e6b1fc63 to your computer and use it in GitHub Desktop.
Save dbaldan/946bc97b93c860f7374d03d1e6b1fc63 to your computer and use it in GitHub Desktop.
ondoattackscript
void main()
{
void self; // Entity running event
void other; // Entity attacking or receiving vs. self.
int which; // Attacker or defender event?
int id_hit_by; // Entity ID of entity attack hit.
int id_attack; // Entity ID of entity that performed attack.
void type;
type = getlocalvar("attacktype");// Get attack type
self = getlocalvar("self");
other = getlocalvar("other");
which = getlocalvar("which");
// Is this a defending event?
if(which == 1)//openborconstant("EXCHANGE_RECIPIANT")
{
// IDs are not the same? This is how we prevent repeat
// hits from the same attack.
hit_by_id = getentityproperty(self, "hitbyid");
attack_id = getlocalvar("attackid");
// Different attack ID?
if(hit_by_id != attack_id)
{
// Is this the attack type we want? If so,
// set lasthit 0 (engine ignores attack hit).
if(type == openborconstant("ATK_NORMAL17"))
{
changeopenborvariant("lasthitc", 0);
}
}
}
// Set hit id on self to attack ID for the next cycle.
changeentityproperty(self, "hitbyid", hit_by_id);
}
@dbaldan
Copy link
Author

dbaldan commented Aug 17, 2018

The error I got now is
Script compile error in 'ondoattackscript': hit_by_id line 20, column 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment