Particle's Custom RPG

PCRPG Development => Development => Topic started by: eViL on March 22, 2003 03:09 am CST

Title: The Code....
Post by: eViL on March 22, 2003 03:09 am CST
yes, its the code....

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// This Makes Declared Items UnDroppable
// $DropProo
f[%item] = true;

function Item::onDrop(%player,%item)
{
   dbecho($dbechoMode, "Item::onDrop(" @ %player @ ", " @ %item @ ")");

   if($matchStarted)
   {
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
      if($DropProof[%item])
         return;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

      if(%item.className != Armor)
      {
         if(%item.className == Projectile)
            %delta = 20;
         else
            %delta = 1;

         if(Player::getItemCount(%player, %item) < %delta)
            %delta = Player::getItemCount(%player, %item);

         if(%delta > 0)
         {
            %obj = newObject("","Item",%item,1,false);
            %obj.delta = %delta;
                schedule("Item::Pop(" @ %obj @ ");", $ItemPopTime, %obj);
               addToSet("MissionCleanup", %obj);

            if(IsDead(%player))
               GameBase::throw(%obj, %player, 10, true);
            else
            {
               GameBase::throw(%obj, %player, 15, false);
               Item::playPickupSound(%obj);
            }

            Player::decItemCount(%player,%item,%delta);
            RefreshAll(Player::getClient(%player));
            return %obj;
         }
      }
   }
}

function Ammo::onDrop(%player, %item)
{
   dbecho($dbechoMode, "Ammo::onDrop(" @ %player @ ", " @ %item @ ")");

   if($matchStarted)
   {

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
      if($DropProof[%item])
         return;
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

      if(%item.className == Ammo)
         %delta = 20;
      else
         %delta = 1;

      if(Player::getItemCount(%player, %item) < %delta)
         %delta = Player::getItemCount(%player, %item);

      if(%delta > 0)
      {
         %obj = newObject("","Item",%item,%delta,false);
         %obj.delta = %delta;
         schedule("Item::Pop(" @ %obj @ ");", $ItemPopTime, %obj);
         addToSet("MissionCleanup", %obj);
         GameBase::throw(%obj,%player,20,false);
         Item::playPickupSound(%obj);
         Player::decItemCount(%player,%item,%delta);
         RefreshAll(Player::getClient(%player));
      }
   }
}

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// This Puts Items Declared Into Storage Upon Death
// $DeathStorage[%item] = true;

function Player::onKilled(%this)
{
   dbecho($dbechoMode, "Player::onKilled(" @ %this @ ")");
   %clientId = Player::getClient(%this);
   %killerId = fetchData(%clientId, "tmpkillerid");
   storeData(%clientId, "tmpkillerid", "");
   Client::setControlObject(%clientId.possessId, %clientId.possessId);
   Client::setControlObject(%clientId, %clientId);
   storeData(%clientId.possessId, "dumbAIflag", "");
   $possessedBy[%clientId.possessId] = "";

   if(IsStillArenaFighting(%clientId))
   {
      %a = GetArenaDuelerIndex(%clientId);
      $ArenaDueler[%a] = GetWord($ArenaDueler[%a], 0) @ " DEAD";

      if(!Player::IsAiControlled(%clientId))
         %clientId.RespawnMeInArena = True;
   }
   else if(IsInRoster(%clientId))
   {
      if(Player::isAiControlled(%clientId))
         RemoveFromRoster(%clientId);
   }
   else if(fetchData(%clientId, "noDropLootbagFlag"))
   { }
   else
   {
      %tmploot = "";

      if(fetchData(%clientId, "COINS") > 0)
         %tmploot = %tmploot @ "COINS " @ floor(fetchData(%clientId, "COINS")) @ " ";

      storeData(%clientId, "COINS", 0);
      %max = getNumItems();

      for (%i = 0; %i < %max; %i++)
      {
         %a = getItemData(%i);
         %itemcount = Player::getItemCount(%clientId, %a);

         if(%itemcount)
         {
            %flag = False;

            if(fetchData(%clientId, "LCK") >= 0)
            {
               if(Player::getMountedItem(%clientId, $WeaponSlot) == %a || %a.className == "Equipped" || $LoreItem[%a] == True)
                  %flag = True;
            }
            else
               %flag = True;

            if(fetchData(%clientId, "LCK") < 0 && Player::isAiControlled(%clientId))
               %flag = True;

            if(%a == CastingBlade)
               %flag = False;

            if($StealProtectedItem[%a])
               %flag = False;

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
            if($DeathStorage[%item])
            {
               %b = getItemData(%i);

               if(%b.className == "Equipped")
                  %b = String::getSubStr(%b, 0, String::len(%b)-1);

               storeData(%clientId, "BankStorage", SetStuffString(fetchData(%clientId, "BankStorage"), %b, %itemcount));
               Player::setItemCount(%clientId, %a, 0);
            }
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

            if(%flag)
            {
               %b = %a;

               if(%b.className == "Equipped")
                  %b = String::getSubStr(%b, 0, String::len(%b)-1);

               if(Player::getMountedItem(%clientId, $WeaponSlot) == %a)
               {
                  %tmploot = %tmploot @ %b @ " 1 ";
                  Player::decItemCount(%clientId, %a);
               }
               else
               {
                  %tmploot = %tmploot @ %b @ " " @ Player::getItemCount(%clientId, %a) @ " ";
                  Player::setItemCount(%clientId, %a, 0);
               }
            }
         }
      }

      if(%tmploot != "")
      {
         if(Player::isAiControlled(%clientId))
            TossLootbag(%clientId, %tmploot, 1, "*", 300);
         else
         {
            %namelist = Client::getName(%clientId) @ ",";

            if(fetchData(%clientId, "LCK") >= 0)
               TossLootbag(%clientId, %tmploot, 5, %namelist, Cap(fetchData(%clientId, "LVL") * 300, 300, 3600));
            else
               TossLootbag(%clientId, %tmploot, 5, %namelist, Cap(fetchData(%clientId, "LVL") * 0.2, 5, "inf"));
         }
      }

      updateSpawnStuff(%clientId);
      %victimH = fetchData(%clientId, "MyHouse");
      %killerH = fetchData(%killerId, "MyHouse");
      %vhn = GetHouseNumber(%victimH);
      %khn = GetHouseNumber(%killerH);

      if(%vhn != "")
      {
         if(fetchData(%clientId, "LCK") < 0)
         {
            if(fetchData(%clientId, "RankPoints") <= 0)
               BootFromCurrentHouse(%clientId, True);
            else
               Client::sendMessage(%clientId, $MsgRed, "You have lost all your Rank Points because you died with 0 LCK!");

            storeData(%clientId, "RankPoints", 0);
         }

         Client::sendMessage(%clientId, $MsgWhite, "You lost 2 Rank Points.");
         storeData(%clientId, "RankPoints", 2, "dec");

         if(%khn != "")
         {
            if(%khn != %vhn)
            {
               Client::sendMessage(%killerId, $MsgWhite, "You gained 1 Rank Point!");
               storeData(%killerId, "RankPoints", 1, "inc");
            }
            else
            {
               Client::sendMessage(%killerId, $MsgWhite, "You lost 1 Rank Point.");
               storeData(%killerId, "RankPoints", 1, "dec");
            }
         }
      }
      else if(%vhn == "" && %khn != "")
      { }

      if(!IsInArenaDueler(%clientId) && !Player::isAiControlled(%clientId) && fetchData(%clientId, "LCK") < 0)
      {
         if($hardcore)
         {
            if(fetchData(%clientId, "LVL") > 8 && fetchData(%clientId, "RemortStep") > 0)
            {
               if(!Player::isAiControlled(%killerId))
                  ResetPlayer(%clientId);
            }
         }

         storeData(%clientId, "zone", "");
      }
   }

   if(fetchData(%clientId, "deathmsg") != "")
   {
      %kitem = Player::getMountedItem(%killerId, $WeaponSlot);
      %msg = nsprintf(fetchData(%clientId, "deathmsg"), Client::getName(%killerId), Client::getName(%clientId), %kitem.description);
      remoteSay(%clientId, 0, %msg);
   }

   if(Player::isAiControlled(%clientId))
   {
      %i = GetEventCommandIndex(%clientId, "onkill");

      if(%i != -1)
      {
         %name = GetWord($EventCommand[%clientId, %i], 0);
         %type = GetWord($EventCommand[%clientId, %i], 1);
         %cl = NEWgetClientByName(%name);

         if(%cl == -1)
            %cl = 2048;

         %cmd = String::NEWgetSubStr($EventCommand[%clientId, %i], String::findSubStr($EventCommand[%clientId, %i], ">")+1, 99999);
         %pcmd = ParseBlockData(%cmd, %clientId, %killerid);
         $EventCommand[%clientId, %i] = "";
         schedule("remoteSay(" @ %cl @ ", 0, \"" @ %pcmd @ "\", \"" @ %name @ "\");", 2);
      }

      ClearEvents(%clientId);
   }

   storeData(%clientId, "noDropLootbagFlag", "");
   storeData(%clientId, "SpellCastStep", "");
   %clientId.sleepMode = "";
   refreshHPREGEN(%clientId);
   refreshMANAREGEN(%clientId);
   Client::setControlObject(%clientId, %clientId);
   storeData(%clientId, "dumbAIflag", "");
   storeData(%clientId, "lastzone", fetchData(%clientId, "zone"));
   PlaySound(RandomRaceSound(fetchData(%clientId, "RACE"), Death), GameBase::getPosition(%clientId));
   %clientId.dead = 1;

   if($AutoRespawn > 0)
      schedule("Game::autoRespawn(" @ %clientId @ ");",$AutoRespawn,%clientId);

   Player::setDamageFlash(%this,0.75);

   if(%clientId != -1)
   {
      if(%this.vehicle != "")
      {
         if(%this.driver != "")
         {
            %this.driver = "";
            Client::setControlObject(Player::getClient(%this), %this);
            Player::setMountObject(%this, -1, 0);
         }
         else
         {
            %this.vehicle.Seat[%this.vehicleSlot-2] = "";
            %this.vehicleSlot = "";
         }

         %this.vehicle = "";
      }

      schedule("GameBase::startFadeOut(" @ %this @ ");", $CorpseTimeoutValue, %this);
      Client::setOwnedObject(%clientId, -1);
      Client::setControlObject(%clientId, Client::getObserverCamera(%clientId));
      Observer::setOrbitObject(%clientId, %this, 15, 15, 15);
      schedule("deleteObject(" @ %this @ ");", $CorpseTimeoutValue + 2.5, %this);
      %clientId.observerMode = "dead";
      %clientId.dieTime = getSimTime();
   }
}

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// This Sets User Lists For Set Items
// $UserList[%item] = "%name1 %name2 %name3 .... ";

function Item::onUse(%player,%item)
{
   dbecho($dbechoMode, "Item::onUse(" @ %player @ ", " @ %item @ ")");

   %clientId = Player::getClient(%player);

   if(!IsDead(%clientId))
   {

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
      if($UserList[%item] != "")
      {
         %name = Client::getName(%clientId);
         %found = false;

         for(%i=0; (%word=getWord($UserList[%item], %i)) != ""; %i++)
         {
            if(%word == %name)
               %found = true;
         }

         if(!%found)
            return;
      }
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

      if(%item.className == Accessory)
      {
         %cnt = 0;
         %max = getNumItems();

         for(%i = 0; %i < %max; %i++)
         {
            %checkItem = getItemData(%i);

            if(%checkItem.className == Equipped && GetAccessoryVar(%checkItem, $AccessoryType) == GetAccessoryVar(%item, $AccessoryType))
               %cnt += Player::getItemCount(%player, %checkItem);
         }

         if(SkillCanUse(%clientId, %item))
         {
            if(%cnt < $maxAccessory[GetAccessoryVar(%item, $AccessoryType)])
            {
               Client::sendMessage(%clientId, $MsgBeige, "You equipped " @ %item.description @ ".");
               Player::setItemCount(%player, %item, Player::getItemCount(%player, %item)-1);
               Player::setItemCount(%player, %item @ "0", Player::getItemCount(%player, %item @ "0")+1);
            }
            else
               Client::sendMessage(%clientId, $MsgRed, "You can't equip this item because you have too many already equipped.~wC_BuySell.wav");
         }
         else
            Client::sendMessage(%clientId, $MsgRed, "You can't equip this item because you lack the necessary skills.~wC_BuySell.wav");

         if($OverrideMountPoint[%item] == "")
            Player::mountItem(%player, %item @ "0", 1, 0);
      }
      else if(%item.className == Equipped)
      {
         %o = String::getSubStr(%item, 0, String::len(%item)-1);
         Client::sendMessage(%clientId, $MsgBeige, "You unequipped " @ %item.description @ ".");
         Player::setItemCount(%player, %item, Player::getItemCount(%player, %item)-1);
         Player::setItemCount(%player, %o, Player::getItemCount(%player, %o)+1);

         if($OverrideMountPoint[%item] == "")
            Player::unMountItem(%player, 1);
      }
      else
         RPGmountItem(%player, %item, $DefaultSlot);

      refreshHP(%clientId, 0);
      refreshMANA(%clientId, 0);
      RefreshAll(%clientId);
   }
}

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Declare Your Item Special Features

$StealProtectedItem[BadgeOfHonor] = true;
$DeathStorage[BadgeOfHonor] = true;
$DropProof[BadgeOfHonor] = true;

$StealProtectedItem[BadgeOfLoyalty] = true;
$DeathStorage[BadgeOfLoyalty] = true;
$DropProof[BadgeOfLoyalty] = true;

$StealProtectedItem[BadgeOfFriendship] = true;
$DeathStorage[BadgeOfFriendship] = true;
$DropProof[BadgeOfFriendship] = true;

$StealProtectedItem[BadgeOfReverence] = true;
$DeathStorage[BadgeOfReverence] = true;
$DropProof[BadgeOfReverence] = true;

$StealProtectedItem[LightningBlade] = true;
$DeathStorage[LightningBlade] = true;
$DropProof[LightningBlade] = true;
$UserList[LightningBlade] = "Ozzy Particle Pecker Draak Funger eViL Mithrandir";

p.s. - spacing complimentary to our friendly < pre > HTML command =)
Title:
Post by: Hollywood on March 22, 2003 05:03 pm CST
Woohoo.
Title:
Post by: funger on March 24, 2003 01:20 am CST
looks good to me, but can i have all my items steal protected lol.
good job evil
Title:
Post by: Vorter_X_ on March 24, 2003 02:40 am CST
where is my name in there????
Title:
Post by: Hollywood on March 24, 2003 02:04 pm CST
Oh yeah, instead of Mithrandir, that should be Gnarus.
Title:
Post by: Crash on March 29, 2003 07:48 pm CST
...
*crie*
Title:
Post by: Sabby on March 29, 2003 11:15 pm CST
Gnarus has admin?... Go eViL!
Title:
Post by: UnderGod on March 30, 2003 01:37 pm CST
None of those people listed have admin except Part and myself.


And frankly, I would shoot myself if Mith had admin.
Title:
Post by: Sabby on March 30, 2003 03:42 pm CST
Quote from: "UnderGod"
None of those people listed have admin except Part and myself.


And frankly, I would shoot myself if Mith had admin.


Rofl...
Title:
Post by: xkenshinx on April 5, 2003 05:51 pm CST
Quote from: "UnderGod"
None of those people listed have admin except Part and myself.


And frankly, I would shoot myself if Mith had admin.


not before u shoot particle ... for letting him be admin.. and then shooting mith.. for good measure ....
Title:
Post by: Resident_Evil on April 5, 2003 05:53 pm CST
HS LOL
Title:
Post by: eViL on April 5, 2003 10:35 pm CST
*hears UltraKill from UT* =D
Title:
Post by: Kasuto on July 14, 2003 06:32 am CDT
$DropProof[cursedtent] = 1;
$StorageProof[cursedtent] = 1;

hehehehe. Then you could have bards #cast uncurse....for a fee of course ;)
Title:
Post by: Vorter_X_ on July 14, 2003 06:36 am CDT
cused tent?
Title:
Post by: Kasuto on July 14, 2003 07:02 am CDT
cursed...in Dragon Warrior for nintendo there were cursed items (i think usually armor), that once equipped, couldn't be removed without a Shaman guy (the shaman guy also handled saving your game and reviving party members who died in combat if you didn't have someone in your party with revive). So if you had a cursed tent here, you'd be 40lbs over what you wanted and it'd of course not be a working tent, just a cursed item you're stuck with until you get uncursed.

Ya, i'm just that bored.
Title:
Post by: xkenshinx on July 14, 2003 08:22 am CDT
lmao Dragon Warrior One... was my first rpg  :cry:

... im only posting because... dragon warrior kicks ass
Title:
Post by: Kasuto on July 15, 2003 03:35 am CDT
i got Dragon Warrior 1 through 4 on NES :D

DW4 kicks ass, it's got 5 separate chapters where you play as dif characters with prechosen names, heh in chapter 3 you get to be Taloon the merchant and ya make money selling things. Eventually you move to a castle and open up a shop and get married, then in chapter 5 when you get to play as your char (the name you choose at beginning) you pick up taloon and his wife changes the shop to a storage thing where you can drop off items and gold, it's way sweet. I highly recommend it, but it still costs around 50 bucks for that game.