summaryrefslogtreecommitdiff
path: root/world/map/npc/functions/hug.txt
blob: a663ea1d091b9c64ca54ec7d2e0e62958af8bc1e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-|script|nonmagic-hug|32767
{
    explode .@name$[0], @args$, "*"; // strip the trailing *
    set @target_id, if_then_else(.@name$[0], getcharid(3, .@name$[0]), BL_ID);
    if (@target_id < 1 || !(isloggedin(@target_id))) set @target_id, BL_ID; // fallback to self
    if (.@name$[0] == "Tree" || .@name$[0] == "tree") set @target_id, .tree_id;
    set .@range, 3;
    if (distance(BL_ID, @target_id) >= .@range) end;
    misceffect FX_HUG, strcharinfo(0);
    if (@target_id != BL_ID) misceffect FX_HUG, @target_id;
    if (@target_id != .tree_id) end;
    callfunc "QuestTreeTouch";
    close;

OnInit:
    set .tree_id, getnpcid("#DruidTree0#_M");
    registercmd "hug", strnpcinfo(0);
    registercmd "*hug", strnpcinfo(0);
    registercmd "*hug*", strnpcinfo(0);
    registercmd "hugs", strnpcinfo(0);
    registercmd "*hugs", strnpcinfo(0);
    registercmd "*hugs*", strnpcinfo(0);
    end;
}