is there any why by script to check if a entity has a valid bbox ?
#define MAX_PLAYERS openborvariant("maxplayers")
void main() {
void self = getlocalvar("self");
int p;
for ( p = 0; p < MAX_PLAYERS; ++p ) {
void player = getplayerproperty(p, "entity");
float x = getentityproperty(self, "x");
float z = getentityproperty(self, "z");
float a = getentityproperty(self, "a");
float xp = getentityproperty(player, "x");
float zp = getentityproperty(player, "z");
float ap = getentityproperty(player, "a");
if ( !getentityproperty(player, "exists") ) continue;
if ( getentityproperty(player,"x") > x-30 && getentityproperty(player,"x") < x+30 && getentityproperty(player,"z") > z-20 && getentityproperty(player,"z") < z+20 && getentityproperty(player,"a") == getentityproperty(self,"a") ) {
if ( getentityproperty(player, "invincible") == 0 && getentityproperty(player, "vulnerable") != 0 ) {
if ( getentityproperty(player, "aiflag", "dead") != 1 && getentityproperty(player, "aiflag", "falling") != 1 && getentityproperty(player, "aiflag", "inpain") != 1 ) {
.................
} // fine if dead/pain/fall
} // fine if invincible
} // fine if coords
} // fine for
}
White Dragon said:
#include "data/scripts/com/z_datk.h"
void main()
{
void vSelf = getlocalvar("self");
z_datk(vSelf); //Call universal doattack function.
}
#include "data/scripts/com/parr0001.h"
void z_datk(void vEnt)
{
/*
z_datk
Damon Vaughn Caskey
2011_02_25
Universal doattack event function.
vEnt: Caller entity.
*/
int iAtkID = getlocalvar("attackid");
void vOther = getlocalvar("other");
if(!vEnt){ vEnt = getlocalvar("self"); }
/*
log("\n z_datk ~ Cuurent ID: " + iAtkID);
log("\n z_datk ~ Attack ID: " + getentityproperty(vEnt, "attackid"));
log("\n z_datk ~ Hit By ID: " + getentityproperty(vEnt, "hitbyid"));
*/
if(!getlocalvar("which") && (getentityproperty(vEnt, "hitbyid") != iAtkID))
{
if (parr0001(vEnt, vOther))
{
changeopenborvariant("lasthitc", 0);
}
}
changeentityproperty(vEnt, "hitbyid", iAtkID);
//log("\n z_datk ~ Hit By ID (after): " + getentityproperty(vEnt, "hitbyid"));
}
msmalik681 said:Thanks white dragon "invincible" & "vulnerable" where just the parameters my code needed it works perfect now.
I double checked and these 2 were not in the script reference manual how did you know about them ?
This is the manual I always refer to when scripting : http://www.chronocrash.com/forum/index.php?topic=11.0
// reset hitbyid opp only if isn't in range or if the entity change to another opp
int reset_opp_by_range(void self, void opp, int range_anim_id) {
void last_opp = getlocalvar("last_opp");
if ( last_opp && getentityproperty(last_opp,"exists") ) {
int range_flag = checkrange(self,last_opp,range_anim_id);
//drawstring(10,170,0,": "+range_flag );
if ( !range_flag ) {
changeentityproperty(last_opp,"hitbyid",0); // attackid
setlocalvar("last_opp",NULL());
}
}
if ( getentityproperty(opp,"exists") && opp != last_opp ) {
if ( getentityproperty(last_opp,"exists") ) changeentityproperty(last_opp,"hitbyid",0); // attackid
setlocalvar("last_opp",opp);
}
}