Page 1 of 1

Heal Party

Posted: Mon Apr 23, 2012 8:32 pm
by LordGarth
Is there a heal party method that can be put onto a staff and just a spell.

Thx,

LordGarth

Re: Heal Party

Posted: Mon Apr 23, 2012 9:40 pm
by Sophia
Not included, but it shouldn't be a whole lot of trouble to create what you want using method_heal as a reference.

Re: Heal Party

Posted: Mon Apr 23, 2012 10:19 pm
by LordGarth
I was looking at that method but I dont know exactly what must be changed or added.

LordGarth

Re: Heal Party

Posted: Mon Apr 23, 2012 10:30 pm
by Sophia
It depends on how you want the party healing to work.

If you just want to heal all the party members instead of just one, it's probably enough to add another loop and iterate over all four party positions.
Right now, the healing loop is repeated 30 times. Where the new loop goes and how you break out of it etc. depends on whether you want there to be 30 "healing steps" for each party member, or if the 30 steps should be divided among all of them, or whatever.

Re: Heal Party

Posted: Mon Apr 23, 2012 10:36 pm
by LordGarth
I guess whatever it does now for each party member

Re: Heal Party

Posted: Mon Apr 23, 2012 10:47 pm
by LordGarth
Another thing

Do you have any idea why DSB would not like some sound files. The code is correct but it does not like the file for some reason. So I delete the file, keep the same code, download the new file and call it the same thing and it works.

I have a sound file called howling1 and it would not play it and then I download a new howl sound. Named it howling1 and DSB played it.

?

LordGarth

Re: Heal Party

Posted: Mon Apr 23, 2012 10:50 pm
by Gambit37
Lord Garth, don't ask unrelated questions in the same thread. You already started a thread about music and sounds, please use that one to continue asking questions about sounds.

Re: Heal Party

Posted: Tue Apr 24, 2012 2:33 am
by Sophia
Well, to be fair, that one got kind of derailed with a discussion about modifying DSB's base code and distributing said modifications.
But anyway, it doesn't like some files because FMOD (the sound library DSB uses) can't load them. They're usually weirdly formatted or something-- it chokes on some OGG files, too. Sorry but there isn't really anything I can do.

Re: Heal Party

Posted: Wed Apr 25, 2012 6:43 pm
by Mon Ful Ir
I haven't tested this, just written it out in the text window. Would this work?

Code: Select all

function method_heal_party
     for foo = 1 to 4
     method_heal(name, foo, who, what)	
     next foo
return
end

Re: Heal Party

Posted: Wed Apr 25, 2012 7:12 pm
by Sophia
No, it won't.
Party positions go from 0 to 3, and you'd need to make sure that who was properly generated based on the ppos.

However, it has a larger conceptual problem. method_heal burns mana from its invoker and heals its invoker. So, this function would burn mana from all four party members to heal all four party members. On the upside, it will give experience to everyone. In other words, method_heal is doing a lot more than just healing, so it's not quite so simple.

Re: Heal Party

Posted: Wed Apr 25, 2012 10:36 pm
by Mon Ful Ir
Yup: that's a substantial conceptual problem. :)

I suppose I'd have to try copy/pasting method_heal and tweaking it. The original function used who, but if I change some of those to foo, then I get:-

Code: Select all

function method_heal_party(name, ppos, who, what)	
	local m = lookup_method_info(name, what)
	if (not m) then return end
	
	att_idle(ppos, m.idleness)
	burn_stamina(who, m.stamina_used)

for foo = 0 to 3
	local hp = dsb_get_bar(foo, HEALTH)
	local needed_hp = dsb_get_maxbar(foo, HEALTH) - hp
	if (needed_hp > 0) then
		local mana = dsb_get_bar(who, MANA)
		if (mana > 0) then
			local healinc = (determine_xp_level(who, m.xp_class, m.xp_sub) + 1) * 10
			if (healinc > 100) then healinc = 100 end
			for i=0,29 do
				hp = hp + healinc
				needed_hp = needed_hp - healinc
				mana = mana - m.mana_used
				if (needed_hp < healinc) then healinc = needed_hp end
				xp_up(who, m.xp_class, m.xp_sub, m.xp_get)
				if (mana <= 0 or needed_hp <= 0) then break end 
			end			
			if (mana < 0) then dsb_set_bar(who, MANA, 0)
			else dsb_set_bar(who, MANA, mana) end			
			dsb_set_bar(foo, HEALTH, hp)
		else
			return
		end
	else
		return
	end
next foo
		
	if (m.charge) then 
		use_charge(what, m.charge)
	end
end	
Again, it's untested code, I'm just wondering if I'm going about it right.

Re: Heal Party

Posted: Thu Apr 26, 2012 2:51 am
by Sophia
That's pretty close to what I'd do.

I should point out that you're iterating over party positions, but you have to convert that to actual character id numbers.
Some code like this will suffice:

Code: Select all

for fppos=0,3 do
   local foo = dsb_ppos_char(fppos)
   if (valid_and_alive(foo)) then
      -- code goes here
The only thing wrong there is that it heals party members in sequence, so if the healer runs out of mana after healing the first two, the second two get no healing at all. It might work better to move the loop over party positions 0 to 3 inside of the 0 to 29 loop. That would require more restructuring, of course-- which is the main reason I haven't bothered to write out the function. ;)
(Not that it's terribly hard, I'm just lazy)

Re: Heal Party

Posted: Mon Apr 30, 2012 10:05 am
by ian_scho
I got this coders joke! :o *

Code: Select all

dsb_set_bar(foo, HEALTH, hp)