[reg] Crafting Skill

Submit your code requests, and if you are good at coding come help others with their requests.
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

Has anyone managed to add crafting as a skill in the game yet?
Iv got mine to all work but there is no Crafting skill
cant we just theif the mining/fishing skill code and add Crafting as a new skill or has nobody managed to acomplish that yet?

i have a lot of ideas for crafting and mining/fishing/alchemy i would love to impliment

such as being able to become a Dye crafter (who can make robes and cloth armour and dyes)
or err, fletching for bows/special arrows..
or even increasing the normal manufacture max skill to 1000, removing any reference to % so it doesnt say 1000% and adding
things like merien armour or even hero items to it, at 1000 skill
(obviously it would need to take AGES to get to 1000 skill but it might be a sweet idea for those crafters out there..

Srry i went off on a tangent there, so yeh.. the Crafting Skill.. anyone done it? lol
Treax2
Loyal fan
Posts: 281
Joined: Fri Mar 04, 2005 5:05 pm
Location: Estonia
Contact:

Post by Treax2 »

i think no . but try to be the first one!
ADDKiD
<3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

Would be cool...
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

ok iv managed to let the HG server know that crafting is skill number 15

Code: Select all

	}	}	}
	if (iCount == 0 ) 
	{	iPurity = 20 + iDice(1,80);  	// Wares have random purity (20%..100%)
  bNeedLog = FALSE;
	}else 
	{	iPurity = iTot/iCount;
  iTot    = (iPurity*4)/5;
  iCount  = iPurity - iTot;
  iPurity = iTot + iDice(1,iCount);	// Jewel completion depends off Wares purity
  bNeedLog = TRUE;
	}
	if (iNeededContrib != 0) 
	{	iPurity = 0;      // Necks require contribution but no purity/completion
  bNeedLog = TRUE;
	}
	CalculateSSN_SkillIndex(iClientH, 15, 1);
and adding the name crafting to skill number 15 on client was no problem as u just add it to the configs and iv added it to the skill.cfg on hg server

now does anyone know where the client tells the server that u have just got 1% in a skill? or is that HG side?

its this and coding the skill requirements in the crafting source thats gonna be the problem for me im not entirely sure what does what..

and info greatly appreciated (remember crafting is basically copied alchemy code) so the basics will be the same

oh also in skill.cfg you have
skill = 0 Mining 1 1 6 0 0 0 0
skill = 1 Fishing 1 2 6 0 0 0 0
skill = 2 Farming 1 3 6 0 0 0 0

i set crafting to

skill = 15 Crafting 1 4 6 0 0 0 0

but i dont know what the 1 6, 2 6, 3 6, 4 6, relates to couldnt see anything in HG that reads that

pile ur ideas in here folks it cant be that hard we can do this.
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

update to what iv done :
added to client

Code: Select all

#define BDLBBOX_DOUBLE_CLICK_INVENTORY18	"You should learn Crafting skill to use this item." //XenX Crafting Skill

Code: Select all

	if (m_cSkillMastery[15] == 0) 
      {	AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY18, 10);//added by XenX for crafting skill "You should learn Crafting skill to use this item."
      }else
added

Code: Select all

Item  = 1108 CraftingManual               3 0 9 15 10 0 0 0 0 0 0 6 92 100 1 -1 0 0 0 0 0 -1 42 0

ok thats all that done, as far as the player is conserned there is now a crafting skill, and u need to buy the manual to get the skill to 10%
(i chose 10% because of

Code: Select all

crafting = 1 MagicNecklace(DF+15)  	657  1 356 1 354 1 311 1 311 1 -1  0         10  70
Skill limit for that starts at 10%

now all i need to do is edit this in server

Code: Select all

	if (iCount == 0 ) 
	{	iPurity = 20 + iDice(1,80);  	// Wares have random purity (20%..100%)
  bNeedLog = FALSE;
possibly to 20%-30% at 10 skill and going up to 90%-100% at 100% skill

im not sure how alchemy works but if you dont have enough skill to create the item does it just fail or what?
i think adding the skill limit to the item creation wud be difficuilt as you cant see what you can, or cannot create.
but then again i dont know how it works in alchemy so whatever happens in that should copy across..

see almost done.. not that hard.. lol

oh also need to add getting skill when u successfully create something, should be reasonably fast as the items are hard to come by, any ideas on that front?
1+12
Member
Posts: 173
Joined: Sat Feb 04, 2006 5:05 pm

Post by 1+12 »

xenx wrote: update to what iv done :
added to client

Code: Select all

#define BDLBBOX_DOUBLE_CLICK_INVENTORY18	"You should learn Crafting skill to use this item." //XenX Crafting Skill

Code: Select all

	if (m_cSkillMastery[15] == 0) 
      {	AddEventList(BDLBBOX_DOUBLE_CLICK_INVENTORY18, 10);//added by XenX for crafting skill "You should learn Crafting skill to use this item."
      }else
added

Code: Select all

Item  = 1108 CraftingManual               3 0 9 15 10 0 0 0 0 0 0 6 92 100 1 -1 0 0 0 0 0 -1 42 0

ok thats all that done, as far as the player is conserned there is now a crafting skill, and u need to buy the manual to get the skill to 10%
(i chose 10% because of

Code: Select all

crafting = 1 MagicNecklace(DF+15)  	657  1 356 1 354 1 311 1 311 1 -1  0         10  70
Skill limit for that starts at 10%

now all i need to do is edit this in server

Code: Select all

	if (iCount == 0 ) 
	{	iPurity = 20 + iDice(1,80);  	// Wares have random purity (20%..100%)
  bNeedLog = FALSE;
possibly to 20%-30% at 10 skill and going up to 90%-100% at 100% skill

im not sure how alchemy works but if you dont have enough skill to create the item does it just fail or what?
i think adding the skill limit to the item creation wud be difficuilt as you cant see what you can, or cannot create.
but then again i dont know how it works in alchemy so whatever happens in that should copy across..

see almost done.. not that hard.. lol

oh also need to add getting skill when u successfully create something, should be reasonably fast as the items are hard to come by, any ideas on that front?
Nice stuff!!

Good luck working on it :)
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

another update
added

Code: Select all

	{	
  if (m_pClientList[iClientH]->m_cSkillMastery[15] < 50)//added by XenX 
  {iPurity = 20 + iDice(1,30); // Wares have random purity (20%..100%)
  }else //added by XenX
  iPurity = 20 + iDice(30,80);
  bNeedLog = FALSE;
	}else 
	{	iPurity = iTot/iCount;
  iTot    = (iPurity*4)/5;
  iCount  = iPurity - iTot;
  iPurity = iTot + iDice(1,iCount);	// Jewel completion depends off Wares purity
  bNeedLog = TRUE;
	}
	if (iNeededContrib != 0) 
	{	iPurity = 0;      // Necks require contribution but no purity/completion
  bNeedLog = TRUE;
	}
	
	if (strlen(cCraftingName) != 0) 
	{	pItem = NULL;
  pItem = new class CItem;
  if (pItem == NULL) return;
  for (i = 0; i < 6; i++)
  {	if (sItemIndex[i] != -1) 
  	{	if (m_pClientList[iClientH]->m_pItemList[sItemIndex[i]]->m_cItemType == DEF_ITEMTYPE_CONSUME)
    {	SetItemCount(iClientH, sItemIndex[i], 
      m_pClientList[iClientH]->m_pItemList[sItemIndex[i]]->m_dwCount - sItemNumber[i]);    	
    }else // So if item is not Type 5 (stackable items), you deplete item
    {	ItemDepleteHandler(iClientH, sItemIndex[i], FALSE, FALSE);
  }	}	}
  if (iNeededContrib !=0)
  {	m_pClientList[iClientH]->m_iContribution -= iNeededContrib;   
  	// No known msg to send info to client, so client will compute shown Contrib himself.  
  }

  SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_CRAFTING_SUCCESS, NULL, NULL, NULL, NULL);
  m_pClientList[iClientH]->m_cSkillMastery[15]++;//added by XenX to skill up crafting
  CalculateSSN_SkillIndex(iClientH, 15, 1); //xenx activated crafting skill //XenX changed to 15, 1( 15 = crafting skill)

  m_pClientList[iClientH]->m_iExpStock += iDice(2, 100);
ok i added a part to the idice for purity as a test so now if you have >50 skill you get >50% purity, below 50 skill u get below 50% purity

also added
m_pClientList[iClientH]->m_cSkillMastery[15]++;

to give you +1 skill when you successfully create an item,
obviously only as a test it will need more that just 1% skill everytime u create one,, but it works

however it does give u the +1 skill point to the newly created crafting skill but it doesnt update unless u log in /change map how do i get the client to update it after the +1 ?
i thought CalculateSSN_SkillIndex(iClientH, 15, 1);
would do the update, but it doesnt :(
just tried bCheckTotalSkillMasteryPoints(iClientH, 15);
that also doesnt, prolly has to be done client side ill try tomorrow i gotta sleep soon
bone-you
Spamtastic
Posts: 1310
Joined: Wed Mar 16, 2005 3:12 am

Post by bone-you »

DEF_NOTIFY_SKILL

NOTIFYMSG_SKILL1 "Skill %s: increased by %d%%."

SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_SKILL, sSkillIndex, m_pClientList[iClientH]->m_cSkillMastery[sSkillIndex], NULL, NULL);

CalculateSSN_SkillIndex

xD

bCheckTotalSkillMasteryPoints

yea. from the looks of those actions/functions it would appear that it should work.



also quest reward adds contribution. If you can find a way to sneak it in, that'd be how you could do it :P

m_pClientList[iClientH]->m_iContribution += m_pQuestConfigList[m_pClientList[iClientH]->m_iQuest]->m_iContribution;

SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_QUESTREWARD, 4, 1, m_pClientList[iClientH]->m_iQuestRewardAmount,
m_pItemConfigList[m_pClientList[iClientH]->m_iQuestRewardType]->m_cName, m_pClientList[iClientH]->m_iContribution);
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia :D</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_SKILL, sSkillIndex, m_pClientList[iClientH]->m_cSkillMastery[sSkillIndex], NULL, NULL);

how does this know which skill needs updating? or does it just update all of them and show DEF_NOTIFY_SKILL for whichever has increased?

also, im not sure what your talking about about the contrib points?
i know u need 10 contrib points to create the necklaces but whats that gotta do with the quests to get them? im confused lol
anyway thanks for that bit of code ill try that tomorrow night

gotta sleep now cya'z
bone-you
Spamtastic
Posts: 1310
Joined: Wed Mar 16, 2005 3:12 am

Post by bone-you »

xenx wrote: SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_SKILL, sSkillIndex, m_pClientList[iClientH]->m_cSkillMastery[sSkillIndex], NULL, NULL);

how does this know which skill needs updating? or does it just update all of them and show DEF_NOTIFY_SKILL for whichever has increased?

also, im not sure what your talking about about the contrib points?
i know u need 10 contrib points to create the necklaces but whats that gotta do with the quests to get them? im confused lol
anyway thanks for that bit of code ill try that tomorrow night

gotta sleep now cya'z
sSkillIndex defines which skill.

with the quests, I think you can remove contr too (-contr). Or find the hero armor retrieval and see if you can jack some code from there that works.
<img src='http://www.helbreathx.net/sig/sig.jpeg' border='0' alt='user posted image' /><br><a href='http://mafia.cheats4us.org/index.php?x=231030' target='_blank'>#1 on Mafia :D</a><br><!--QuoteBegin-Slipknight+--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>QUOTE</b> (Slipknight)</td></tr><tr><td id='QUOTE'><!--QuoteEBegin-->100mb Internet, burstable too 10GB oc192<br>his speed can go up too 10gbs<br>...<br>Yes my car can have a top speed of 1000mph<!--QuoteEnd--></td></tr></table><div class='signature'><!--QuoteEEnd--><br>^^ I wonder where the retard went to.
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

i know im prolly pushing my luck here dude but im learning C++ from scratch here so would you mind explaining how sSkillIndex knows what skill we are talking about,
you say its that which defines the skill, but without it being
sSkillIndex[15] or something i dont see how O.o or does it just define whichever skill is mentioned in the function or what ?

or does it rely on CalculateSSN_SkillIndex(iClientH, 15, 1); being above it to find out which skill we are talking about?
i just wanna figure out how sSkillIndex knows that we are talking about skill number 15

its not imperitive that i learn that, i mean if it works it works, but i understand stuff a lot better if i know WHY something works :D

hmm what i dont understand is apparently the same as what C++ doesnt understand lol
i get this error
warning C4700: local variable 'sSkillIndex' used without having been initialized

how do i initialize it ?

*edit 4* :P

ok after messing with that stupid sSkillIndex crap for ages i couldnt get it to work so i just took a wild (idontknowC++) guess again and did this

Code: Select all

SendNotifyMsg(NULL, iClientH, DEF_NOTIFY_SKILL, 15, m_pClientList[iClientH]->m_cSkillMastery[15], NULL, NULL);//added by XenX
so i just told it it was skill 15 instead of using sSkillIndex to do it, and it works perfect so i deleted all the attempts to define sSkillIndex and and the declair for it and just used that :P hope u dont mind but i couldnt get my head round that crap heh
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

(srry for replying to myself but this is the next stage so i want a new section)

Ok so!
Crafting skill now works 100% you get skill points when u successfully create something, u need to learn it like any other skill from a scroll!
sweetness...

so now the only thing left to do is add some skill limits and/or bonuses you get from being better in skill

im going to enhance the purity code i added so its a little more varied

im also going to change the way u get skill points so its 1 skill point for every successfull craft up till around 30% then a 50% chance of getting a point up to around 60% then a (30% chance)? up to 90% then a 15%? chance up to 100%

the risk level and the difficuilty i have just noticed is already coded in,
risk level being the SkillLimit in the config and difficuilty being Difficulty <<duh

Difficuilty is already coded in as chance of success so a difficuilty of 70 in the config is 70% chance of success from what i can see.

and risk level is % chance to loose an item if it fails so 10 is 10% chance to loose an item

the difficuilty seems a bit backwards to me i would have done it as 70 being 30% chance of success ie: higher = harder, but whatever

anyway i need a way to incorporate skill level into all this
can anyone think of an iDice i could roll along with skill level to add to the already calculated 70% chance of success and 10% chance to loose an item that wouldnt always come out with 100% chance of success and 0% chance to loose an item..lol

something like 0% at 10 skill up to 10% at 100 skill?

so u end up with 80% chance of success and 0% chance of loosing an item at 100% skill ?

did that make sence? lol hope so


xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

Crafting skill finished :)
ADDKiD
&lt;3 bd long time
Posts: 967
Joined: Tue Jul 12, 2005 8:07 pm
Location: Washington, USA
Contact:

Post by ADDKiD »

That's sick! I've been looking at that myself. I haven't found time to even look into Crafting. Been trying to get my computer cleaned up for my new gear I'm installing. Congratulations Xenx. =) Hard work proves itself to be worth it, right? (In some cases)...
xenx
Member
Posts: 169
Joined: Tue Oct 03, 2006 7:08 am

Post by xenx »

thanks man :) and yeh it was a bit of a mission hehe :P
Post Reply