Alright so I know this might be terribly easy but I dunno hwo to get this to work…
So I got this system in my mod: https://neverwintervault.org/project/nwn1/script/craftable-natural-resources-cnr
With this system basically players can raise all the skills but I want to limit this to max of 3. Does anyone know how to limit this?
1 Like
so, couple of days later and still no solution for the problem. If anyone can help me out with this I would be ever so grateful! <3
For something like this, it depends on how sophisticated you wish to get.
The simplest way to limit things, knowing what I know about the CRP system, might be to limit a PC’s access to the area where a particular craft is conducted. I know, I know, that is super plain. But it could amount to only a few minutes of work to control access to the locations where the crafting is done.
Perhaps the ideal way to limit things is to write a customisation menu where a player selects which crafting skills they may use, and you would then store this variable information on a player data object - maybe even an actual item like a wood ax or a potion kit. Then, when executing the CRP script you would check for the presence of your variable. If it is absent, you might send a message to the PC saying they do not know this skill.
I hope this helps.
not realy but thanks anyway.
Basically if anyone can offer me an code sample to work from since my own attempts have been failing miserably, hence why I am asking here if the fine people could help me out. Since I have no idea how to work that out tbh.
Well, I have a thought, but I won’t be able to try it until later today.
the script is “cnr_recipe_utils”
Line 476
int CnrGetPlayerLevel(object oPC, string sDeviceTag)
{
int nPlayerLevel;
int nDeviceTradeskillType = GetLocalInt(GetModule(), sDeviceTag + "_TradeskillType");
//Here we see that whatever the player is doing is NOT a cnr tradeskill
if (nDeviceTradeskillType == CNR_TRADESKILL_NONE)
{
nPlayerLevel = GetHitDice(oPC);//So it uses the PC's HitDice for whatever it is they are doing
}
else//However, if it IS a CNR tradeskill, we use the CNR Tradeskill level based upon their crafting
{
int nXP = CnrGetTradeskillXPByType(oPC, nDeviceTradeskillType);
nPlayerLevel = CnrDetermineTradeskillLevel(nXP);
}
return nPlayerLevel;
}
So this I think returns the Player Tradeskill level in a particular craft (especially the last few lines).
I think you could edit a cap into line 487
nPlayerLevel = CnrDetermineTradeskillLevel(nXP);
if(nPlayerLevel>=4) nPlayerLevel = 3;
But I would check this to see if it works in all cases. It has been a long time since I messed with cnr and that was only to add additional skills, not mess with the internal processes.
Hmm, if I read this correctly this limits based upon the player level?
Basically cnr is fairly open and as of current you can level and practise all the crafting skills and I just want to limit that the player can choose a max of 3 from all the skills (granted there are 1 or 2 skills not being tracked)
So I am not entirely sure if this does that fromw hat I am reading it…
I misunderstood - you want to limit how many crafts a player can train in, not how much they can level in a particular craft. I will need to peek at it again - I don’t recall if the player needs to train to advance in a craft or not. If so, there may be a way to stop them training if they have trained in three crafts already…
If not - eek
I went back and edited the bit I posted above to comment about what the function is doing - the first section finds that what ever the player is doing is NOT a CNR tradeskill, so it returns the PC level. However, the second section is for when CNR tradeskills are being used, and here it returns the CNR tradeskill level based upon the crafting of the player
Now that I understand what we are looking for Pliny_the_Elder hit upon the solution. In my mods where I use CNR, I put the crafting devices in specialized guilds the PC had to belong to. If you didnt belong to the smithing guild, you didn’t have access to the smithy. I use the Journal and quests (UQS) to track my guilds and run the conversations. There should be a way to also track how many of these guilds the PC has joined and not allow them access to another guild after a certain number. These would not be CNR based but Quest and variables. Maybe that would work for you?
1 Like
I used CNR before on a previous project (eons ago) where a friend of mine limited via variables I think.
Having the skillbook check if the player has chosen (or in that case purchased) a max of 3 skills and will store it onto the item so that the player can from that point on only advance in those 3 skills. So since I really liked that I wanted to see if anyone could help me get something similar to this.
Limiting player access to the crafting area, dunno really. Currently all crafting are in their appropriate shop with also a merchant that buys raw materials from them for an extra way for players to make a quick buck
Set this on the module object?
CnrTradeskillCount - int - 3 or whatever number you want
I think I’ve reached the limits of my current knowledge of cnr. I stopped messing with it maybe 7 or 8 years ago.