Log in

View Full Version : Assistance: Target self to cast spell requiring self/group


AdrianD
10-12-2015, 06:40 AM
I'm writing a custom .lua script which, I hope, will summon a corpse using the necro spell, id = 3 (summon corpse). The only piece I seem to be missing is something which will force the client/player to target himself.

I've grep searched the quest folder and google but could not find/understand what I am looking for. I've tried a couple dozen different variations on things including depopping the quest npc. I think I am simply missing the command/function to target self.

Below is what I have so far with <location of target code> to indicate where I think it should belong.

-- global\a_dungeon_necromancer.lua NPCID

function event_say(e)
if(e.message:findi("hail")) then
e.self:Say("I know the reason you come to see me, " .. e.other:GetName() .. ". Don't be afraid, the living do not concern me... You require my [services], you must ask for them. Only the willing are allowed when living.");
elseif(e.message:findi("services")) then
e.self:Say("" .. e.other:GetName() .. ", to perform the necessary incantation, you must hand me one platinum, three gold, three silver and seven copper pieces.");
end
end

function event_trade(e)
local item_lib = require("items");
local leet_cash = 0;
if(item_lib.check_turn_in(e.trade, {platinum = 1, gold = 3, silver = 3, copper = 7})) then

leet_cash = 1;
end

if(leet_cash >= 1) then

-- <location of target code>

eq.SelfCast(3);
if(leet_cash == 1) then
e.self:Say("Believe me when I say this exact amount represents the services offered.");
leet_cash = 0;
end

end
item_lib.return_items(e.self, e.other, e.trade)
end


Thanks

provocating
10-12-2015, 11:59 AM
Are you just trying to have the script summon it's own corpse? Use the corpse summoner scripts that already exist.

AdrianD
10-12-2015, 03:09 PM
If you are referring to the scripts for Dragons of Norrath and the guild lobby, I've looked at them and they will no do what I want them to do. I want to summon a corpse with the same behavior as the NEC spell "summon corpse".

Everything appears to work except self targeting. Since the npc is targeted at the end of the script and the spell is self (player) cast, the text stating "Your target must be a group member for this spell." appears.

If anyone knows how to accomplish what I am trying to do, please share.

Thanks

AdrianD
10-15-2015, 02:56 AM
Resolved

$client->SetTarget($client);

That's all that was needed in the .pl file.

# global\a_dungeon_necromancer.pl NPCID


sub EVENT_SAY {
if ($text=~/hail/i) {
quest::say("I know the reason you come to see me, $name. Don't be afraid, the living do not concern me... You require my [services], you must ask for them. Only the willing are allowed when living.");
}
if ($text=~/services/i) {
quest::say("$name, to perform the necessary incantation, you must hand me one platinum, three gold, three silver and seven copper pieces.");

}
}

sub EVENT_ITEM {
if (plugin::takeCoin(1000)) {
quest::say("Believe me when I say this exact amount represents the services offered and becomes transmuted into the much larger pile of where, I only know. HAHA!");
$client->SetTarget($client);
quest::selfcast(3);
}
plugin::returnUnusedItems();
}

Thanks

Kingly_Krab
10-15-2015, 03:08 AM
Glad you got it worked it!

AdrianD
10-15-2015, 03:47 AM
Thank you sir! credit where it's due ^^^ KK

Kingly_Krab
10-15-2015, 03:53 AM
Haha, you're welcome. Feel free to message me if you need anymore assistance.