I'd like to thank Kale as he was the only one who expressed any interest in actually helping.
In any case, I never did figure out how to get that damn handle, so I decided, fuck it, and just gave an NPC JP manipulation powers.
For the following, I'm gonna be as blunt as possible, if you can't get this to work, then maybe you shouldn't be messing with scripts at all. Moving on...
You need to add this to your favorite NPC's contact script
Code:
dlg_menu("[Insert menu item here]", "CreatureBuyJPMenu()")
And this is the actual function, it's probably crude as hell, but whatever, this is my first real foray with LUA.
Code:
--========================================================================
-- <<<<<< 4. Extra: Buy JPs for your pet with your own >>>>>>
--========================================================================
function CreatureBuyJPMenu()
local npc_id = get_npc_id()
if npc_id == 7001 then --I gave it to the HV Breeder, so that's what this is for
if is_premium() == false then
return false
end
dlg_title("@90700100")
end
dlg_text_without_quest_menu("[Insert witty dialog here]")
for i = 0, 5 do
handle = 0
handle = get_creature_handle( i )
if handle ~= 0 and handle ~= nil then
lv = get_creature_value( handle, "level" )
petJp=get_creature_value( handle, "jp" )
text = sconv("@90010009", "#@creature_name@#",tostring(get_creature_value( handle, "name" )) ,"#@creature_level@#",tostring(lv))
command = 'Creature_Buy_JPS( ' .. handle .. ' )'
dlg_menu( text, command )
end
end
dlg_menu( "[Insert no thanks option here]", "" )
end
function Creature_Buy_JPS( handle )
playerJPs = get_value("jp")
petJp= get_creature_value( handle, "jp" )
if playerJPs>=20000000 then --that is 20m JPs
set_creature_value(handle, "jp", petJp+1)
sv("jp", playerJPs-20000000)
else
dlg_title("@90700100")
dlg_text("[Insert GTFO response here]")
dlg_menu("[Insert player GTFO option here]", "")
dlg_show()
end
end
So, basically, it's a script that trades a character's JPs for one pet JP. I made it so 20m transform into 1, but up to you what value you wanna put in there. So there you go, no thanks to any one of you, it's working