Vordric
02-05-2017, 11:34 AM
Hello All,
I am very new to Ruby but have development experience. I am attempting to make a script that will allow my higher level characters automatically assist my lower level characters while hunting. The script would be passed a variable which would be the creature we are hunting, for example lesser mummy. This would then make my higher level character cast certain spells if we enter a room and that creature is in the room. The spell being cast would be different if there is only 1 of the creatures or multiple. I am in the early stages of creating this script and am struggling trying to filter out the NPCs. I realize that most of the time the NPC will only be the creature I am hunting but wanted to filter it just in case. This is what I have but it is not working:
npc = GameObj.npcs.find { |x| x.name == "lesser mummy" }
I believe this should work however, when I test it nothing is coming back in npc. Any thoughts or scripts I could learn from would be appreciated. Thank you.
I am very new to Ruby but have development experience. I am attempting to make a script that will allow my higher level characters automatically assist my lower level characters while hunting. The script would be passed a variable which would be the creature we are hunting, for example lesser mummy. This would then make my higher level character cast certain spells if we enter a room and that creature is in the room. The spell being cast would be different if there is only 1 of the creatures or multiple. I am in the early stages of creating this script and am struggling trying to filter out the NPCs. I realize that most of the time the NPC will only be the creature I am hunting but wanted to filter it just in case. This is what I have but it is not working:
npc = GameObj.npcs.find { |x| x.name == "lesser mummy" }
I believe this should work however, when I test it nothing is coming back in npc. Any thoughts or scripts I could learn from would be appreciated. Thank you.