Aisha Posted August 16, 2017 Posted August 16, 2017 (edited) I am trying to have a "max hp" of mob and "current hp" of mob, does anyone have any idea how to get current hp of mob? I can only see getmonsterinfo but is not gonna work since it only look max hp **Fixed "title" to be more informative Edited August 16, 2017 by Aisha Quote
1 Technoken Posted August 16, 2017 Posted August 16, 2017 You can try to use setunitdata and getunitdata. monster "prontera",149,190,"Poring",1002,1; .GID = $@mobid[0]; getunitdata .GID,.@por_arr; unittalk .GID,"Max HP: "+.@por_arr[UMOB_MAXHP]; unittalk .GID,"Current HP: "+.@por_arr[UMOB_HP]; sleep 10000; // Try to do some damage after 10 seconds getunitdata .GID,.@por_arr; unittalk .GID,"Current HP: "+.@por_arr[UMOB_HP]; end; 1 Quote
0 Aisha Posted August 16, 2017 Author Posted August 16, 2017 Hi, can you tell me where you manage to get this variable? .GID = $@mobid[0]; Thank you for your reply. Quote
0 Technoken Posted August 16, 2017 Posted August 16, 2017 19 minutes ago, Aisha said: Hi, can you tell me where you manage to get this variable? .GID = $@mobid[0]; Thank you for your reply. Quote // - Keep in mind, when the 'monster' script command is used, // - all the spawned monster GID's are stored in an array // - called $@mobid[]. For more info you can check it here https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L7488-L7790 Quote
0 Aisha Posted August 16, 2017 Author Posted August 16, 2017 Thanks, this is good enough, thank you. I will share the script I make out of this in a form of showcase soon. As a follow up question. What is the most efficient way of checking mob HP. Would a timer suffice? Sleep perhaps? OnClock or something similar, or a do..while loop wherein the condition is if the mob is still alive? For instance, I only wish to check the hp of the monster every 30 minutes, would a do-while loop be better, or would an OnClock/OnTimer be better? Quote
0 Emistry Posted August 17, 2017 Posted August 17, 2017 18 hours ago, Aisha said: For instance, I only wish to check the hp of the monster every 30 minutes, would a do-while loop be better, or would an OnClock/OnTimer be better? OnTimer - if you want precision in interval time for checking.... OnClock are acceptable, but the interval time for checking aren't precise. Quote
0 Aisha Posted August 17, 2017 Author Posted August 17, 2017 I was hoping to save the HP information every 30 minutes or maybe every hour as long as the monster is alive. So I think it is best to have OnClock then? Because I am not sure as to how initnpctimer and stopnpcimer works, it say "pause" the time, so if I stop at one time, and resume at the other, it will resume at the previous timer correct, not back to 0 time? Quote
0 ToiletMaster Posted August 19, 2017 Posted August 19, 2017 On 8/17/2017 at 6:38 PM, Aisha said: I was hoping to save the HP information every 30 minutes or maybe every hour as long as the monster is alive. So I think it is best to have OnClock then? Because I am not sure as to how initnpctimer and stopnpcimer works, it say "pause" the time, so if I stop at one time, and resume at the other, it will resume at the previous timer correct, not back to 0 time? initnpctimer will set the timer back to 0 however if you stopnpctimer and then startnpctimer, it'll resume where it stopped Quote
0 Aisha Posted August 21, 2017 Author Posted August 21, 2017 Thanks, I found a more efficient way of doing it. Thanks for the reply. Quote
0 Moooooon-Aisha Posted September 9, 2017 Posted September 9, 2017 Trying this script. Somehow the mob is not registering the initial HP. setunitdata .gid,UMOB_MAXHP,.hp; I managed to make a previous script work, almost same as above using dynamic method, but the one above is not working properly dynamic method: (old script) for(set .@i,0;.@i < .monster_count; .@i++){ setarray .@GID[.@i],$@mobid[.@i]; setunitdata .@GID[.@i],UMOB_MAXHP,getd(".mob_hp"+.rand+"["+.round+"]"); } Quote
Question
Aisha
I am trying to have a "max hp" of mob and "current hp" of mob, does anyone have any idea how to get current hp of mob?
I can only see getmonsterinfo but is not gonna work since it only look max hp
**Fixed "title" to be more informative
Edited by Aisha9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.