Afflicting script error

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Afflicting script error

Post by icesteruk »

well the aff1 and aff2 was just examples, I placed different 'affs' in each of them so it'll never do the same aff unless all of them have been done/not cured..

Thanks for the help

Delrayne
Posts: 159
Joined: Tue Jun 07, 2011 7:07 pm
Contact:

Re: Afflicting script error

Post by Delrayne »

What I did for a situation similar to this:
Code: [show] | [select all] lua
affs1 = affs1 or {"anorexia", "asthma", "slickness"}

function pickAfflictions()
--loop through affs 1 and check it against the target afflictions.
  for k, v in ipairs (affs1) do
    if (not table.contains(target.afflictions, k) then
      --insert the affliction in the table affToUse
      table.insert(affsToUse, k)
    end
  end
end

--Alias
^attack$
pickAfflictions()
send("attack1 envenomed with " .. affsToUse[1])
send("attack2 envenomed with " .. affsToUse[2])

That's all part psuedocode and part not, but it should get the point across.

icesteruk
Posts: 287
Joined: Sun Jan 20, 2013 9:16 pm

Re: Afflicting script error

Post by icesteruk »

looking at that code, I guess slickness/asthma and anorexia are venoms.. how do you tell it what venom is slickness? since I guess enveom with slickness, will be the wrong venom?

Delrayne
Posts: 159
Joined: Tue Jun 07, 2011 7:07 pm
Contact:

Re: Afflicting script error

Post by Delrayne »

if I afflict my target with an aff, I add the venom name instead of the affliction name to make tracking easier. Though I suppose you could just add in another for loop to check what venom gives that aff. Was just easier for me to use the venom names rather than the aff names.

Post Reply