For a while I've been trying to create the smartest baddies Era has ever seen-- something that could effectively simulate player reactions and styles. These baddies, in which I titled "smartbaddy", have a wide range of player-like responses and actions.
Below are the current variables implemented with an explanation to each.
PHP Code:
//Basic baddy stuff ---------------------------------------------------------------------------------------------------------------------------------
this.baddyMustDie2Continue = true; //Does the baddy have to die to continue into any rooms? (true/false)
this.baddyCanAlert = false; //The baddy can alert the other baddies in the level (true/false)
this.baddyDeathMessages = {"DRATS", "Ow!"}; //Random selection of messages the baddy says upon death
this.baddyAlertMessages = {"I see you!", "Spotted!"}; //Random selection of messages the baddy says upon contact
this.baddyMode = "projectile"; //-- "projectile" or "melee"
this.baddyRespawnSecs = 60; //Time for baddy to respawn
this.baddySpeed = 0.39; //Baddy run speed
this.baddyRadius = 14; //Distance it takes for baddy to see you
this.baddyReflexTime = 4; //Increase to make the baddy react to movements slower (MUST BE AN INTEGER)
this.baddyMaxHp = 140; //Maximum HP
this.baddyHp = 140; //Start HP
this.baddyDefaultDir = 2; // 0 = up, 1 = left, 2 = down, 3 = right
this.baddyIdleGani = "era_deagle-idle";
this.baddyWalkGani = "era_deagle-walk";
this.baddyDefaultGani = "sit"; //The gani shown before combat
//Baddy melee control ---------------------------------------------------------------------------------------------------------------------------------
this.baddyMeleeSpeed = 0.78; //How fast their melee hits
this.baddyMeleeFreeze = 0.3; //Freeze time of melee
this.baddyMeleeDamage = 5; //Amount of melee damage done
this.baddyMeleeAni = "era_knife_stab1";
//Baddy projectile control ----------------------------------------------------------------------------------------------------------------------------------
this.baddyMaxProjectileDist = 12; //Distance the baddy tries to stay at when shooting at a player
this.baddyProjectileSpeed = 1.54; //Speed of their projectile weapon
this.baddyProjectileFreeze = 0.34; //Freeze of projectile weapon
this.baddyProjectileDamage = 25; //Projectile damage
this.baddyProjectileSpread = 0.05; //Projectile weapon's spread
this.baddyProjectileXModifier = {0, -0.8, 0, 2}; //Sets the projectile's X offset {up, left, down, right}
this.baddyProjectileYModifier = {-0.8, -0.5, 0.5, 0}; //Sets the projectile's Y offset {up, left, down, right}
this.baddyProjectileAni = "era_deagle-fire";
Nice job so far Hachi. I remember when you started this back then (: Make sure to test them for bugs/exploits, and try to optimize them as good as you can, so they don't eat that much cpu/memory.
Could have done without the music D: I didn't realise that my volume was up as much as it was and hit play and it blared like crazy and scared the crap out of me
Could have done without the music D: I didn't realise that my volume was up as much as it was and hit play and it blared like crazy and scared the crap out of me
See if you can get them to dodge bullets.
that would be really impressive.
It's possible, but the most reliable method is really resource intensive (scanning the level npc array on a loop looking for projectiles).
Zone has them and I think Stefan said that each one might use up to 5 percent of the era server's cpu.
Since Era shares a server with other playerworlds that already hog cpu clock cycles there isn't a lot of room for things like that.
(To put "5 percent" into perspective, at any time the most resource intensive script on Era is usually taking up less than 1 percent of the cpu. Sometimes explosions will jump to 2-3 percent temporarily if people are setting off a LOT of p4s at once, but usually your computer will freeze/crash from client lag before you can create enough explosions to cause server lag).
It's possible, but the most reliable method is really resource intensive (scanning the level npc array on a loop looking for projectiles).
Zone has them and I think Stefan said that each one might use up to 5 percent of the era server's cpu.
Since Era shares a server with other playerworlds that already hog cpu clock cycles there isn't a lot of room for things like that.
(To put "5 percent" into perspective, at any time the most resource intensive script on Era is usually taking up less than 1 percent of the cpu. Sometimes explosions will jump to 2-3 percent temporarily if people are setting off a LOT of p4s at once, but usually your computer will freeze/crash from client lag before you can create enough explosions to cause server lag).
I'm pretty sure the projectiles have their own object array. But it's still a resource intensive thing to do