Thread: Making an npc only give an item to player ONCE each acc

Results 1 to 10 of 10
  1. #1 Making an npc only give an item to player ONCE each acc 
    Registered Member

    Join Date
    Nov 2006
    Posts
    530
    Thanks given
    5
    Thanks received
    21
    Rep Power
    514
    Well I want to make an npc give an item to all players when they talk to him, but i want it so they can only get it off the npc once, even if they lose it, they cant get it back.

    Thanks

    Will rep if works

    edit: using devo 2.7
    Reply With Quote  
     

  2. #2  
    Registered Member
    Hunter's Avatar
    Join Date
    Jun 2009
    Age
    30
    Posts
    857
    Thanks given
    3
    Thanks received
    23
    Rep Power
    216
    Code:
    public boolean givenItem = false;
    Then once the person receives the item from the NPC just change it to true and check to see if it is true. If it is, don't give the item. That simple.
    Reply With Quote  
     

  3. #3  
    Registered Member

    Join Date
    Nov 2006
    Posts
    530
    Thanks given
    5
    Thanks received
    21
    Rep Power
    514
    Quote Originally Posted by Hunter View Post
    Code:
    public boolean givenItem = false;
    Then once the person receives the item from the NPC just change it to true and check to see if it is true. If it is, don't give the item. That simple.
    Can you explain how to in a bit more detail please? like where things go etc, i want to learn from it so i know how to do it with other things etc

    thx

    using devo 2.7 btw
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Aug 2009
    Posts
    101
    Thanks given
    0
    Thanks received
    0
    Rep Power
    103
    or you could add one of the million things delta has xD - in the player file
    Reply With Quote  
     

  5. #5  
    Registered Member
    Hunter's Avatar
    Join Date
    Jun 2009
    Age
    30
    Posts
    857
    Thanks given
    3
    Thanks received
    23
    Rep Power
    216
    Post the coding you use to give a player an item and we'll work from there.
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Nov 2006
    Posts
    530
    Thanks given
    5
    Thanks received
    21
    Rep Power
    514
    Quote Originally Posted by Hunter View Post
    Post the coding you use to give a player an item and we'll work from there.
    Code:
    			PutNPCCoords = false;
    			if (NPCID == 500) {//id
    				skillX = server.npcHandler.npcs[NPCSlot].absX;//keep
    				skillY = server.npcHandler.npcs[NPCSlot].absY;//keep
    				addItem (995,1);
    Reply With Quote  
     

  7. #7  
    Registered Member
    Hunter's Avatar
    Join Date
    Jun 2009
    Age
    30
    Posts
    857
    Thanks given
    3
    Thanks received
    23
    Rep Power
    216
    I'm assuming this is in client.java so ...add that boolean I told you about before at the top of the file somewhere then change your coding to this:

    Code:
    if(NPCID == 500) {
    if(givenItem) {
    sendMessage("You have already received the item!");
    }
    else {
    addItem(995, 1);
    givenItem = true;
    }
    }
    Reply With Quote  
     

  8. #8  
    Registered Member

    Join Date
    Nov 2006
    Posts
    530
    Thanks given
    5
    Thanks received
    21
    Rep Power
    514
    Quote Originally Posted by Hunter View Post
    I'm assuming this is in client.java so ...add that boolean I told you about before at the top of the file somewhere then change your coding to this:

    Code:
    if(NPCID == 500) {
    if(givenItem) {
    sendMessage("You have already received the item!");
    }
    else {
    addItem(995, 1);
    givenItem = true;
    }
    }

    thx man got it working but how do I make it so that even after logging out, they still cant talk?

    atm, i log out then in and i can get it again
    Reply With Quote  
     

  9. #9  
    Banned

    Join Date
    May 2009
    Posts
    1,387
    Thanks given
    21
    Thanks received
    14
    Rep Power
    0
    Quote Originally Posted by I Blake I View Post
    thx man got it working but how do I make it so that even after logging out, they still cant talk?

    atm, i log out then in and i can get it again
    By saving it to the character file.. common sence?
    Reply With Quote  
     

  10. #10  
    Registered Member

    Join Date
    Nov 2006
    Posts
    530
    Thanks given
    5
    Thanks received
    21
    Rep Power
    514
    Quote Originally Posted by Kenny View Post
    By saving it to the character file.. common sence?
    Player.java?
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •