skillbook

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

Moderators: Siobhan, Sebastian, Drocket

skillbook

Postby dw3rby on Wed Jun 02, 2004 6:43 pm

How would I go about making it so that the skill book has 4 primes, and 4 secondaries? I assume I would have to change the gumps (save me please), and the array in skills.inc. But other than that, and the fact that I have no idea how to do gumps, I'm lost. And I probably messed up with the skills.inc anyway, heh. Thanks ahead of time.
dw3rby
Sr. Newbie
 
Posts: 20
Joined: Mon Dec 01, 2003 3:42 am

Postby Drocket on Fri Jun 04, 2004 1:39 am

That would kind of be a mess, I think :P

As you said, you'd have to make changes to skills.inc, though those look like they'd mostly be pretty straightforward changes (just add 'primary4' and 'secondary4' to the checks for skillcap and LoadSpecialization.)

Gumps are pretty confusing to start with, but they're usually pretty straightforward once you get used to them. The few sections of the spec.src that you'd need to change:

Code: Select all
function LoadGumpLayout (character)
   gumplayout := array {
      "nodispose",
      "page 0",
      "gumppic 0 50 500",
      "page 1",
      "gumppic 0 50 500",
      "button 356 50 502 502 0 2",
      "text 50 60 1350 0",

      "text 55 90 0 1",
      "button 40 95 2104 2103 1 0 1",
      "text 55 120 0 2",
      "button 40 125 2104 2103 1 0 2",
      "text 55 150 0 3",
      "button 40 155 2104 2103 1 0 3",
      "text 55 180 0 4",
      "button 40 185 2104 2103 1 0 4",

      "text 235 60 1350 5",

      "text 245 90 0 6",
      "button 230 95 2104 2103 1 0 5",
      "text 245 120 0 7",
      "button 230 125 2104 2103 1 0 6",
      "text 245 150 0 8",
      "button 230 155 2104 2103 1 0 7",
      "text 245 180 0 9",
      "button 230 185 2104 2103 1 0 8",
      "text 35 215 0 10",
      "text 35 235 0 11",

      "button 250 235 2360 2360 1 0 9",         //save changes
      "text 270 230 37 14",

      "page 2",
      "gumppic 0 50 500",
      "button 0 50 501 501 0 1",

      "text 70 60 1350 12",

      "text 55 100 0 13",
      "button 40 105 2104 2103 1 0 9"
   };
   
   gumpdata := array {
      "Primary Skills",
      GetSkillName(specs[1])+" " + GetSkillValDisplay (character, specs[1]),
      GetSkillName(specs[2])+" " + GetSkillValDisplay (character, specs[2]),
      GetSkillName(specs[3])+" " + GetSkillValDisplay (character, specs[3]),
      GetSkillName(specs[4])+" " + GetSkillValDisplay (character, specs[4]),
      "Secondary Skills",
      GetSkillName(specs[5])+" " + GetSkillValDisplay (character, specs[5]),
      GetSkillName(specs[6])+" " + GetSkillValDisplay (character, specs[6]),
      GetSkillName(specs[7])+" " + GetSkillValDisplay (character, specs[7]),
      GetSkillName(specs[8])+" " + GetSkillValDisplay (character, specs[8]),
      "STR/DEX/INT Caps:",
      maxstr + " / " + maxdex + " / " + maxint,
      "Trade skill",
      GetSkillName(specs[9])+" "+ GetSkillValDisplay(character, specs[9]),
      "",
      "Save Changes"
   };
endfunction



Then in the ListSkills function:

Code: Select all
--- stuff ---

   elseif (gump_return == 9)                  //Save the changes to skills
      var nochanges := 1;
      for i := 1 to 9
         if (!specs[i] and specs[i] != 0)
            SendSysMessage (character, "You must select all specializations before saving.");
            return 0;
         elseif (specs[i] != originalspecs[i])
            nochanges := 0;         
         endif
      endfor
      
      if (nochanges)
         SendSysMessage (character, "You haven't made any changes!");
         return 0;
      endif
      
      SetObjProperty (character, "primary1", specs[1]);
      SetObjProperty (character, "primary2", specs[2]);
      SetObjProperty (character, "primary3", specs[3]);
      SetObjProperty (character, "primary4", specs[4]);
      SetObjProperty (character, "secondary1", specs[5]);
      SetObjProperty (character, "secondary2", specs[6]);
      SetObjProperty (character, "secondary3", specs[7]);
      SetObjProperty (character, "secondary4", specs[8]);
      SetObjProperty (character, "tradeskill", specs[9]);
      SetMaxStats (character, 1);
      SendSysMessage (character, "Changes saved!");
      return 1;
   else                              //specialize in a skill
      var SkillNum := PickASkill (character);
      if (SkillNum or SkillNum == 0)
         var skillname := GetSkillName (skillnum);
         if (gump_return == 9)
             if (!IsTradeSkill (skillnum))
                SendSysMessage (character, "That is not a tradeskill!");
               return 0;
            endif
         endif
         
         for i := 1 to 9
            if (specs[i] == SkillNum)
               SendSysMessage (character, "You're already specialized in that!");
               return 0;
            endif
         endfor

         specs [gump_return] := skillnum;
         SetMaxStats (character, 0);
         SendSysMessage (character, "You specialize in " + skillname);
         return 0;
      else
         SendSysMessage (character, "Canceled");
         return 1;
      endif
   endif
endfunction



I'm sure you'd want to change how the maximum stats are calculated, but that's up to you how you want to do it.
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

Postby Drocket on Fri Jun 04, 2004 1:45 am

In skills.inc:

Code: Select all
function LoadSpecializations (character)
   if (!GetObjProperty (character, "primary1"))
      if (GetObjProperty (character, "primary1") != 0)
         return {};
      endif
   endif

   var myspecs := {};
   myspecs[1] := GetObjProperty (character, "primary1");
   myspecs[2] := GetObjProperty (character, "primary2");
   myspecs[3] := GetObjProperty (character, "primary3");
   myspecs[4] := GetObjProperty (character, "primary4");
   myspecs[5] := GetObjProperty (character, "secondary1");
   myspecs[6] := GetObjProperty (character, "secondary2");
   myspecs[7] := GetObjProperty (character, "secondary3");
   myspecs[8] := GetObjProperty (character, "secondary4");
   myspecs[9] := GetObjProperty (character, "tradeskill");

   return myspecs;
endfunction


Code: Select all
function CheckIfSpecialized (character, skillid)
   var myspecs := LoadSpecializations (character);
   for i := 1 to 9
      if (myspecs[i] == skillid)
         return i;
      endif
   endfor
   return 0;
endfunction


Code: Select all
function GetBaseSkillCap (byref me, skillid)
   if (!me.acctname)
      return 0;
   endif

   if (skillid == GetObjProperty (me, "primary1"))
      return 1000;
   elseif (skillid == GetObjProperty (me, "tradeskill"))
      return 1000;
   elseif (skillid == GetObjProperty (me, "primary2"))
      return 1000;
   elseif ( skillid == GetObjProperty (me, "primary3") )
      return 1000;
   elseif ( skillid == GetObjProperty (me, "primary4") )
      return 1000;
   elseif ( skillid == GetObjProperty (me, "secondary1") )
      return 800;
   elseif ( skillid == GetObjProperty (me, "secondary2") )
      return 800;
   elseif ( skillid == GetObjProperty (me, "secondary3") )
      return 800;
   elseif ( skillid == GetObjProperty (me, "secondary4") )
      return 800;
   else
      return 600;
   endif
endfunction
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

Postby Drocket on Fri Jun 04, 2004 1:46 am

Then in /pkg/character/advancement/practice:

Code: Select all
function PracticeSpecs (byref character)
   var specs := LoadSpecializations (character);
   for i := 1 to 4
      var skillid := specs[i];
      if (skillid or skillid == 0)
         AwardRawSkillPoints (character, skillid, 100);
      endif
   endfor
   for i := 5 to 9
      var skillid := specs[i];
      if (skillid or skillid == 0)
         AwardRawSkillPoints (character, skillid, 50);
      endif
   endfor
endfunction
Drocket
Site Admin
 
Posts: 820
Joined: Mon Oct 07, 2002 2:54 am

Postby dw3rby on Sat Jun 05, 2004 12:00 am

Thanks a million, D man!
dw3rby
Sr. Newbie
 
Posts: 20
Joined: Mon Dec 01, 2003 3:42 am

Postby dw3rby on Sat Jun 05, 2004 12:21 am

one small bug, the tradeskill button tries to save the changes, so you cant choose it, and therefore, cant save the changes, heh. I have looked at it, but can't see what I would have to change.
dw3rby
Sr. Newbie
 
Posts: 20
Joined: Mon Dec 01, 2003 3:42 am


Return to Scripting Forum

Who is online

Users browsing this forum: No registered users and 1 guest

cron