Doesn't seem to work for me in 1.9.6... Looking at the script it may have a dependency on a console mod. Or something else may be interfering with it. Having the same problem w/ the waystone mod. No other issues, just no exp gain.
Nice mod! Btw, i saw some people wanted only player shots counted, so I added a simple ifelse to check it. The game even has a code for this, but it doesn't work properly
Only condition: if(g_localActor.id == hit.attackerId) then player.soul:AddSkillXP('weapon_bow', 1) end;
Full code with some modifications: function ShootingTarget.Client:OnHit(hit)
if(g_localActor.id == hit.attackerId) then
local vectorTemp=g_Vectors.temp; SubVectors(vectorTemp,self:GetPos(),hit.pos); local distance=LengthVector(vectorTemp); distance=((1-(distance*2))+0.08)*10; SubVectors(vectorTemp, player:GetPos(), self:GetPos()); local distancePlayerToTarget = LengthVector(vectorTemp); local experience = 0;
I installed the Original mod, and make your Change... dunno if its the Original Mod or your modifications... for me, there is no Target.... all Bow Targets stands, just empty. Only the Wooden stand is there.
Same as above. So I reverted the code and the targets came back. However, now they have no collision and my arrows just go right through them. Even after removing the mod altogether. No clue how, but this mod seems to have completely broken archery targets for me. Only the Neuhof targets still have collision, but they have a different model from the standing ones. And also they still gave no EXP either
Edit: I'm 99% certain the issue I'm having isn't related to the mod itself. I think my game is just broken and the archery targets themselves are non-functional as they work in earlier saves in my play-through, but in later saves, they have no collision. Even after removing all mods and uninstalling/reinstalling the game. Very unfortunate for me.
@uxt7 Did you ever manage to figure this out? My targets also have no collision, so now I can't do the archery contest for the wine or money. Luckily, I can just steal the wine, but I hope it doesn't mess up any future quests.
Gotta be a save issue though. Went back to a save just after getting to Rattay and it's not bugged there, so goodbye 20hrs of progress on my HC playthrough
Can confirm it works marvelously. I included the shooting-distance modifier from Dishschion's post below and it works perfectly as well.
The only way I can see this mod not working is if something else is modifying the script later in the load order. If you're having issues, try putting it as the last mod loading -- no guarantee it won't mess something else up but you can at least confirm this mod is working.
Disculpa por las molestias, parece que no me funciona el Mod lo instale por medio del Vortex y según el programa esta bien instalado lo reinstale y nada no veo que funcione e probado con diferentes distancias y quince tiros y nada.
installed into my mod folder, and doesnt seem to be working at the ledetchko targets. an update or clarification would be nice, I feel like shooting targets "SHOULD" give xp and improve archery since that is realistic.
Brilliant mod! Simple yet essential :) If someone want I created two modifications of this mod with distance check. Experience is rewarded only from distance of 10 in-game units or greater (distance from shooting targets to shooting position fence in Rattay). Distance 20 or greater doubles experience rewards.
Like original, only dead center counts (10 units distance = 1EXP, 20 units distance = 2EXP): function ShootingTarget.Client:OnHit(hit) local vectorTemp=g_Vectors.temp
SubVectors(vectorTemp, self:GetPos(), hit.pos) local distanceFromCenter = LengthVector(vectorTemp) local accuracy = ((1-(distanceFromCenter*2))+0.08)*10
SubVectors(vectorTemp, player:GetPos(), self:GetPos()) local distance = LengthVector(vectorTemp)
if (accuracy < 10.5) then return end
if (distance < 10) then return elseif (distance < 20) then player.soul:AddSkillXP('weapon_bow', 1) else player.soul:AddSkillXP('weapon_bow', 2) end
RPG.NotifyLevelXpGain('weapon_bow') end
Easier version where white area gives 1 EXP, black area 2 EXP and exact center 3EXP (doubled at distance greater than 20): function ShootingTarget.Client:OnHit(hit) local vectorTemp=g_Vectors.temp
SubVectors(vectorTemp, self:GetPos(), hit.pos) local distanceFromCenter = LengthVector(vectorTemp) local accuracy = ((1-(distanceFromCenter*2))+0.08)*10
SubVectors(vectorTemp, player:GetPos(), self:GetPos()) local distance = LengthVector(vectorTemp)
local experience = 0
if (accuracy > 10.5) then experience = 3 elseif (accuracy > 8.2) then experience = 2 elseif (accuracy > 4) then experience = 1 else return end
if (distance > 20) then experience = experience * 2 elseif (distance < 10) then return end
player.soul:AddSkillXP('weapon_bow', experience) RPG.NotifyLevelXpGain('weapon_bow') end
If you want different difficulty then change experience amount, accuracy and distance check accordingly:
(accuracy > 10.5) = dead center
(accuracy > 8.2) = whole black area
(accuracy > 4) = white area
(accuracy > 0) = outer ring
distance of 10 = distance from shooting targets to shooting fence in Rattay
I would upload these updated versions but don't want to steal CrEaToXx credit. CrEaToXx if you don't want to or don't have time I can upload these versions of mod myself with your permission :)
I also have modified versions both including different target size options (exact center or black area) as well as variations in XP gain you can pick (x1, x3, x5). I haven't heard back regarding permissions for posting.
Just found out how to do this myself so ill put my findings down below for those that are less comfortable programming or altering mods.
- download and install the mod as normal - open up the mod file and find the .pak file - rename that to a .zip file - open up its contents (after extracting it) and find the only .lua file inside - open the lua in notepad and copy the code for the version you want and use it to replace the function:function ShootingTarget.Client:OnHit(hit) - for those not computer savvy, the function means the line where it says function all the way down to the line that has "end" - it should be easily noticeable by looking at the indentation - once that function is replaced, save the file and go back to the top folder you extracted (Scripts) - zip that back up and have it match the name of the original zipped file we changed (should be STargetsGiveXP.zip) - id assume the naming isnt really required, just the file extension but i dont know all the working parts about KCD mods so best to play it safe - take that zip file that has been repackaged and change its extension back to a .pak file
This is way better than the original mod of only 1 xp and only for a perfect bullseye. To me that doesn't solve the problem of training archery at all. Thank you.
Furthermore, if you don't have any program installed for modifying the file extension of .pak to a .zip format and then back to .pak, there is a workaround:
1. Right-click on the .pak and try to "open with" the .zip app (such 7z), "just once". 2. Navigate to the .lua file and then click and drag the .lua to copy it somewhere else. 3. Open the .lua with Notepad, find and make the modifications as explained in the previous posts, then save it as-is. This should preserve the .lua file extension. 4. Drag the changed file BACK 7z to replace the old .lua in the zip path. It will ask you to overwrite, say yes. 5. Close 7z. The changes should be properly applied in the .pak file. Enjoy leveling at the archery ranges.
The archery targets now have no more colision. when i shoot against them, the arrows fly through the targets. in the archery competition, the npcs just stand there and no longer shoot at the targets.
48 comments
interfering with it. Having the same problem w/ the waystone mod. No other issues, just no exp gain.
Btw, i saw some people wanted only player shots counted, so I added a simple ifelse to check it. The game even has a code for this, but it doesn't work properly
Only condition:
if(g_localActor.id == hit.attackerId) then
player.soul:AddSkillXP('weapon_bow', 1)
end;
Full code with some modifications:
function ShootingTarget.Client:OnHit(hit)
if(g_localActor.id == hit.attackerId) then
local vectorTemp=g_Vectors.temp;
SubVectors(vectorTemp,self:GetPos(),hit.pos);
local distance=LengthVector(vectorTemp);
distance=((1-(distance*2))+0.08)*10;
SubVectors(vectorTemp, player:GetPos(), self:GetPos());
local distancePlayerToTarget = LengthVector(vectorTemp);
local experience = 0;
experience = distancePlayerToTarget*distance*0.03;
player.soul:AddSkillXP('weapon_bow', experience);
end;
end
Experience you get depend on distance to target and zones you shoot. More distance - more exp, high accuracy - also more exp
0.03 - exp multiplier, with this number you get about 3 exp for shot in the black area with distance 10 game unit
Also i deleted notifications, cause i tired of "ding" sound
Edit: I'm 99% certain the issue I'm having isn't related to the mod itself. I think my game is just broken and the archery targets themselves are non-functional as they work in earlier saves in my play-through, but in later saves, they have no collision. Even after removing all mods and uninstalling/reinstalling the game. Very unfortunate for me.
Did you ever manage to figure this out? My targets also have no collision, so now I can't do the archery contest for the wine or money. Luckily, I can just steal the wine, but I hope it doesn't mess up any future quests.
Gotta be a save issue though. Went back to a save just after getting to Rattay and it's not bugged there, so goodbye 20hrs of progress on my HC playthrough
The only way I can see this mod not working is if something else is modifying the script later in the load order. If you're having issues, try putting it as the last mod loading -- no guarantee it won't mess something else up but you can at least confirm this mod is working.
No se que hago mal
Like original, only dead center counts (10 units distance = 1EXP, 20 units distance = 2EXP):
function ShootingTarget.Client:OnHit(hit)
local vectorTemp=g_Vectors.temp
SubVectors(vectorTemp, self:GetPos(), hit.pos)
local distanceFromCenter = LengthVector(vectorTemp)
local accuracy = ((1-(distanceFromCenter*2))+0.08)*10
SubVectors(vectorTemp, player:GetPos(), self:GetPos())
local distance = LengthVector(vectorTemp)
if (accuracy < 10.5) then
return
end
if (distance < 10) then
return
elseif (distance < 20) then
player.soul:AddSkillXP('weapon_bow', 1)
else
player.soul:AddSkillXP('weapon_bow', 2)
end
RPG.NotifyLevelXpGain('weapon_bow')
end
Easier version where white area gives 1 EXP, black area 2 EXP and exact center 3EXP (doubled at distance greater than 20):
function ShootingTarget.Client:OnHit(hit)
local vectorTemp=g_Vectors.temp
SubVectors(vectorTemp, self:GetPos(), hit.pos)
local distanceFromCenter = LengthVector(vectorTemp)
local accuracy = ((1-(distanceFromCenter*2))+0.08)*10
SubVectors(vectorTemp, player:GetPos(), self:GetPos())
local distance = LengthVector(vectorTemp)
local experience = 0
if (accuracy > 10.5) then
experience = 3
elseif (accuracy > 8.2) then
experience = 2
elseif (accuracy > 4) then
experience = 1
else
return
end
if (distance > 20) then
experience = experience * 2
elseif (distance < 10) then
return
end
player.soul:AddSkillXP('weapon_bow', experience)
RPG.NotifyLevelXpGain('weapon_bow')
end
If you want different difficulty then change experience amount, accuracy and distance check accordingly:
I would upload these updated versions but don't want to steal CrEaToXx credit. CrEaToXx if you don't want to or don't have time I can upload these versions of mod myself with your permission :)
- download and install the mod as normal
- open up the mod file and find the .pak file - rename that to a .zip file
- open up its contents (after extracting it) and find the only .lua file inside
- open the lua in notepad and copy the code for the version you want and use it to replace the function:
function ShootingTarget.Client:OnHit(hit)
- for those not computer savvy, the function means the line where it says function all the way down to the line that has "end" - it should be easily noticeable by looking at the indentation- once that function is replaced, save the file and go back to the top folder you extracted (Scripts)
- zip that back up and have it match the name of the original zipped file we changed (should be STargetsGiveXP.zip) - id assume the naming isnt really required, just the file extension but i dont know all the working parts about KCD mods so best to play it safe
- take that zip file that has been repackaged and change its extension back to a .pak file
and voila! It should be working after that
1. Right-click on the .pak and try to "open with" the .zip app (such 7z), "just once".
2. Navigate to the .lua file and then click and drag the .lua to copy it somewhere else.
3. Open the .lua with Notepad, find and make the modifications as explained in the previous posts, then save it as-is. This should preserve the .lua file extension.
4. Drag the changed file BACK 7z to replace the old .lua in the zip path. It will ask you to overwrite, say yes.
5. Close 7z. The changes should be properly applied in the .pak file. Enjoy leveling at the archery ranges.