I've made script which use heavy crossbow, load time depends on DEX (in journal information is line:
weapon load time: 8943ms
So, I'm looking for this line, get it and use time in ms for wait before next action I do... My problem is that when i'm using this scripot from hide I've never success ... Output is similar but in journal added one line:
weapon load time: 8943ms
Only daggers cab be used...
So look at my script and try point me...
Code: Select all
sub hxb()
;define variables weaponms and pause are reset later in script
var steps = 10
var weaponms = 8000
var pause = 0
var text = ""
var hodnota = 0
;---do not edit bellow---
uo.deletejournal()
uo.exec('terminate stealth')
;this action with heavy crossbow in hand produce line:
;weapon load time: xxxxms
;in hide mode produces 2 lines and in this mode doesn't work
;weapon load time: xxxxms
;Only daggers can be used....
uo.attack("lastattack")
while NOT UO.InJournal("weapon load time")
wait(50)
wend
if UO.InJournal("weapon load time") then
;get value of loading weapon
weaponms = val( mid( uo.journal ( uo.InJournal(0)) ,18,4 ))
;I want shoot from hide mode so minus 250ms is needed for unhide for ex. say shooting ....
weaponms = weaponms - 250
pause = weaponms/steps
; uo.print(STR(weaponms))
; uo.print(val(weaponms))
endif
;arm heavy crossbow and finally attack last, now we know weapon load time
uo.arm("3")
uo.attack("lastattack")
;to xx steps before shoot - good for showing how much time i have before shooting
for var i=1 to steps
wait(pause)
weaponms=weaponms-pause
uo.print("------------------" +STR(weaponms)+ "###" +STR(steps-i) )
next
;needed for unhide and shoot
uo.serverprint("BOOM")
uo.serverprint(".warmode off")
end sub