My level up system.

For questions relating to POL scripting (not necessarily related to WoD)

Moderators: Siobhan, Sebastian, Drocket

My level up system.

Postby htfy on Tue Jul 01, 2003 9:56 pm

Drocket you and bigbadwolf2022 came up with a super cool level up system which I would like to implement into my shard, but mine is much easier. (I think?)
Instead of getting points to put into all your skills and then actually distributing them, I just want each level up to add 1 whole point to all your prim/sec/trade skills, and 1 point to str/dex/int.

Could you please help me out on this one?

Thank you.
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

Drocket?

Postby htfy on Sat Jul 05, 2003 9:24 am

Are you busy or on vacation or what? Havent seen a response from you in a few days.
:shock:
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

Postby Augur Wildwood on Sat Jul 05, 2003 8:13 pm

I suspect he is busy. Just be patient. :)
Augur Wildwood
Sr. Regular Poster
 
Posts: 154
Joined: Tue Oct 08, 2002 8:37 pm
Location: Berkeley, CA

Postby Drocket on Sat Jul 05, 2003 10:10 pm

Sorry, just a combination of laziness and busyness :)

Let me see, the last thing I posted about the level system stuff was an AwardExperience function that makes points available to spend. Quick copy-n-paste here so we're all on the same page:

Code: Select all
function AwardExperience (character, newxp)
newxp := CINT (newxp);
if (!character or !newxp)
return;
endif

set_critical (1);
var oldxp := GetObjProperty (character, "experience");
if (!oldxp)
oldxp := 0;
endif
var totalxp := oldxp + newxp;

var xpneeded := GetExperienceForNextLevel (character);
if (totalxp >= xpneeded)
//We're going to level up
var currentlevel := GetObjProperty (character, "experiencelevel");
currentlevel := currentlevel + 1;
SetObjProperty (character, "experiencelevel), currentlevel);
totalxp := totalxp - xpneeded;

SendSysMessage (character, "Welcome to level " + currentlevel + "!");

var pointsavailable := GetObjProperty (character, "pointsavailable");
if (!pointsavailable)
pointsavailable := 0;
endif
pointsavailable := pointsavailable + 10;
SetObjProperty (character, "pointsavailable", pointsavailable);
endif

SetObjProperty (character, "experience", totalxp);
set_critical (0);

endfunction


(nothing new yet, that's just the old code)

Just to make it a bit easier to work on, I'm going to split out the level up stuff from the award experience function and just make that its own level:


Code: Select all
function AwardExperience (character, newxp)
newxp := CINT (newxp);
if (!character or !newxp)
return;
endif

set_critical (1);
var oldxp := GetObjProperty (character, "experience");
if (!oldxp)
oldxp := 0;
endif
var totalxp := oldxp + newxp;

var xpneeded := GetExperienceForNextLevel (character);
if (totalxp >= xpneeded)
//We're going to level up
var currentlevel := GetObjProperty (character, "experiencelevel");
currentlevel := currentlevel + 1;
SetObjProperty (character, "experiencelevel), currentlevel);
totalxp := totalxp - xpneeded;

SendSysMessage (character, "Welcome to level " + currentlevel + "!");
//Replaced this section here with the new code
AwardPointsForLevelUp (character);
endif
endif

SetObjProperty (character, "experience", totalxp);
set_critical (0);

endfunction


Ok, so now we make a new AwardPointsForLevelUp (character) function, which will add one point to your skills and stats. That would look something like this:

Code: Select all
function AwardPointsForLevelUp (character)
var basestr := CINT (GetAttributeBaseValue (character, "Strenth")/10);
var maxstr := GetObjProperty (character, "maxstr");
if (!maxstr)
maxstr := 75;
endif

basestr := basestr + 1;
if (basestr > maxstr)
basestr := maxstr;
endif
SetAttributeBaseValue (character, "Strength", basestr*10);

//Do the exact same thing for int and dex

//now for skills
//be sure you include skills.inc and attributes.inc
var specs := LoadSpecializations (character);
for i := 1 to 3
var skillid := specs[i];
if (skillid or skillid == 0)
var skillval := CINT (GetAttributeBaseValue (character, GetAttributeIDBySkillid (skillid))/10);
skillval := skillval + 1;
if (skillval > 100)
skillval := 100;
endif
SetAttributeBaseValue (character, GetAttributeIDBySkillID (skillid), skillval * 10);
endif
endfor

//secondaries
for i := 4 to 6
var skillid := specs[i];
if (skillid or skillid == 0)
var skillval := CINT (GetAttributeBaseValue (character, GetAttributeIDBySkillid (skillid))/10);
skillval := skillval + 1;
if (skillval > 80)
skillval := 80;
endif
SetAttributeBaseValue (character, GetAttributeIDBySkillID (skillid), skillval * 10);
endif
endfor

//the tradeskill
var skillid := specs[7];
if (skillid or skillid == 0)
var skillval := CINT (GetAttributeBaseValue (character, GetAttributeIDBySkillid (skillid))/10);
skillval := skillval + 1;
if (skillval > 100)
skillval := 100;
endif
SetAttributeBaseValue (character, GetAttributeIDBySkillID (skillid), skillval * 10);
endif

endfunction

As normal, none of this is tested in any way :)
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

Patient?

Postby htfy on Sat Jul 05, 2003 11:30 pm

No... I have ADHD, and no I am not kidding, so patience is something I do not have. :twisted:

Thanks for the code, I will try to put it in as soon as I can.

I checked ot drocket.net and your links. Is there a NEWBY (like an idiot guide) guide for pol? I thought I could do some stuff but I just cant. Its too... weird.

Thanks again.
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

Errors

Postby htfy on Sun Jul 06, 2003 2:04 am

This was wrong.. ALL wrong. I messed up and it caused a lot of errors, and I mean A LOT!
I will add all the info you need in my next post. I got it down to a few errors, not 50 like before.

(I edited this post. I posted a bunch of wrong info here. All mistakes were made by me. I should learn how to check stuff before I post utter crap. :evil: )
Last edited by htfy on Sun Jul 06, 2003 10:22 am, edited 1 time in total.
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

Ok here goes.

Postby htfy on Sun Jul 06, 2003 10:19 am

These are the errors that I am getting.

Function SetObjProperty: Parameter property_value_strin_only was not passed, and there is no defualt.
Erro in getting arguments for function SetObjProperty
Error compiling statement starting at File : ... /include/experience.inc, line 18.
Error compiling statement at .../include/experience.inc, Line 17
Error in function 'AwardExperience, Fule ...//include/experience.inc, line 22


Ok so we got it down to under 10 errors! HEY HEY lol.

Thank you for all your help!
In the next 2 posts I will put my experience.inc and my death.src files. Can you please go over them and tell me what I did wrong?

Thanks!
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

experience.inc

Postby htfy on Sun Jul 06, 2003 10:20 am

Code: Select all
include "include/skills";
include "include/attributes";

   function AwardExperience (character, newxp)
newxp := CINT (newxp);
if (!character or !newxp)
return;
endif

set_critical (1);
var oldxp := GetObjProperty (character, "experience");
if (!oldxp)
oldxp := 0;
endif
var totalxp := oldxp + newxp;

var xpneeded := GetExperienceForNextLevel (character);
if (totalxp >= xpneeded)
//We're going to level up
var currentlevel := GetObjProperty (character, "experiencelevel");
currentlevel := currentlevel + 1;
SetObjProperty (character, "experiencelevel"), currentlevel);
totalxp := totalxp - xpneeded;

SendSysMessage (character, "Welcome to level " + currentlevel + "!");
//Replaced this section here with the new code
AwardPointsForLevelUp (character);
endif
endif

SetObjProperty (character, "experience", totalxp);
set_critical (0);

endfunction


   function AwardPointsForLevelUp (character)
var basestr := CINT (GetAttributeBaseValue (character, "Strenth")/10);
var maxstr := GetObjProperty (character, "maxstr");
if (!maxstr)
maxstr := 75;
endif

basestr := basestr + 1;
if (basestr > maxstr)
basestr := maxstr;
endif
SetAttributeBaseValue (character, "Strength", basestr*10);

var baseint := CINT (GetAttributeBaseValue (character, "Intelligence")/10);
var maxint := GetObjProperty (character, "maxint");
if (!maxint)
maxint := 75;
endif

baseint := baseint + 1;
if (baseint > maxint)
baseint := maxint;
endif

SetAttributeBaseValue (character, "Intelligence", baseint*10);

var basedex := CINT (GetAttributeBaseValue (character, "Dexterity")/10);
var maxdex := GetObjProperty (character, "maxdex");
if (!maxdex)
maxdex := 75;
endif

basedex := basedex + 1;
if (basedex > maxdex)
basedex := maxdex;
endif

SetAttributeBaseValue (character, "Dexterity", basedex*10);


//now for skills
//be sure you include skills.inc and attributes.inc
var specs := LoadSpecializations (character);
for i := 1 to 3
var skillid := specs[i];
if (skillid or skillid == 0)
var skillval := CINT (GetAttributeBaseValue (character, GetAttributeIDBySkillid (skillid))/10);
skillval := skillval + 1;
if (skillval > 100)
skillval := 100;
endif
SetAttributeBaseValue (character, GetAttributeIDBySkillID (skillid), skillval * 10);
endif
endfor

//secondaries
for i := 4 to 6
var skillid := specs[i];
if (skillid or skillid == 0)
var skillval := CINT (GetAttributeBaseValue (character, GetAttributeIDBySkillid (skillid))/10);
skillval := skillval + 1;
if (skillval > 80)
skillval := 80;
endif
SetAttributeBaseValue (character, GetAttributeIDBySkillID (skillid), skillval * 10);
endif
endfor

//the tradeskill
var skillid := specs[7];
if (skillid or skillid == 0)
var skillval := CINT (GetAttributeBaseValue (character, GetAttributeIDBySkillid (skillid))/10);
skillval := skillval + 1;
if (skillval > 100)
skillval := 100;
endif
SetAttributeBaseValue (character, GetAttributeIDBySkillID (skillid), skillval * 10);
endif

endfunction



   function GetExperienceForNextLevel (character)
var currentlevel := GetObjProperty (character, "experiencelevel");
if (!currentlevel)
currentlevel := 1;
endif
return (currentlevel*1000);
endfunction
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

death.src

Postby htfy on Sun Jul 06, 2003 10:21 am

Code: Select all
use uo;
use cfgfile;
use util;
use os;


include "include/experience";
include "include/client";
include "include/objtype";
include "include/utility";
include "include/wodinc";
include "include/npcbackpacks";
include "include/math";
include "include/string";
include "include/spawn";
include "../pkg/combat/loot/loot";
include "../pkg/npcs/npcinfo";
include "../pkg/npcs/npc_util";
include "../pkg/character/virtue/virtue";

program npcdeath (corpse)
   var npctemplate := TrimTemplate (GetObjProperty (corpse, "npctemplate"));
   var NPCTemplateElem := GetNpcTemplateElem (npctemplate);

   set_critical(1);
   if (GetObjProperty (corpse, "regspawn"))
      var SpawnName := GetObjProperty (corpse, "regspawn");
      var numspawns := CINT (GetGlobalProperty (SpawnName));
      if (numspawns and numspawns > 1 )
         numspawns := numspawns - 1;
         SetGlobalProperty (SpawnName, numspawns);
      else
         EraseGlobalProperty (SpawnName);
      endif
   elseif (!GetObjProperty (corpse, "guardkill"))
      AddToSpawner (corpse, npctemplate);
   endif
   set_critical(0);

   if (NPCTemplateElem.DeathSound)
      PlaySoundEffect (corpse, NPCTemplateElem.DeathSound);
   endif

   if (GetObjProperty (corpse, "color"))
      corpse.color := GetObjProperty (corpse, "color");
   endif

   MoveBackpackToCorpse (corpse);
   ZapStorageAreas (corpse);

   if ( GetObjProperty (corpse, "guardkill") )
      DestroyItem (corpse);
      return;
   endif

   if (GetObjProperty (corpse, "totem"))
      RemakeTotem (corpse, npctemplate);
      return;
   endif

   //if the NPC was riding a horse, make a new one
   var horse := Dismount (corpse, 0);
   if (horse)
      if (npctemplate["doppelganger"])
         sleep(2);
         var new_doppelganger := SpawnNPCAtLocation ("doppelganger", horse.x, horse.y, horse.z);
         set_critical (1);
         SetObjProperty (new_doppelganger, "#nextmorph", ReadGameClock() + cint(RandomInt(20)+15) );
         new_doppelganger.graphic := horse.graphic;
         new_doppelganger.name := horse.name;
         SetVital (new_doppelganger, "Life", 5000);

         var newbackpack := CreateItemAtLocation (5288 , 1176 , 0, UOBJ_BACKPACK, 1);
         if (!EquipItem (new_doppelganger, newbackpack))
            DestroyItem (newbackpack);
         endif

         foreach item in ListRootItemsInContainer (corpse)
            MoveItemToContainer (item, new_doppelganger.backpack);
         endforeach
         
         KillNPC (horse);
         set_critical (0);

         sleep (2);
         DestroyItem (corpse);
      else
         SetObjProperty (horse, "killme", 1);
      endif
   endif

   var nocorpse := HasNoCorpse (npctemplate);
   if( GetObjProperty (corpse, "summoned") )
      nocorpse := 1;
   else
      if (GetObjProperty (corpse, "master"))
         CheckNPCMurderCount (corpse);
      else
         AwardVirtue (corpse, npctemplate);
         AwardExperienceForDeath (corpse, npctemplate);
         if (GetObjProperty (corpse, "override_lootgroup"))
            if (GetObjProperty (corpse, "override_lootgroup") != "none")
               MakeLootOnCorpse (corpse, GetObjProperty (corpse, "override_lootgroup"));
            endif
         else
            MakeLootOnCorpse (corpse , npctemplate);
         endif
      endif
   endif

   if (npctemplate == "giantslime")
      for i := 1 to 5
         var tries := 0;
         var slime := 0;
         while (!slime and tries < 10)
            var randomx := RandomInt (5) - 2;
            var randomy := RandomInt (5) - 2;
            slime := SpawnNPCAtLocation ("slime", corpse.x + randomx, corpse.y + randomy, corpse.z, 0);
            tries := tries + 1;
         endwhile
      endfor
      nocorpse := 1;
   elseif (npctemplate == "greatervoiddragon")
      for i := 1 to 3
         var tries := 0;
         var slime := 0;
         while (!slime and tries < 10)
            var randomx := RandomInt (5) - 2;
            var randomy := RandomInt (5) - 2;
            slime := SpawnNPCAtLocation ("voidspawn", corpse.x + randomx, corpse.y + randomy, corpse.z, 0);
            tries := tries + 1;
         endwhile
      endfor
      nocorpse := 1;
   elseif (npctemplate["necromancer"] and RandomInt (8) == 0)
      var lich := SpawnNPCAtLocation ("lich", corpse.x, corpse.y, corpse.z, 0);
      if (lich)
         PrintTextAbove (lich, "In death, I grow only stronger!");
         if (GetObjProperty (corpse, "deliverto"))
            SetObjProperty (lich, "deliverto", GetObjProperty (corpse, "deliverto"));
            SetObjProperty (lich, "delivertoname", GetObjProperty (corpse, "delivertoname"));
         endif
         nocorpse := 1;
      endif
   elseif (npctemplate["doppelganger"])
      corpse.name := "A corpse of a doppelganger";
   elseif (npctemplate == "orcbomber")
      sleep (1);
      PrintTextAbove (corpse, "5");
      sleep (1);
      PrintTextAbove (corpse, "4");
      sleep (1);
      PrintTextAbove (corpse, "3");
      sleep (1);
      PrintTextAbove (corpse, "2");
      sleep (1);
      PrintTextAbove (corpse, "1");
      sleep (1);
      foreach critter in ListMobilesNearLocationEx (corpse.x, corpse.y, corpse.z, 5, LISTEX_FLAG_NORMAL + LISTEX_FLAG_HIDDEN );
         PlaySoundEffectPrivate (critter, 0x208, critter);
         PlayObjectCenteredEffect (critter, 0x36b0, 7, 0x10);
         if (!critter.npctemplate or GetObjProperty (critter, "master"))
            DoDamageByType (0, critter, RandomDiceRoll ("4d8+8"), DAMAGETYPE_PHYSICAL);
         else
            DoDamageByType (0, critter, RandomDiceRoll ("2d10+10"), DAMAGETYPE_PHYSICAL);
         endif
      endforeach
      nocorpse := 1;
   endif

   if (nocorpse)
      foreach item in ListRootItemsInContainer (corpse);
         MoveItemToLocation ( item , corpse.x , corpse.y, corpse.z, MOVEITEM_FORCELOCATION );
      endforeach
      DestroyItem (corpse);
   endif

   if ( getobjproperty (corpse, "diseased") )
      foreach mob in listmobilesnearlocation (corpse.x, corpse.y, corpse.z, 10)
         if ( (mob.script == "barker") or (mob.script == "animal") or
            (mob.script == "wolf") or (mob.script == "sheep") or (mob.script == "dumbkillpcs") )
            mob.name := "a diseased " + TruncateArticle(mob.name);
            setobjproperty (mob, "diseased", 1);
            RestartScript (mob);
         endif
      endforeach
   endif

endprogram




///////////////////
//  awards virtue for everyone that helped kill this NPC
///////////////////

function AwardVirtue(corpse, npctemplate)

   var hitlist := GetObjProperty (corpse, "#hitlist");
   if (!hitlist)
      return;
   endif

   var npccfg := ReadConfigFile (":*:npcdesc");
   var virtue := cint(npccfg[npctemplate].virtue);
   var hostile := cint(npccfg[npctemplate].hostile);

   if (npccfg[npctemplate].alignment == "good")
      virtue := -5;
   elseif (npccfg[npctemplate].alignment == "evil")
      if (!virtue)
         virtue := 1;
      endif
   elseif (!hostile)
      return;
   endif

   foreach person in hitlist
      var you := SystemFindObjectBySerial (person);
      if (you)
         if (virtue)
            AddVirtue (you, virtue);
         elseif (hostile and abs (GetVirtueAmount (you)) < 200)
            AddVirtue (you, 1);
         endif
      endif
   endforeach

   
endfunction


///////////////////
// EXP
//////////////////

function AwardExperienceForDeath (corpse, npctemplate)

   var hitlist := GetObjProperty (corpse, "hitlist");
   if (!hitlist)
      return;
   endif

   var npccfg := ReadConfigFile (":*:npcdesc");
   var experience := cint(npccfg[npctemplate].DeathExperience);
   if (experience)
   foreach person in hitlist
   var you := SystemFindObjectBySerial (person);
   if (you)
   AwardExperience (you, experience);
   endif
   endforeach
      endif
      endfunction


///////////////////
//  if whatever died was a totem, this function (sometimes) makes another totem that can be repaired
///////////////////

function RemakeTotem (corpse, npctemplate)
   PlaySoundEffect (corpse, SFX_SPELL_DISPEL);
   PlayStationaryEffect (corpse.x, corpse.y, corpse.z, FX_SMOKE, 0xA, 0xA );
   EraseObjProperty (corpse, "totemdeaths");

   var totemtype := GetObjProperty (corpse, "totem");
   var totemcolor := GetObjProperty (corpse, "totemcolor");
   var color := GetObjProperty (corpse, "color");

   set_critical (1);
   var totem := CreateItemAtLocation (corpse.x, corpse.y, corpse.z, totemtype, 1);
   if (!totem)
      foreach item in ListRootItemsInContainer (corpse)
         MoveItemToLocation (item, corpse.x, corpse.y, corpse.z, MOVEITEM_FORCELOCATION );
      endforeach
      DestroyItem (corpse);
      return;
      set_critical (0);
   endif

   var temp_string := corpse.desc;
   temp_string["A corpse of "] := "";
   totem.name := temp_string;

   totem.decayat := 0;
   totem.movable := 1;
   totem.usescript := ":dundee:totem";

   if (totemcolor)
      totem.color := totemcolor;
   endif
   if (color)
      SetObjProperty (totem, "critcolor", color);
   endif
   SetObjProperty (totem, "critgraphic", corpse.graphic);

   SetObjProperty (totem, "critter", npctemplate);
   SetObjProperty (totem, "totemhp", 170);
   SetObjProperty (totem, "broken", RandomInt (20) + 20);

   if (GetObjProperty (corpse, "ownerserial"))
      SetObjProperty (totem, "ownerserial", GetObjProperty (corpse, "ownerserial"));
      SetObjProperty (totem, "ownername", GetObjProperty (corpse, "ownername"));
      SetObjProperty (totem, "oldname", GetObjProperty (corpse, "oldname"));
   endif

   foreach item in ListRootItemsInContainer (corpse)
      MoveItemToLocation (item, corpse.x, corpse.y, corpse.z, MOVEITEM_FORCELOCATION );
   endforeach
   DestroyItem (corpse);
   set_critical (0);

endfunction




///////////////////
//  destroys all storage areas associated with the NPC
///////////////////

function ZapStorageAreas (corpse)

   var corpseserial := GetObjProperty (corpse, "serial");
   if (!corpseserial)
      return;
   endif

   var storage := FindStorageArea ("Merchant Storage");
   var npctemplate := TrimTemplate (GetObjProperty (corpse, "npctemplate"));

   if (npctemplate["playervendor"])
      var ownerserial := CINT (GetObjProperty (corpse, "master"));
      if (ownerserial)
         var bankbox := FindBankBox ("deadmerchants");
         var newpack := CreateItemInContainer (bankbox, UOBJ_BACKPACK, 1);

         var itembox := find_or_create_item( storage, corpseserial + " FS", 0xE7C );
         foreach item in ListRootItemsInContainer (itembox)
            MoveItemToContainer (item, newpack);
         endforeach
         itembox := find_or_create_item( storage, corpseserial + " PB", 0xE7C );
         foreach item in ListRootItemsInContainer (itembox)
            MoveItemToContainer (item, newpack);
         endforeach
         itembox := find_or_create_item( storage, corpseserial + " 1C", 0xE7C );
         foreach item in ListRootItemsInContainer (itembox)
            MoveItemToContainer (item, newpack);
         endforeach
         foreach item in ListRootItemsInContainer (corpse)
            if (!GetObjProperty (item, "mine"))
               MoveItemToContainer (item, newpack);
            endif
         endforeach
         var gold := CINT (GetObjProperty (corpse, "g"));
         while (gold > 60000)
            CreateItemInContainer (newpack, "goldcoin", 60000);
            gold := gold - 60000;
         endwhile
         CreateItemInContainer (newpack, "goldcoin", gold);
         if (!len (EnumerateItemsInContainer (newpack) ) )
            DestroyItem (newpack);
         endif
      endif
   endif

   DestroyRootItemInStorageArea (storage, corpseserial + " FS");
   DestroyRootItemInStorageArea (storage, corpseserial + " PB");
   DestroyRootItemInStorageArea (storage, corpseserial + " 1C");

   storage := FindStorageArea ("Tamed Storage");
   DestroyRootItemInStorageArea (storage, "Bankbox  " + hex(corpseserial));

endfunction




///////////////////
//  this function makes merchants and other similar NPCs respawn
///////////////////

function AddToSpawner (corpse, npctemplate)
   var homepoint := GetObjProperty (corpse, "myhome");
   if (!homepoint)
      return;
   endif

   set_critical (1);
   homepoint[4] := npctemplate;
   var merchants_to_respawn := { };
   if (GetGlobalProperty ("respawnmerchants"))
      merchants_to_respawn := GetGlobalProperty ("respawnmerchants");
   endif

   merchants_to_respawn.append (homepoint);
   SetGlobalProperty ("respawnmerchants", merchants_to_respawn);
   set_critical(0);
endfunction




///////////////////
//  Records a log of henchmen killed by players
///////////////////

function CheckNPCMurderCount (corpse)
   if (!getobjproperty (corpse, "#hitlist"))
      return;
   endif
   if (!getobjproperty (corpse, "master"))
      return;
   endif
   
   var masterserial := getobjproperty (corpse, "master");
   var master := SystemFindObjectBySerial (masterserial, SYSFIND_SEARCH_OFFLINE_MOBILES );
   if (!master)
      return;
   endif

   var hitlist := GetObjProperty (corpse, "#hitlist");
   var thelog := {};
   var prop := struct;
   prop.+pname := "Attacker:";
   prop.+pvalue := "";
   foreach plrserial in hitlist
      var plr := SystemFindObjectBySerial (plrserial, SYSFIND_SEARCH_OFFLINE_MOBILES);
      if (plr)
         prop.pvalue := plr.name + " (" + plr.acctname + ")";
         thelog.append (prop);
      endif
   endforeach
   
   var elemkey := corpse.desc + "(owner is " + master.name + ", acctname " + master.acctname + ")";
   AppendConfigFileElem (":drocket:henchmandeathlog", "HENCHMAN DEATH:", elemkey, thelog );
   UnloadConfigFile (":drocket:henchmandeathlog");   
endfunction
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

Forgot to tell you

Postby htfy on Mon Jul 07, 2003 4:37 am

I dont know if you just forget the " or if its really supposed to be like that, but I cant seem to find anything else thats wrong with the script.


SetObjProperty (character, "experiencelevel), currentlevel);

The "experiencelevel
does it need a close "?
I tried it both ways. Still nothing.
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

Postby Drocket on Tue Jul 08, 2003 7:06 am

It definitely should be a quotation mark instead of a parethesis. As I said, I really didn't test anything :)
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

Yepp, so why isnt it chomping it?

Postby htfy on Tue Jul 08, 2003 7:27 am

Thats the ONLY thing I could find that was wrong, but I still get those errors I posted and it doesnt compile.
Any clue as to whats up? :?:
I posted my EXP and DEATH scripts above.
If you can find anything worng, please post it.
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

Postby Drocket on Tue Jul 08, 2003 7:36 am

I think this should do it:

Code: Select all
   function AwardExperience (character, newxp)
newxp := CINT (newxp);
if (!character or !newxp)
return;
endif

set_critical (1);
var oldxp := GetObjProperty (character, "experience");
if (!oldxp)
oldxp := 0;
endif
var totalxp := oldxp + newxp;

var xpneeded := GetExperienceForNextLevel (character);
if (totalxp >= xpneeded)
//We're going to level up
var currentlevel := GetObjProperty (character, "experiencelevel");
currentlevel := currentlevel + 1;
SetObjProperty (character, "experiencelevel", currentlevel);
totalxp := totalxp - xpneeded;

SendSysMessage (character, "Welcome to level " + currentlevel + "!");
//Replaced this section here with the new code
AwardPointsForLevelUp (character);
endif


SetObjProperty (character, "experience", totalxp);
set_critical (0);

endfunction
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

I will try that right now.

Postby htfy on Tue Jul 08, 2003 7:45 am

Thanks a ton for the quick response. I'll see if it'l chomp this time.
P.S.
What are you still doing up? I have an excuse. Im addicted to UO and these boards :twisted:

Lol thanks again.
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

You thought this thread was long dead, but here it comes!!!!

Postby htfy on Tue Aug 26, 2003 9:16 pm

With the 095 upgrade the lvl system is not working. It compiles and everything looks fine. I have a monster that I assigned an exp value to. Whenever he is killed, it jsut says I have gained virtue. Ill post my death.src and exp.inc.
I have no idea how it would compile but do nothing...
htfy
Not a newbie anymore (but almost)
 
Posts: 49
Joined: Wed Jun 18, 2003 7:16 pm

Next

Return to Scripting Forum

Who is online

Users browsing this forum: No registered users and 1 guest

cron