| Author |
Message |
|
deadlyp99
Forum Moderator
Joined: Oct 18th, '09, 03:27 Posts: 83
|
 Re: Party heal
Ok Macro Monkey uses Polling as apposed to event driven input. So basically a poll looks like: function poller() checkhp() lookformobs() --meats, potatoes, gravy, and so on end ReqBot does this in a more organized way, using included files, and conditional statements, but hopefully you get the point. Then with a timer you run that poll often, in the case of reqbot its 13 times a second I believe. To see the main poller, look at SoloMain.mms Now obviously you'd want your "party hp check" function to be within the scope of the poll, but more relevantly placed so it's not being checked when it doesn't need to be or shouldn't be. Polling is simpler in design then event driven, but It also makes the code a bit more organized and "centered". That's how I look at it. Granted your not going to catch everything going on at one given time (as if 13 times a second is slow), but we aren't aiming at fps botting either so the speed isn't that crucial :] So to answer your question, "after the return flag becomes true where does the code go?", after that function finishes it continues through the rest of the code and restarts the poll. So in a execution path illustration.... thing: function poller check function 1 function 1 returns check function 2 function 2 returns poll function returns restart poll function The poller itself is accomplished via a timer. Basically, "Call poller function ever 0.075 seconds". Reqbot has a timer, I've not looked too terribly much into it, I just kind of skimmed around following code.
|
| Nov 13th, '09, 08:21 |
|
 |
|
Sirmabus
Site Moderator
Joined: Aug 18th, '09, 03:32 Posts: 813
|
 Re: Party heal
Look in "RestAndBuff.mms" You'll see some heal skill stuff in there. And in "Skills.mms" The concept is to have little containers to manage skills/spells. Down to the basics it's just selecting a target (in the solo, only your self normally) and pressing a hotbar key limited by a timer. I use one of the, if not the most basic Lua class/object type setup. Mainly a single base table and a "metatable". In C++ it would be like basic class that can have member data and methods but no inheritance et al. There are a lot of ways to do this kind of thing in Lua. See here: http://lua-users.org/wiki/SampleCodeIn your setup function(s) you'll want to initialize healing skill containers something like this: Code: -- In the init/constructor function t.aHPSoloSkill = {} -- Optional solo targetable heal skills t.aHPPartySkill = {} -- Optional party heal skills
-- Fill in the slots --~ Setup heal skills -- Targetable/solo heal skills for ix = 1,cPartyHPSkills do self.aHPSoloSkill[ix] = cHealSkill:New(gtSettings.tPartyHealSkillHP[ix]) end -- -- Party heal skills for ix = 1,cPartyHPSkills do self.aHPPartySkill[ix] = cHealSkill:New(gtSettings.tPartyPartyHealSkillHP[ix]) end
You can use a party heal it's easy to just target your self and cast it. Use "cHealSkill:UseCheckTarget()" to do a target heal skill. A function to get a read on the whole party: Code: -- Return two tables of all party member's info -- 1) By member ID -- 2) By name local LastPartyReadTime_ = -math.huge local aLocalPartyMemberTable1_ = {} local aLocalPartyMemberTable2_ = {} -- function PartySys:ReadPartyInfo() if (time.Delta(LastPartyReadTime_) > 0.060) then
-- Iterate through party by ID local aPartyList = GetPartyList() if aPartyList then
-- Reset tables aLocalPartyMemberTable1_ = {} aLocalPartyMemberTable2_ = {}
for ix,MemberID in ipairs(aPartyList) do
-- Get member object info local tMemberInfo = Requiem.GetObjInfo(MemberID) if tMemberInfo then
-- Detect and set flag if the party member is out of range with limited info if ((tMemberInfo.Race == 0) or (tMemberInfo.Range > 90.0)) then tMemberInfo.OutOfRange = true end
-- By member ID aLocalPartyMemberTable1_[MemberID] = tMemberInfo -- By member name aLocalPartyMemberTable2_[tMemberInfo.Name] = tMemberInfo else print() printfc(console.BRIGHTYELLOW, console.RED, "** Bad party member read #%d for ID: 0x%X! ** \n", ix, MemberID) end end
elseif (self.bStartUp == true) then print() printfc(console.BRIGHTYELLOW, console.RED, "** Failed to read party ID list! ** \n") end
LastPartyReadTime_ = time.Get() end
return aLocalPartyMemberTable1_, aLocalPartyMemberTable2_ end
Then you can walk through the members and see if anyone needs healing and strategize on what kind of heal needs to be used, etc. Making a party bot is kind of complex. Complex as you want to make it with features and what not. Could just do something kind of simple. Like if you wanted to have a healer bot it could just follow your main character around and cast heals on it when your health gets below a level. Can be something that just keeps pressing the party heal skills over and over in a loop, etc.
|
| Nov 13th, '09, 21:18 |
|
 |
|
mikel
Joined: Feb 3rd, '10, 12:11 Posts: 32
|
 Re: Party heal
ok, just one finaly question, where do u advice to put the new 2 functions?, the one for scan the party and the one for heal, on CombatSolo.mms? or on SoloMain.mms?. i mean, for what i saw i can just modify combatsolo.mms and get the heal function, but if i just wan to heal and not attack ill have to comment all the other functions inside combatsolo.mms on the other hand if i add the heald function on SoloMain.mms i can just comment the calls for the CombatSolo functions and get a heal only bot, right?. or maybe inside the function that verify ur own hp and do the self heal, put the verify party function there and the party heal function there, so everytime the healer checks hes own HP, it will check the party HP and heal if needed. idk, what whould u recomend me?, i think the last option whould be the best, but im not the expert  Thanks. EDIT: maybe inside the function cHealSkill:UseCheckTarget, i can put the code after the self check, so it will verify the party hp everytime and heal if needed, what u think?, it will put to much delay on the self heal?. Thanks.
|
| Feb 11th, '10, 13:35 |
|
 |
|
Sirmabus
Site Moderator
Joined: Aug 18th, '09, 03:32 Posts: 813
|
 Re: Party heal
If you don't want combat at all you could just comment out the line: "gtCombatSolo:DoCombat()" in "SoloMain.mms". If you just want a healer bot, you could take out more things from "Main loop..". If you don't want the healer to loot, etc. With healing you want it in some place that gets called a lot. Maybe at the in or at the end of "RestBuffSys:CheckHeals()" in "RestAndBuff.mms". Since it gets called a lot to do healing on your self. Maybe start out small just playing with things. There is no real "debugger" for it unfortunately, but I find i don't really need one. I just use a lot of print statements to dump stuff out. For instance if you want to just see it working you could take that "ReadPartyInfo()" from above. Code: print("\n==== Party ====") local aPartyList = ReadPartyInfo() for _,tMember in pairs(aPartyList) do printf(" \"%s\" HP: %d/%d\n", tMember.Name, tMember.HP, tMember.MaxHP) end
That should dump out the party like this: Quote: ==== Party ==== "Avatar" 840/840 "Gandalf" 620/620
For testing things you do it on a key press. See around line #468 in "Core.mms' I use the key 'T' as a "test" key.
|
| Feb 11th, '10, 21:18 |
|
 |
|
Zugen
Joined: Oct 31st, '09, 10:52 Posts: 36
|
 Re: Party heal
еще бы по-русски расказали бы про что тут написано и что хотел Сир сказал))
|
| Feb 14th, '10, 13:28 |
|
 |
|
Molotok
Joined: Feb 19th, '10, 11:09 Posts: 4
|
 Re: Party heal
тоже интересует, кто разобрался как настроить хила, чтоб хилил того кто в пати, когда тот нуждается? Опишите плз (на русском)
|
| Mar 10th, '10, 02:43 |
|
 |
|
TemTriss
Forum Moderator
Joined: Sep 24th, '09, 22:51 Posts: 234
|
 Re: Party heal
а что описовать то? =) часть кода есть. токо вот сомневаюсь что ты сможеш дописать остальную часть.
|
| Mar 10th, '10, 03:43 |
|
 |
|
Who is online |
Users browsing this forum: Google [Bot] and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|