Created
August 17, 2018 16:59
-
-
Save dbaldan/946bc97b93c860f7374d03d1e6b1fc63 to your computer and use it in GitHub Desktop.
ondoattackscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The error I got now is
Script compile error in 'ondoattackscript': hit_by_id line 20, column 8