Please release me!
Japt, 16 11 bytes
¡V«´V+ÂX}'.
Test it online! Input number is 1-indexed.
Based on my JavaScript answer. This takes advantage of one of Japt's most helpful features: splitting one string on another before mapping each item, then joining on that string again after mapping.
Ungolfed and explanation
¡ V« ´ V+Â X}'.
Um@V&&!--V+~~X}'.
Implicit: U = input string, V = input number
Um@ }'. Split U at periods, then map each item X by this function:
V&& If V is 0, return V.
!--V+~~X Otherwise, decrement V and return X + !V (increments X iff V was 1).
'. Re-join the result with periods.
Implicit: output last expression
JavaScript (ES6), 44 42 40 37 bytes
Saved 3 bytes thanks to @Neil
x=>i=>x.replace(/\d+/g,n=>i&&+n+!--i)
Input number is 1-indexed.
Test snippet
f = x=>i=>x.replace(/\d+/g,n=>i&&+n+!--i)
console.log(f("1.0.3")(1))
console.log(f("1.2.3.4.5")(3))
console.log(f("10.0")(1))
console.log(f("1")(8))
Vim 20 25 bytes
I unfortunately realized that it didn't handle the case of updating the last number, so I had to add bytes. This is 1-indexed.
DJA.0@"t.qq2wcw0@qq@qx
TryItOnline
Unprintables:
DJA.^[0@"t.^Aqq2wcw0^[@qq@qx
This takes the arguments in reverse order, as separate lines:
3
1.2.3.4.5
Explanation:
DJ # Delete the input argument, and join lines
A.^[0 # Add a period to the end
@"t. # Move to the "Copy register"th period
^A # Increment the number under the cursor
qq @qq@q # Until an error
2w # Move the cursor forward to the next number
cw0^[ # Change the number to 0
x # Delete the last '.'