PDA

View Full Version : Need just a tiny bit of help



nunye
10-19-2016, 09:53 PM
I'm working on understanding GameObj stuff, and I'm struggling with GameObj.loot a little.

An example would be this:

kitten = ["snow white kitten", "midnight black kitten"]

If GameObj.loot includes one of those kittens, I want to pick it up. That's all. I just want to pick it up. There may be times when both are present; in that case, the one I want to pick up would be based on character. If Char.name == 'Light' pick up snow white kitten, if Char.name == 'Dark' pick up midnight black kitten.

Can someone give me a little nudge?

Thanks!

Tillmen
10-20-2016, 12:43 AM
if Char.name == 'Light'
kitten = (GameObj.loot.find { |o| o.name == "snow white kitten" } || GameObj.loot.find { |o| o.name == "midnight black kitten" })
else
kitten = (GameObj.loot.find { |o| o.name == "midnight black kitten" } || GameObj.loot.find { |o| o.name == "snow white kitten" })
end
if kitten
fput "get ##{kitten.id}"
fput "throw ##{kitten.id}"
end

nunye
10-20-2016, 01:59 AM
You made me bash it's head in. Jerk.

(Thanks, just what I needed! I get it more now!)