The Exiled

Shunned by Man, Accepted by Gods
* FAQ    * Search   * Members
* Login   * Register
It is currently Thu Mar 28, 2024 4:53 pm 

 View unanswered posts | View active topics


 Board index » General Area » Mapping
Post new topic Reply to topic Users browsing this forum: No registered users and 1 guest
Author
Message
TE-Krogoth


User avatar
Joined: Tue Jun 07, 2005 8:01 am
Posts: 2092
Location: Texas
Post Posted: Wed Jun 08, 2005 8:57 am    Post subject: Spawning a bot by switch
Reply with quote
 
Open up your map in editor mode.
Click MissionGroup
Press Ctrl N
Open MissionGroup
Click on the new simgroup
Name it AI
Now put your bots in there.
Save it

Open your Mission file. (.mis)
Scroll all the way to the very bottom.
Put this in.

Code:
function AI::wieldWeapons(%aiName)
{
   %aiId = AI::getId(%aiName);
   Player::setItemCount(%aiId, Railgun, 1); // this can be any weapon
   Player::setItemCount(%aiId, RailAmmo, 10000); //be sure to give it its ammo
   %rate = Player::getSensorSupression(%aiId) + 5;
   Player::setSensorSupression(%aiId, %rate);
   //GameBase::startFadeout(%aiId);
   Player::mountItem(%aiId, EnergyPack, 1);
   AI::SetVar(%aiName, triggerPct, 0.03 );
   AI::setVar(%aiName, iq, 100 );
   AI::setVar(%aiName, attackMode, 1); //tells it what mode its in
   AI::setAutomaticTargets( %aiName );
   ai::callbackPeriodic(%aiName, 3, ai::AnniWeaponChange);
}

function ai::AnniWeaponChange(%aiName)
{
   %aiId = AI::getId(%aiName);
   %curTarget = ai::getTarget( %aiName );

   if(%curTarget == -1)
   {
   return;
   }

   %targLoc = GameBase::getPosition(Client::getOwnedObject(%curTarget));
   %aiLoc = GameBase::getPosition(Client::getOwnedObject(%aiId));
   %targetDist = Vector::getDistance(%aiLoc, %targLoc);
   if(%targetDist > 25)
   {
      Player::mountItem(%aiId, Railgun, 0); // if you changed the weapon don't forget to change it here too
      AI::SetVar(%aiName, triggerPct, 1.0 );
   }   
   else
   {
      if(Player::isJetting(%curTarget))
      {   
         Player::mountItem(%aiId,  Railgun, 0); // if you changed the weapon don't forget to change it here too
         AI::SetVar(%aiName, triggerPct, 1.0 );
      }
      else
      {
         Player::mountItem(%aiId, Railgun, 0);  // if you changed the weapon don't forget to change it here too
         AI::SetVar(%aiName, triggerPct, 0.05 );
      }   
   }
}
 
function Switch2::onCollision(%this, %object) { //Switch2 is the Static Shape and name of the switch  it can be anything you want
%client = Player::Getclient(%object);
if(GameBase::getMapName(%this) == "Switch2") { //Switch2 is the Static Shape and name of the switch  it can be anything you want
  createAI( Battlebot1 , "MissionGroup\\AI\\sniper1", armorTank, "sniper1" ); //sniper1 was the name of the bot, "sniper1" can be changed to whatever you want its name to be
  createAI( Battlebot2 , "MissionGroup\\AI\\sniper2", armorTank, "sniper2" );
  createAI( Battlebot3 , "MissionGroup\\AI\\sniper3", armorTank, "sniper3" );
  createAI( Battlebot4 , "MissionGroup\\AI\\sniper4", armorTank, "sniper4" );
  createAI( Battlebot5 , "MissionGroup\\AI\\sniper5", armorTank, "sniper5" );
  createAI( Battlebot6 , "MissionGroup\\AI\\sniper6", armorTank, "sniper6" );
  AI::wieldWeapons(Battlebot1); // this is to get the bot to have weapons
  AI::wieldWeapons(Battlebot2);
  AI::wieldWeapons(Battlebot3);
  AI::wieldWeapons(Battlebot4);
  AI::wieldWeapons(Battlebot5);
  AI::wieldWeapons(Battlebot6);

}
}


Here's the switch:

Code:


         instant StaticShape "Switch2" {
            dataBlock = "TowerSwitch";
            name = "Switch2";
            position = "-198.33 -254.434 -143.071";
            rotation = "0 0 0";
            destroyable = "True";
            deleteOnDestroy = "False";
            objectiveLine = "15";
            scoreValue = "1";
         };


I used the switch above for what I hit. It can be anything. I put this on here to show its names. The StaticShape and the name need to be the same as the ones in the function above.

Be sure to read the notes (// are the notes)

If it doesn't work, just ask.



Image
Image
 Top Offline
Profile WWWYIM
Display posts from previous:  Sort by  
Post new topic Reply to topic Board index » General Area » Mapping
Previous topic :: Next topic  
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group