Jump to content
  • 0

item Checker and Auto Kick


Pink Guy

Question


  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

I just want the script command/s that checks if you have a certain item and then @loads you if you don't have that item. For example, #7227.

I just want to include this to my upcoming script so if you can help, it would be a big help to me.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  43
  • Reputation:   15
  • Joined:  06/24/12
  • Last Seen:  

common npc header,{
set .@your_item_id, <here>;
set .@your_item_qt, <here>;
if(!countitem(.@your_item_id))
{
    getitem .@your_item_id, .@your_item_qt;
}
end;
}
 

This will work, but if the player stores the item, it can get more. If you want to change this, tell me.

Edited by Schrwaizer
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

if( countitem( <itemID> ) < amount ){
    atcommand "@load";
}
 

refer countitem , atcommand

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

Thank you Emistry and Schrwaizer. Btw, what do you mean by store? I just want them to have it in the inventory, if they have it on storage, they will be @load-ed they just have to have it with them in their inventory.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  43
  • Reputation:   15
  • Joined:  06/24/12
  • Last Seen:  

Ooh, I just had misunderstanding... just replace the getitem command to warp command, like this:

common npc header,{

set .@your_item_id, <here>;

if(!countitem(.@your_item_id))

{

warp "Save",0,0;

}

end;

}

Edited by Schrwaizer
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  131
  • Topics Per Day:  0.03
  • Content Count:  371
  • Reputation:   3
  • Joined:  11/14/11
  • Last Seen:  

What does the "common npc header,{" does? Can I just remove it or??

anyway.. here's my example from the syntax you gave.

set .@your_item_id, 7227;
if(!countitem(.@your_item_id))
{
warp "Save",0,0;
}
end;
}


Also, I want to put the function to a certain map.. let's say prontera..

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  43
  • Reputation:   15
  • Joined:  06/24/12
  • Last Seen:  

If you want it to be triggered when the player log in a map, use this:

- /tab/ script /tab/ item_checker /tab/ -1,{
OnPcLoadMapEvent:
if(strcharinfo(3) == "prontera" && countitem(7227) )
{
	warp "Save",0,0;
}
end;
}
prontera /tab/ mapflag /tab/ loadevent
You can just replace "common npc header" with your npc header, it has anything special on it. :P

Also, if you will still use the previous script, remove the "!" before "countitem"... it shouldn't be there.

Ask me if it don't work. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...