void DOTStatusEffect::Update(int deltaMillis) { StatusEffect::Update(deltaMillis); mCurrentTick += deltaMillis; if (mCurrentTick >= mTick) { mCurrentTick = 0; auto character = this->GetTarget()->FindComponent<CharacterComponent>(); if (character) { character->AddHealth(mTickDamage); } } }
void CBliinkPlayer::BliinkStatsThink( void ) { // Hunger degeneration AddHunger( -HUNGER_DEGEN_RATE ); // Health regeneration if( m_fBliinkHunger > HUNGER_HEALTH_REGEN_THRESH ) { float m_fRegenAmount = (m_fBliinkHunger - HUNGER_HEALTH_REGEN_THRESH); m_fRegenAmount /= HUNGER_HEALTH_REGEN_THRESH; m_fRegenAmount *= MAX_HEALTH_REGEN_RATE; AddHealth(m_fRegenAmount); } else if( m_fBliinkHunger <= 0 ) { AddHealth((float)(-STARVE_HEALTH_LOSS)); } // Fatigue regeneration float m_fRegenAmount = (m_fBliinkHunger / m_fBliinkHungerMax ); m_fRegenAmount *= m_fBliinkFatigueRegenRate; m_fRegenAmount += FATIGUE_BASE_REGEN_RATE; }
void Spell::HandleDamageEffect(GameObject *target, SpellEffectData &effect, SpellState &state) { int32_t statValue = this->GetDamageStatValue(target, effect, state); double percent = effect.percentSourceMin; int damageTotal = effect.flatAmountMin + (percent * statValue); auto character = target->FindComponent<CharacterComponent>(); if (effect.effectType == SpellEffectDamage && damageTotal > 0) { damageTotal *= -1; } character->AddHealth(damageTotal); state.currentDamage += damageTotal; }
void isdf07Mission::CommandShab() { char tempstr[128]; switch (shabState) { case 0: //setup the first batch of enemies shabEnemy1 = BuildObject("fvsent", comp_team, spawn1); shabEnemy2 = BuildObject("fvsent", comp_team, spawn2); Attack(shabEnemy1, shabayev, 1); Attack(shabEnemy2, shabayev, 1); Attack(shabayev, shabEnemy1, 1); shabState++; break; case 1: //do nothing until the first enemy gets killed if (!IsAlive(shabEnemy1)) { if (IsAlive(shabEnemy2)) { Attack(shabayev, shabEnemy2, 1); shabState++; } else { shabState++; } } if (gunTowBuilt) { //If shab can't kill anybody do it for her Damage(shabEnemy1, 3000); if (IsAlive(shabEnemy2)) { Damage(shabEnemy2, 3000); } ClearObjectives(); AddObjective("isdf0707.otf", WHITE); Goto(shabayev, "tree_point", 1); AudioMessage("isdf0728.wav"); shabState = 3; BugFix=GetTime()+60.0f; } break; case 2: //go NEAR the ruin when all of the enemies are killed if ((missionState>8) && (IsAlive(shabEnemy2))) { //If shab can't kill anybody do it for her Damage(shabEnemy2, 3000); } if ((!IsAlive(shabEnemy1)) && (!IsAlive(shabEnemy2)) && (!gunTowBuilt)) { shabEnemy2 = BuildObject("fvsent", 2, spawn1); Attack(shabayev, shabEnemy2, 1); Attack(shabEnemy2, shabayev, 1); } if ((!IsAlive(shabEnemy1)) && (!IsAlive(shabEnemy2)) && (gunTowBuilt)) { ClearObjectives(); AddObjective("isdf0710.otf", WHITE); AudioMessage("isdf0728.wav"); Goto(shabayev, "tree_point", 1); BugFix=GetTime()+20.0f; shabState++; } break; case 3: //hop out of the vehicle when near the ruin if (GetTime()>BugFix) { Goto(shabayev,"tree_point"); BugFix=GetTime()+10.0f; } if (((GetDistance(shabayev, "tree_point") < 25.0)) && ((!IsAlive(enemy1)) || (!IsAlive(enemy2)))) { ClearObjectives(); AudioMessage("isdf0725.wav"); AddObjective("isdf0707.otf", WHITE); justHoped = true; HopOut(shabayev); // SetObjectiveOn(shabOnFoot); hunter= BuildObject("fvsent",comp_team,"hunter"); // Patrol(temp,"hunter_path"); Attack(hunter,shabayev); // blow up shabs craft CameraReady(); reminderTimer=GetTime()+60.0f; shabState++; } break; case 4: oldPlayer=HoppedOutOf(shabOnFoot); // because shab becomes 0 { Vector pos; pos = GetPosition(oldPlayer); CameraObject(oldPlayer,2,5,-7,oldPlayer); LookAt(shabOnFoot, ruins, 1); RemoveObject(oldPlayer); oldPlayer=BuildObject("petank",1,pos); } shabState++; break; case 5: if (movie_counter<70) { CameraObject(oldPlayer,2,2,-7,oldPlayer); movie_counter++; } else { RemoveObject(oldPlayer); Handle temp=BuildObject("ibnav",1,"tree_point"); TranslateString2(tempstr, sizeof(tempstr), "Mission0701"); // Rescue SetObjectiveName(temp,tempstr); SetObjectiveOn(temp); CameraFinish(); shabState++; } break; case 6: //order the player to get out of his vehicle once he gets close if ((!IsAround(shabayev)) && (!ship_blown_up)) { Patrol(hunter,"hunter_path"); SetIndependence(hunter,0); ship_blown_up=true; } if ((!IsAlive(shabOnFoot) && (!shab_dead))) { AudioMessage("isdf0732.wav"); ClearObjectives(); AddObjective("isdf05l1.otf",RED,15.0f); FailMission(GetTime()+5.0f,"isdf05l1.otf"); shab_dead=true; } if (GetTime()>reminderTimer) { AudioMessage("isdf0725.wav"); reminderTimer=GetTime()+60.0f; } if ((GetDistance(shabOnFoot, player) < 50.0)) { //RemoveObject(shabayev); Attack(shabEnemy1,shabayev); Attack(shabEnemy2,shabayev); ClearObjectives(); AudioMessage("isdf0729.wav"); AddObjective("isdf0708.otf", WHITE); shabState++; } break; case 7: //send shab to get the relic if ((!IsAlive(shabOnFoot) && (!shab_dead))) { AudioMessage("isdf0732.wav"); ClearObjectives(); AddObjective("isdf05l1.otf",RED,15.0f); FailMission(GetTime()+5.0f,"isdf05l1.otf"); shab_dead=true; } if (playerOnFoot) { Attack(shabEnemy1,oldPlayer); Attack(shabEnemy2,oldPlayer); Goto(shabOnFoot, ruins, 1); //we should start the patrols here shabState++; } break; case 8: //get shab hurt if ((!IsAlive(shabOnFoot) && (!shab_dead))) { AudioMessage("isdf0732.wav"); ClearObjectives(); AddObjective("isdf05l1.otf",RED,15.0f); FailMission(GetTime()+5.0f,"isdf05l1.otf"); shab_dead=true; } if ((GetDistance(shabOnFoot, ruins) < 20.0f) || (GetDistance(player,ruins)<10.0f)) { if (winMission == false) { AudioMessage("isdf0731.wav"); // wrong file name SucceedMission(GetTime()+5.0f,"isdf07w1.txt"); winMission = true; } } break; case 9: //hide shab break; case 10: //play closing cineractive // The following is an example of how to play a movie in a script. moviePlaying = PlayMovie("temp"); if (!moviePlaying) { missionState++; moviePlaying = true; //IFace_SetInteger("script.mission.state", 1); } break; } if (GetHealth(shabayev) < 0.7f) { //keep shab alive AddHealth(shabayev, 100); } if ((GetAmmo(shabayev)) < 0.5f) { AddAmmo(shabayev, 500); } if ((justHoped) && (!IsAlive(shabOnFoot))) { int i; i=1; // Houston we have a problem } }
void isdf20Mission::Execute(void) { /* Here is where you put what happens every frame. */ /* LANDSLIDE INFO - .bzn has file reslida1.odf - Don't forget to delete bin data before you try this - Run animation on reslid01.odf - Replace it with reslidea1.odf */ player = GetPlayerHandle(); char tempstr[128]; Ally(1,3); switch (mission_state) { case 0: // build this stuff at start /* Handle recy=BuildObject("ivrecy",1,"Recycler"); int grp=GetFirstEmptyGroup(); SetGroup(recy,grp); SetScrap(1,30); */ // deleted for Nathan /* mbike_1=BuildObject("ivmbike",3,"mbike1"); mbike_2=BuildObject("ivmbike",3,"mbike2"); mbike_3=BuildObject("ivmbike",3,"mbike3"); */ tank_1=BuildObject("ivatank",1,"tank1"); // was atank SetGroup(tank_1,0); tank_2=BuildObject("ivrckt",1,"tank2"); // was atank SetGroup(tank_2,1); // serv= BuildObject("ivserv",1,"serv"); // Set // scav_1=BuildObject("ivscav",1,"scav1"); // scav_2=BuildObject("ivscav",1,"scav2"); // rckt_1=BuildObject("ivrckt",1,"rckt1"); // rckt_2=BuildObject("ivrckt",1,"rckt2"); SetGroup(rckt_1,1); SetGroup(rckt_2,1); serv_1=BuildObject("ivserv",1,"scav1"); SetGroup(serv_1,2); espir_2=BuildObject("ibgtow",comp_team,"base_here"); esent_1=BuildObject("ivmisl",comp_team,"esentpath1"); esent_2=BuildObject("ivmisl",comp_team,"esentpath1"); espir_1=BuildObject("ibgtow",comp_team,"espir1"); base_1=BuildObject("ibfact",comp_team,"estro1"); base_2=BuildObject("ibpgen",comp_team,"ekiln1"); base_3=BuildObject("ibpgen",comp_team,"power_x"); // was eforg1 base_4=BuildObject("ibcbun",comp_team,"bunker_x"); espir_3=BuildObject("ibgtow",comp_team,"espir3"); esent_3=BuildObject("ivscout",comp_team,"esent3"); esent_4=BuildObject("ivscout",comp_team,"esent4"); ClearObjectives(); AddObjective("isdf20a.otf",WHITE,10.0f); Patrol(esent_1,"esentpath1"); Follow(esent_2,esent_1); after_briefing= GetTime()+20.0f; slide1=GetHandle("unnamed_reslida1"); //Vector temp=GetPosition(slide1); RemoveObject(slide1); nav=BuildObject("ibnav",1,"lung2"); SetObjectiveOn(nav); TranslateString2(tempstr, sizeof(tempstr), "Mission2002"); // Rebel Base SetObjectiveName(nav,tempstr); // SetPosition(slide2?? /* So the mission isn't too slow. */ AddHealth(espir_1,-3000); AddHealth(espir_2,-3000); mission_state++; audio=AudioMessage("isdf2021.wav"); CameraReady(); break; case 1: CameraPath("camera1",200,200,player); // CameraObject(espir_1,30,20,20,espir_1); if (IsAudioMessageDone(audio)) { audio=AudioMessage("isdf2022.wav"); mission_state++; } break; case 2 : CameraPath("camera2",200,200,espir_2); if (IsAudioMessageDone(audio)) { AudioMessage("isdf2001.wav"); CameraFinish(); mission_state++; } break; case 3: //the attack begins // after the opening briefing, AI squadron drives to fight sentry units on their own if (GetTime() > after_briefing) { // Goto(mbike_1,"front_ambush"); // Goto(mbike_2,"front_ambush"); // Goto(mbike_3,"front_ambush"); // Goto(rckt_1,"front_ambush"); // Goto(rckt_2,"front_ambush"); Handle temp=BuildObject("ivscout",comp_team,"lung2"); Attack(temp,player); mission_state++; } break; case 4: // Kill the sentries // AI squadron engages sentry units if ((GetDistance(tank_1,"front_ambush")<200.0f) || (GetDistance(tank_2,"front_ambush")<200.0f) || (GetDistance(rckt_1,"front_ambush")<200.0f) || (GetDistance(rckt_2,"front_ambush")<200.0f) || (GetDistance(player,"front_ambush")<200.0f) ) { /* Attack(mbike_1,esent_1); Attack(mbike_2,esent_2); Attack(mbike_3,esent_1); */ SetObjectiveOn(esent_1); TranslateString2(tempstr, sizeof(tempstr), "Mission2001"); // Rebel SetObjectiveName(esent_1,tempstr); SetObjectiveOn(esent_2); SetObjectiveName(esent_2,tempstr); // Attack(rckt_1,esent_2); // Attack(rckt_2,esent_1); } // once the sentrys are destroyed, AI squadron heads to enemy gun tower and stops if ((!IsAlive(esent_1)) && (!IsAlive(esent_2))) { /* Goto(mbike_1,"front_ambush"); Goto(mbike_2,"front_ambush"); Goto(mbike_3,"front_ambush"); */ // Goto(rckt_1,"front_ambush"); // Goto(rckt_2,"front_ambush"); // temp=BuildObject("ivscout",2,"lung2"); // Attack(temp,serv_1); mission_state++; } break; case 5: // wait till they get to the tower if (( (GetDistance(tank_1,"front_ambush")<75.0f) || (GetDistance(rckt_2,"front_ambush")<75.0f) || (GetDistance(player,"front_ambush")<75.0f))) { Handle temp=BuildObject("ivscout",comp_team,"lung2"); Attack(temp,player); AudioMessage("isdf2002.wav"); // use your assault tanks ClearObjectives(); AddObjective("isdf2002.otf",WHITE,20.0f); SetObjectiveOn(espir_1); TranslateString2(tempstr, sizeof(tempstr), "Mission2003"); // Gun Tower SetObjectiveName(espir_1,tempstr); //temp=BuildObject("ivscout",2,"lung2"); //Attack(temp,player); mission_state++; } break; case 6: // destroy the tower // once you destroy the gun tower, AI squadron heads to next gun tower and stops if (!IsAlive(espir_1)) { Goto(mbike_1,"exit1"); Goto(mbike_2,"exit1"); Goto(mbike_3,"exit1"); // AudioMessage("isdf2003.wav"); // now let's press on to the base // Goto(rckt_1,"exit1"); // Goto(rckt_2,"exit1"); // temp=BuildObject("ivscout",2,"lung2"); // Attack(temp,serv_1); mission_state++; } break; case 7: // now go to the next tower if (((GetDistance(tank_1,"exit1")<50.0f) || (GetDistance(rckt_1,"exit1")<50.0f) || (GetDistance(player,"exit1")<50.0f))) { ClearObjectives(); AddObjective("isdf2003.otf",WHITE,20.0f); AudioMessage("isdf2003.wav"); mission_state++; } break; case 8: // until enemy spire is dead if (!IsAlive(espir_2)) { // Attack(mbike_1,base_1); // Attack(mbike_2,base_1); // Attack(mbike_3,base_1); Attack(rckt_1,base_1,0); Attack(rckt_2,base_1,0); mission_state++; } break; case 9: if (!IsAlive(base_1)) { // Attack(mbike_1,base_2); // Attack(mbike_2,base_2); // Attack(mbike_3,base_2); AudioMessage("isdf2004.wav"); Attack(rckt_1,base_2,0); Attack(rckt_2,base_2,0); mission_state++; } break; case 10: if (!IsAlive(base_2)) { // Attack(mbike_1,base_3); // Attack(mbike_2,base_3); // Attack(mbike_3,base_3); Attack(rckt_1,base_3,0); Attack(rckt_2,base_3,0); mission_state++; } break; case 11:// is the third base dead? if (!IsAlive(base_3)) { /* Goto(mbike_1,"homebase"); Goto(mbike_2,"homebase"); Goto(mbike_3,"homebase"); */ Goto(rckt_1,"homebase",0); Goto(rckt_2,"homebase",0); // keep the player bunched up Follow(tank_1,player,0); Follow(tank_2,player,0); ClearObjectives(); AddObjective("isdf2004.otf",WHITE,20.0f); SetObjectiveOff(nav); nav=BuildObject("ibnav",1,"scav2"); TranslateString2(tempstr, sizeof(tempstr), "Mission2004"); // Rencezvous SetObjectiveName(nav,tempstr); SetObjectiveOn(nav); AudioMessage("isdf2005.wav"); mission_state++; } break; case 12: // first ambush launches as soon as you exit enemy base after destroying it // second ambush comes in from behind if (GetDistance(player,"exit1")<125.0f) { ambush_delay=GetTime()+15.0f; mission_state++; } break; case 13: if (GetTime()>ambush_delay) { eatank_1=BuildObject("ivtank",comp_team,"eatank1"); eatank_2=BuildObject("ivtank",comp_team,"eatank2"); eatank_3=BuildObject("ivmbike",comp_team,"eatank3"); SetSkill(eatank_1,2); SetSkill(eatank_2,2); SetSkill(eatank_3,2); Attack(eatank_1,player); Attack(eatank_2,player); Attack(eatank_3,player); etank_1=BuildObject("ivtank",comp_team,"etank1"); etank_2=BuildObject("ivtank",comp_team,"etank2"); etank_3=BuildObject("ivmbike",comp_team,"etank3"); earch_1=BuildObject("ivtank",comp_team,"earch1"); earch_2=BuildObject("ivtank",comp_team,"earch2"); earch_3=BuildObject("ivmisl",comp_team,"earch3"); manson= BuildObject("ivatank",comp_team,"manson"); Attack(etank_1,player); Attack(etank_2,player); Attack(etank_3,player); Attack(earch_1,player); Attack(earch_2,player); Attack(earch_3,player); Attack(manson,player); uhoh= GetTime()+20.0f; mission_state++; } break; case 14: if (GetTime() > uhoh) { AudioMessage("isdf2006.wav"); AudioMessage("isdf2007.wav"); ClearObjectives(); AddObjective("isdf2005.otf",WHITE,20.0f); Handle temp=BuildObject("ivapc",comp_team,"lung2"); // now you are screwed Attack(temp,player); // temp=BuildObject("ivapc",2,"lung2"); // Attack(temp,player); mission_state++; } break; case 15: // how do you win?? if ((!seen_manson) && (GetDistance(player,manson)<200.0f)) { seen_manson=true; SetObjectiveOn(manson); } if (!IsAlive(manson)) { AudioMessage("isdf2010.wav"); SucceedMission(GetTime()+10.0f,"isdf20w1.txt"); mission_state++; } break; } // switch (mission_state) PeriodicAttack(); // once you destroy the second gun tower, AI squadron enters enemy base and levels it // infinite health and ammo // SetCurAmmo(player, 1200); // SetCurHealth(player, 3000); // tells player to head back to base // if ((!IsAlive(enemybase)) && (!go_home)) // { // AudioMessage("wahoo.wav"); // go_home=true; // } }
//========================================================= // Crea un Zombi. //========================================================= CAI_BaseNPC *CDirectorSpawn::MakeNPC(bool Horde, bool disclosePlayer, bool checkRadius) { // Desactivado // Esta entidad no funciona en Multiplayer. if ( Disabled ) return NULL; // Seleccionamos una clase de NPC para crear. const char *pClass = SelectRandom(); CAI_BaseNPC *pNPC = VerifyClass(pClass); // Emm... ¿puso todas las clases en "no crear"? :genius: if ( !pNPC ) { Warning("[DIRECTOR SPAWN] Ha ocurrido un problema al intentar crear un NPC. \r\n"); return NULL; } Vector origin; // Verificamos si podemos crear un zombi en el radio. if ( checkRadius ) { if ( !CanMakeNPC(pNPC, &origin) ) return NULL; } // Lugar de creación. pNPC->SetAbsOrigin(origin); QAngle angles = GetAbsAngles(); angles.x = 0.0; angles.z = 0.0; pNPC->SetAbsAngles(angles); // Tiene que caer al suelo. pNPC->AddSpawnFlags(SF_NPC_FALL_TO_GROUND); // Su cuerpo tiene que desaparecer al morir. pNPC->AddSpawnFlags(SF_NPC_FADE_CORPSE); // Creamos al NPC, le decimos quien es su dios (creador) y lo activamos. DispatchSpawn(pNPC); pNPC->SetOwnerEntity(this); DispatchActivate(pNPC); // Al parecer se atoro en una pared. if ( !PostSpawn(pNPC) ) return NULL; // Nombre del NPC. pNPC->SetName(MAKE_STRING(CHILD_NAME)); #ifdef APOCALYPSE // Skin al azar. if ( pNPC->GetClassname() == "npc_zombie" ) pNPC->m_nSkin = random->RandomInt(1, 4); #endif // Es un NPC para la horda ¡woot! if ( Horde ) { AddHealth(pNPC); #ifdef APOCALYPSE // Más rápido. pNPC->SetAddAccel(40); // No colisiona con otros NPC's. (Zombis) if ( random->RandomInt(1, 4) == 2 ) pNPC->SetCollisionGroup(COLLISION_GROUP_SPECIAL_NPC); #endif } // Debe conocer la ubicación del jugador (Su enemigo) if ( disclosePlayer ) { CIN_Player *pPlayer = UTIL_GetRandomInPlayer(); if ( pPlayer ) pNPC->UpdateEnemyMemory(pPlayer, pPlayer->GetAbsOrigin()); } Childs++; ChildsAlive++; LastSpawn = gpGlobals->curtime; OnSpawnNPC.FireOutput(pNPC, this); return pNPC; }
void isdf06Mission::Execute(void) { /* Stuff in 6 You are responsible for the northern aproach to the base Alien units approach from the south and you battle them. Shabayev discovers a scrap pool. She highlights it. You must go to it and destroy a scion scavenger. You are given control of constructor. Your job is to build a bunker and a gun tower around it to protect it. Once the bunker is built you are told to go on the offensive. At the first place you go you find the voyager probe. The second is the climatic battle. */ player = GetPlayerHandle(); if (!start_done) { start_done=true; /* This is one of our three key bases on the Planet You must defend this approach. */ ClearObjectives(); AddObjective("isdf0601.otf",WHITE,20.0f); AudioMessage("isdf0601.wav"); // Manson: // Prepare for enemy attacks // You are a reserve for a counter attack // or in case they break through. attack_wave_time=GetTime()+10.0f; wave_launched=false; SetScrap(1,20); SetIndependence(escav,0); escav=BuildObject("fvscav",2,"pool"); Goto(escav,scrap_pool,0); Handle temp=GetHandle("gtow1"); AddHealth(temp,-2500); temp=GetHandle("gtow2"); AddHealth(temp,-2500); GiveWeapon(player, "gshadow_c"); /* turret1=BuildObject("ivturr",3,"turret1"); turret2=BuildObject("ivturr",3,"turret2"); Deploy(turret1); Deploy(turret2); */ } if ((!IsAlive(constructor)) && (mission_state>1) && (mission_state!=99)) { // you loose AudioMessage("isdf0607.wav"); // Manson: // That constructor was vital // to our effort. I'm pulling // back immeadiately. FailMission(GetTime()+15.0f,"isdf06l2.txt"); mission_state=99; // out of the loop } switch (mission_state) { case 0: // attack starts if ((!warning) && (GetDistance(atk1,turret1)<250.0f)) { AudioMessage("isdf0602.wav"); warning=true; } if ((!wave_launched) && (GetTime()>attack_wave_time)) { atk1=BuildObject("fvtank",2,"attack_start1"); Goto(atk1,"attack_path1"); SetSkill(atk1,3); atk2=BuildObject("fvtank",2,"attack_start1"); Goto(atk2,"attack_path1"); SetSkill(atk2,3); atk3=BuildObject("fvsent",2,"attack_start1"); Goto(atk3,"attack_path1"); SetSkill(atk3,3); atk4=BuildObject("fvsent",2,"attack_start1"); Goto(atk4,"attack_path1"); SetSkill(atk4,3); atk5=BuildObject("fvtank",2,"attack_start2"); Goto(atk5,"attack_path2"); SetSkill(atk5,3); atk6=BuildObject("fvtank",2,"attack_start2"); Goto(atk6,"attack_path2"); SetSkill(atk6,3); atk7=BuildObject("fvsent",2,"attack_start2"); Goto(atk7,"attack_path2"); SetSkill(atk7,3); // atk8=BuildObject("fvsent",2,"attack_start2"); // Goto(atk8,"attack_path2"); // SetSkill(atk8,3); wave_launched=true; } if ((wave_launched) && (!IsAlive(atk1)) && (!IsAlive(atk2)) && (!IsAlive(atk3)) && (!IsAlive(atk4)) && (!IsAlive(atk5)) && (!IsAlive(atk6)) && (!IsAlive(atk7)) && (!IsAlive(atk8))) { warning=false; wave_launched=false; wave_count++; if (!repair_hint) { repair_hint=true; AudioMessage("isdf0612.wav"); /* MANSON Take advantage of the breaks between attacks to repair your forces at the service bay. */ } if (wave_count==2) { back1=BuildObject("fvarch",2,"back1"); Goto(back1,"back_door"); back2=BuildObject("fvarch",2,"back2"); Goto(back2,"back_door"); back3=BuildObject("fvsent",2,"back3"); Goto(back3,"back_door"); SetObjectiveOn(back1); AudioMessage("isdf0614.wav"); } if (wave_count>(2)) //was 2 { if ((!IsAlive(back1)) && (!IsAlive(back2)) && (!IsAlive(back3))) { mission_state++; SetObjectiveOn(escav); ClearObjectives(); AddObjective("isdf0602.otf",WHITE,10.0f); AudioMessage("isdf0603.wav"); // Shabayev // I have detected the scavenger // which is supplying the enemy. // Its time to counter attack. // Manson // Alright, Cooke, you heard // the lieutenant. Get that // scavenger AudioMessage("isdf0604.wav"); } } else attack_wave_time=GetTime()+5.0f; // hold back your forces if ((GetDistance(turret1,mbike1)<50.0f) && (!defend_warning)) { AudioMessage("isdf0610.wav"); // MansoN: // Cooke, hold back your forces. defend_warning=true; } } break; case 1: // shabayev highlights the scavenger /* */ if (scav_count<3) { FailMission(GetTime()+5.0f,"isdf06l1.txt"); mission_state=99; } else { if ((GetDistance(player,escav)<150.0f) && (!got_to_scav)) { AudioMessage("isdf0605.wav"); // Shabayev: Attack! got_to_scav=true; } if (!IsAlive(escav)) { ClearObjectives(); AddObjective("isdf0603.otf",WHITE,10.0f); constructor=BuildObject("ivcon6",1,"constructor_spawn"); int grp=GetFirstEmptyGroup(); SetGroup(constructor,grp); Goto(constructor,"pool",0); mission_state++; AudioMessage("isdf0606.wav"); // Manson: // Cooke, I'm sending you a // constructor to fortify your // position. Use the constructor // to build defenses around that // scrap pool. } } break; case 2: // you get a constructor if (GetDistance(constructor,"pool")<250.0f) { AudioMessage("isdf0611.wav"); // Shabayev // Build a communications bunker to // anchor the base. // Once you have a communications bunker // build two adjacent // gun towers // The gun towers will be powered from // the surplus power of the main base. // Good luck. ConstructionMessage(); // spawn in attackers scout1=BuildObject("fvscout",2,"patrol_spawn"); scout2=BuildObject("fvscout",2,"patrol_spawn"); if (IsAlive(mbike1)) { Attack(scout1,player); } else { Attack(scout1,player); } if (IsAlive(mbike2)) { Attack(scout2,player); } else Attack(scout2,mbike2); mission_state++; } break; case 3: if ((!IsAlive(scout1)) && (!IsAlive(scout2))) { scout1=BuildObject("fvscout",2,"patrol_spawn"); scout2=BuildObject("fvscout",2,"patrol_spawn"); if (IsAlive(mbike1)) { Attack(scout1,mbike1); } else Attack(scout1,player); if (IsAlive(mbike2)) { Attack(scout2,mbike2); } else Attack(scout2,player); } if ((cbunker!=NULL) && (guntow1!=NULL) && (guntow2!=NULL)) { AudioMessage("isdf0608.wav"); /* Manson: Great! I'm sending a scavenger to secure that pool. Prepare for further orders. */ // more cannon foder to get pulverized atk1=BuildObject("fvtank",2,"patrol_spawn1"); Attack(atk1,guntow1); // cannon foder atk2=BuildObject("fvtank",2,"patrol_spawn2"); Attack(atk2,guntow2); // cannon foder // FraKTal says this scav doesn't want to deploy on its // own. So, put it under 100% human control - NM 6/27/03 #if 0 // was scav=BuildObject("ivscav",3,"constructor_spawn"); #else // now scav=BuildObject("ivscav",1,"constructor_spawn"); #endif Goto(scav,"pool"); ClearObjectives(); AddObjective("isdf0607.otf",WHITE,10.0f); mission_state++; } break; case 4: // when the scavenger gets there-- attack!! if (GetDistance(scav,"pool")<100.0f) { AudioMessage("isdf0609.wav"); AudioMessage("isdf0613.wav"); // Shabayev: // Its time we finish them off. // All forces, converge on the enemy base! SetObjectiveOn(goal); mission_state++; // spawn in patrols atk1=BuildObject("fvtank",2,"patrol_spawn2"); atk2=BuildObject("fvtank",2,"patrol_spawn2"); atk3=BuildObject("fvsent",2,"patrol_spawn"); atk4=BuildObject("fvsent",2,"patrol_spawn"); Patrol(atk1,"patrol"); Patrol(atk2,"patrol"); Patrol(atk3,"patrol"); Patrol(atk4,"patrol"); // spawn in attackers atk1=BuildObject("ivtank",3,"constructor_spawn"); atk2=BuildObject("ivtank",3,"constructor_spawn"); Goto(atk1,goal); Goto(atk2,goal); BuildObject("ibbomb",1,"bomber"); // you get a bomber // BuildObject("ivbomb",1,"bomber"); ClearObjectives(); AddObjective("isdf0608.otf",WHITE,10.0f); } break; case 5: // test to destroy base time_counter++; if (time_counter%1200==0) // every minute 1/2 { atk1=BuildObject("fvtank",2,"patrol_spawn2"); atk2=BuildObject("fvtank",2,"patrol_spawn2"); Patrol(atk1,"patrol"); Patrol(atk2,"patrol"); } if (!IsAlive(goal)) { // you win SucceedMission(GetTime()+20.0f,"isdf06w1.txt"); mission_state++; ClearObjectives(); AddObjective("isdf0609.otf",WHITE,10.0f); } break; case 6: // cineractive // Through the worm hole break; } // switch }
void isdf05Mission::Execute(void) { /* a) The player is asked to patrol around the base (through steps b-d sent & scouts attack) b) Once the base is secure, the player is supposed to look for scrap veins and send a scavenger (twice) c)Eventually you get to some turrets. Shebayev detaches some mortar bikes to help you take out the turrets. d) Once the turrets are destroyed you need to deploy e) Follow Manson to the teleporter? Drop off a bomb */ char tempstr[128]; Handle nearguy = 0; // this is the start of the mission if (!start_done) { /* Alright Sgt Cooke, this looks like a good place to establish a base. Patrol the area around this recycler. If it looks safe, deploy the recycler. */ shabayev = BuildObject("ivtan5",1,"shab_start");//"patrol_east"); constructor = BuildObject("ivcons",1,"spawn_constructor"); Stop(constructor,1); scav_comp= GetHandle("scav3"); SetGroup(scav_comp,-1); Handle temppool=GetHandle("poolx"); Goto(scav_comp,temppool,1); // SetPlan("isdf05.aip",3); // build stuff AudioMessage("isdf0500.wav"); SetObjectiveOn(shabayev); SetObjectiveName(shabayev,"Cmdr. Shabayev"); audmsg=AudioMessage("isdf0501.wav"); patrol_phase=true; start_done = true; Handle tempscav=GetHandle("ivscav1"); KillPilot(tempscav); tempscav=GetHandle("ivscav2"); KillPilot(tempscav); // Handle fv=BuildObject("fvarch",2,"scrap_field1"); // SetSkill(fv,3); SetSkill(shabayev,3); // Patrol(shabayev,"patrol1",1); // Attack(shabayev,fv,1); recy=BuildObject("ivrec5",1,"recy_start"); // Goto(recy,"recy_deploy"); Dropoff(recy, "recy_deploy"); Follow(shabayev,recy,1); SetScrap(1,40); SetScrap(3,40); // allied resources } /* Here is where you put what happens every frame. */ player = GetPlayerHandle(); if ((!IsAlive(shabayev) && (!shab_dead))) { AudioMessage("isdf0732.wav"); ClearObjectives(); AddObjective("isdf05l1.otf",RED,15.0f); FailMission(GetTime()+5.0f,"isdf05l1.otf"); shab_dead=true; } // determining if the player is out of his ship if (IsOdf(player,"isuser")) { if (!out_of_ship) GiveWeapon(player, "igsatc"); out_of_ship = true; } else { out_of_ship = false; } if ((GetDistance(player,"spawn2")<150.f) && (!warning_message)) { AudioMessage("isdf0520.wav"); /* Stay away from those alien structures they aren't vital to our mission- but they may be dangerous. */ warning_message=true; } // this is checking to make sure the player does not attack his wingman ///////// if ((!in_combat) && (!fire_message)) { if ((IsAlive(shabayev)) && (IsAlive(player))) { if (GetTime() - GetLastFriendShot(shabayev) < .2f) { AudioMessage("ff01.wav"); // (shab) watch your firing! fire_reset = GetTime() + 2.f; fire_message = true; } } if ((IsAlive(manson)) && (IsAlive(player))) { if (GetTime() - GetLastFriendShot(manson) < .2f) { AudioMessage("isdf0555.wav"); // (manson) watch your firing! fire_reset = GetTime() + 2.f; fire_message = true; } } } if ((fire_message) && (fire_reset < GetTime())) { fire_reset = GetTime() + 999999.9f; fire_message = false; } if ((!IsAlive(constructor)) && (mission_state<10)) { // the constructor is dead, you lose mission_state=12; } switch (mission_state) { case 0: // Shabayev starts the base if (GetDistance(recy,"recy_deploy") < 25.0) { // Dropoff(recy,"recy_deploy"); Patrol(shabayev,"patrol1",1); SetIndependence(shabayev,1); ClearObjectives(); AddObjective("isdf0501.otf", WHITE, 10.0f); patrol_reminder_time=GetTime()+30.0f; MoviePlaying=true; CameraReady(); // but danger looms.. atk1=BuildObject("fvscout",2,"spawn1"); wasDead1=false; Attack(atk1,player); mission_state++; } break; case 1: if (MoviePlaying) { //CameraObject(recycler,5,5,5,recycler); MoviePlaying = PlayMovie("isdf0501.cin"); // if (IsAudioMessageDone(audmsg)) { if (!MoviePlaying) { // MoviePlaying=false; CameraFinish(); Build(constructor,"ibpge5",1); drop_off=true; Attack(shabayev,atk1); mission_state++; } } ReallyKillCineractive = 0; break; case 2: // patrol_phase // Kick this out a few extra times. if((ReallyKillCineractive == 0) || (ReallyKillCineractive == 10) || (ReallyKillCineractive == 20)) CameraFinish(); ReallyKillCineractive++; if (drop_off) { Dropoff(constructor,"pgen1",1); drop_off=false; Handle temp=GetHandle("unnamed_ivdrop"); Attack(shabayev,atk1,1); RemoveObject(temp); } if (!IsAlive(atk1)) { wait_count++; if (wait_count==250) { wasDead1=false; wasDead2=false; raid1=BuildObject("fvsent",2,"raid1"); Goto(raid1,recy); raid2=BuildObject("fvtank",2,"raid2"); Goto(raid2,recy); // raid3=BuildObject("fvsent",2,"raid3"); // Goto(raid3,recy); // raid4=BuildObject("fvtank",2,"raid4"); // Goto(raid4,recy); ClearObjectives(); AddObjective("isdf0517.otf",WHITE,10.0f); Goto(shabayev,constructor); AudioMessage("isdf0543.wav"); mission_state++; wait_count=0; } } break; case 3: if (power2) { Dropoff(constructor,"pgen2",1); power2=false; } if (com1) { Dropoff(constructor,"rbunker1",1); com1=false; } if (!IsAliveAndPilot(raid1)) { wasDead1=true; } if (!IsAliveAndPilot(raid2)) { wasDead2=true; } if ((wasDead1) && (wasDead2)) { if (raid_count==1) // should be 2 { /* Now look for scrap veins around the base. If you find one mark it with a nav beacon. */ scout_phase=true; ClearObjectives(); AddObjective("isdf0507.otf",WHITE,5.0f); SetObjectiveOff(shabayev); nav1=BuildObject("ibnav",1,"scrap_field1"); TranslateString2(tempstr, sizeof(tempstr), "Mission0501"); // tempstr SetObjectiveName(nav1,tempstr); SetObjectiveOn(nav1); // SetObjectiveName(pool1,"bio-metal"); // SetObjectiveOn(pool1); AudioMessage("isdf0507.wav"); // Add an attacked for spice Handle atk1=BuildObject("fvscout",2,"spawn1"); Goto(atk1,"attack1"); Patrol(shabayev,"patrol1",1); SetIndependence(shabayev,1); // AudioMessage( // You go on John, I'll guard the base mission_state++; } else { wait_count++; if (wait_count==400) { if (pgen2==NULL) { // was follow Goto(shabayev,constructor,1); Build(constructor,"ibpge5"); power2=true; } else { //was Follow Goto(shabayev,constructor,1); Build(constructor,"ibcbu5"); com1=true; } raid_count++; AddHealth(constructor,500); AddHealth(shabayev,500); raid1=BuildObject("fvtank",2,"raid1"); Goto(raid1,recy); raid2=BuildObject("fvtank",2,"raid2"); Goto(raid2,recy); wasDead1=false; wasDead2=false; // raid3=BuildObject("fvsent",2,"raid3"); // Goto(raid3,recy); // raid4=BuildObject("fvtank",2,"raid4"); // Goto(raid4,recy); wait_count=0; } } } break; case 4: // there is one, mark it with the geyser // mark that with a power up // good, now find another. if ((GetDistance(player,pool1)<75.0f) && (!found_field1)) { // there is a field, deploy the scavenger AudioMessage("isdf0508.wav"); found_field1=true; } if (scav2_deployed) // any scav is deployed { mission_state++; scav1_deployed=true; ClearObjectives(); AddObjective("isdf0508.otf",WHITE,10.0f); /* SetObjectiveOff(pool1); SetObjectiveName(pool2,"bio-metal 1"); SetObjectiveOn(pool2); */ nav2=BuildObject("ibnav",1,"scrap_field3"); TranslateString2(tempstr, sizeof(tempstr), "Mission0502"); // Bio-Metal 2 SetObjectiveName(nav2,tempstr); SetObjectiveOff(nav1); SetObjectiveOn(nav2); AudioMessage("isdf0509.wav"); // good job if (!found_field1) { AudioMessage("isdf0519.wav"); /* Don't send out scavengers unescorted. Be sure to stay with them. */ } } break; case 5: if ((scav2_deployed) && (!found_field3) && (GetDistance(player,"scrap_field3")<225.0f)) { found_field3=true; /* Watch out! That field looks hot. */ AudioMessage("isdf0512.wav"); ClearObjectives(); AddObjective("isdf0511.otf",RED,10.0f); mortar_delay=GetTime()+15.0f; } nearguy=GetNearestEnemy(player); if ((found_field3) && (GetTime()>mortar_delay) && (GetDistance(player,nearguy)>150.0f)) { /* Cineractive Cooke, I'm sending you force to help you take out those turrets! Here are some mortar bikes. */ Build(constructor,"ibfact5",1); factory=true; audmsg=AudioMessage("isdf0527.wav"); //was AudioMessage("isdf0513.wav"); ClearObjectives(); AddObjective("isdf0516.otf",WHITE,10.0f); /* int grp=GetFirstEmptyGroup(); mbike1=BuildObject("ivmbike",1,"patrol_south"); SetGroup(mbike1,grp); Follow(mbike1,player,0); Handle mb=BuildObject("ivmbike",1,"patrol_east"); SetGroup(mb,grp); Follow(mb,player,0); mb=BuildObject("ivmbike",1,"patrol_west"); SetGroup(mb,grp); Follow(mb,player,0); mb=BuildObject("ivmbike",1,"patrol_north"); SetGroup(mb,grp); Follow(mb,player,0); */ mission_state++; CameraReady(); MoviePlaying=true; } break; case 6:// attack phase /* First check to see if you blew up sturret1-4 then create Manson at manson_start "Good job Cooke, you show promise" Then follow Manson (he's an objective) into the base When you get close lets run past those towers when you get there hop out and use your demolition charge Then run away. Everything blows up. */ if (factory) { Dropoff(constructor,"fact"); factory=false; } if (MoviePlaying) { CameraObject(constructor,1,11,22,constructor); if (IsAudioMessageDone(audmsg)) { MoviePlaying=false; CameraFinish(); } } if ((!killed_turrets) && (!IsAlive(sturret1)) && (!IsAlive(sturret2)) && (!IsAlive(sturret3)) && (!IsAlive(sturret4)) && (!IsAlive(sturret5)) && (!IsAlive(sturret6))) { AudioMessage("isdf0514.wav"); // you show promise killed_turrets=true; ClearObjectives(); AddObjective("isdf0512.otf",WHITE,10.0f); manson_shows=GetTime()+10.0f; manson=BuildObject("ivtank",3,"manson_start"); SetObjectiveName(manson, "Maj. Manson"); Handle minion=BuildObject("ivtank",3,"manson_escort1"); SetObjectiveName(minion, "Sgt. Zdarko"); Follow(minion,manson); minion=BuildObject("ivtank",3,"manson_escort2"); SetObjectiveName(minion, "Sgt. Masiker"); Follow(minion,manson); } if ((killed_turrets) && (!manson_message) && (GetTime()>manson_shows)) { /* We found the objective, follow me */ AudioMessage("isdf0515.wav"); SetObjectiveOff(nav2); SetObjectiveOn(manson); ClearObjectives(); AddObjective("isdf0518.otf",WHITE,10.0f); manson_message=true; mission_state++; } break; case 7: if (GetDistance(player,manson)<50.0f) { ClearObjectives(); AddObjective("isdf0513.otf",WHITE,10.0f); SetIndependence(manson,0); SetAvoidType(manson,0); AudioMessage("isdf0539a.wav"); Goto(manson,"manson_path1"); mission_state++; } break; case 8: AddHealth(manson,100); // we don't want him to die here if ((wait_up) && (GetDistance(player,manson)<100.0f)) { // right now this goes off too // soon. You go on to path 2 before 1 is doen // But at least it makes sure // you are close once. wait_up=false; Goto(manson,"manson_path2"); } if ((!gun_tower_message) && (GetDistance(manson,"guntower2")<200.0f)) { /* There are gun towers ahead let's try to go past fast. */ AudioMessage("isdf0516.wav"); gun_tower_message=true; ClearObjectives(); AddObjective("isdf0514.otf",WHITE,10.0f); gun_tower_counter=0; } if (gun_tower_message) { gun_tower_counter++; if (gun_tower_counter>450) // you are on a timer { AudioMessage("isdf0529.wav"); ClearObjectives(); AddObjective("isdf0520.otf",RED,10.0f); FailMission(GetTime()+10.0f,"isdf0520.otf"); mission_state=12; } if (gun_tower_counter==300) { AudioMessage("isdf0528.wav"); } } if ((gun_tower_message) && (!hop_out_message) && (GetDistance(player,teleportal)<100.0f)) { /* Get out and use your demolition charge on that building */ AudioMessage("isdf0173.wav"); // that looks like one of ours? AudioMessage("isdf0517.wav"); hop_out_message=true; SetObjectiveOff(manson); SetObjectiveOn(teleportal); TranslateString2(tempstr, sizeof(tempstr), "Mission0503"); // Excavator SetObjectiveName(teleportal,tempstr); ClearObjectives(); AddObjective("isdf0515.otf",WHITE,10.0f); SetIndependence(manson,1); mission_state++; } break; case 9: if ((!out_of_ship_ever) && (out_of_ship)) { out_of_ship_ever=true; ClearObjectives(); AddObjective("isdf0521.otf",WHITE,5.0f); } if (!IsAlive(teleportal)) { if (out_of_ship_ever) { AudioMessage("isdf0518.wav"); SucceedMission(GetTime()+10.0f,"isdf05w1.txt"); mission_state++; } else { AudioMessage("isdf0521.wav"); /* I said use your demolition charge */ FailMission(GetTime()+10.0f,"isdfl1.txt"); mission_state++; } } break; case 12: /* If you lose the constructor this condition occurs. */ AudioMessage("isdf0522.wav"); ClearObjectives(); AddObjective("isdf0519.otf",RED,10.0f); FailMission(GetTime()+10.0f,"isdf0519.otf"); mission_state++; break; case 13: // waiting for the end of the world. break; } /* the lurkers */ if ((lurker1==NULL) && (GetDistance(player,"lurker1")<150.0f)) { lurker1=BuildObject("fvsent",2,"lurker1"); } if ((lurker2==NULL) && (GetDistance(player,"lurker2")<150.0f)) { lurker2=BuildObject("fvsent",2,"lurker1"); } if ((lurker3==NULL) && (GetDistance(player,"lurker3")<150.0f)) { lurker3=BuildObject("fvsent",2,"lurker3"); } if ((lurker4==NULL) && (GetDistance(player,"lurker4")<150.0f)) { lurker4=BuildObject("fvsent",2,"lurker4"); } }