Results 1 to 9 of 9

Thread: Kill Counter

  1. #1
    Normal User
    Join Date
    Jun 2012
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    14
    Rep Power
    5

    Kill Counter

    Ok so ive been working on a task counter. I actually seem to have edited one i found on here posted by lelao22 and got it working somewhat.

    The problem is that technically it is doing what ive told it to do, it is counting, but its resetting because of the way ive got it set up.

    This script counts everytime you kill a monster, but every time the message changes in the server log the count resets to 0.

    This is the way i have it set up but i am wanting it to store the count and add to it.


    example: I just killed a tarantula and im doing tarantula task. so the task counter i made counts it as a kill.

    so thats killedcount = 1

    well when it kills another tarantula it should go to killedcount = 2

    but right now it counts killedcount = 1 and as soon as another message pops up in server log the count goes killedcount = 0

    any help would be awesome. thanks

    This script goes in the hud so it can be displayed on the screen.

    Code:
    killedcount = 0
    taskposx = 20
    taskposy = 500
    msgs = getmessages("Server Log")
    qtd = msgs.count-1
    
    for i=0,qtd do
    if msgs[qtd].text:find('Loot of a tarantula: ..') then
    i = 0 + 1
    killedcount = i
    end
    end
    addtext('you have killed '..killedcount,taskposx,taskposy)

  2. #2
    Normal User
    Join Date
    Jun 2012
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    14
    Rep Power
    5
    I even tried it this way but it wont even count them this way. all it does it take the display off when its targeting a monster and puts it back up after its dead but it still says "you have killed 0".

    Code:
    killedcount = 0
    taskposx = 20
    taskposy = 500
    
    if target.name == "Tarantula" and target.hppc == "0"
    then
    i = i + 1
    killedcount = i + 1
    end
    
    addtext('you have killed '..killedcount,taskposx,taskposy)

  3. #3
    Normal User
    Join Date
    Feb 2012
    Location
    Ottawa, Canada.
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    12
    Rep Power
    5
    PHP Code:
    killedcount killedcount 
    Cheers,
    WedNesDay.

  4. #4
    Normal User
    Join Date
    Jun 2012
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    14
    Rep Power
    5
    i tried the
    killedcount = killedcount +1

    and i get 1724 on the display after 1 kill on the first script and it still keeps resetting
    it does nothing on the second script

  5. #5
    Normal User
    Join Date
    Feb 2012
    Posts
    129
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    1 Post(s)
    Reputation
    12
    Rep Power
    5
    in my post, it work perfect, only problem is that 'killedcount' no is a variable global and just can be used in hud no like a action/hotkey.

    so i had the idea make two codes, one for Actions another for Hud.

    PHP Code:
    killedcount 0
    taskposx 
    30 
    taskposy 
    30 
    monsterkill 
    "tarantula" 
    msgs getmessages("Server Log"
    qtd msgs.count-
    qtd2 
    qtd+killedcount 


    for i=killedcount,qtd2 do 
     if 
    msgs[qtd].text:find('Loot of a '..monsterkillthen 
      i
    =killedcount 
      killedcount
    =killedcount+
     end 
    end 

    addtext
    ('you have killed '..killedcount,taskposx,taskposy
    up code like hud.

    PHP Code:
    local killedcount 
    local monsterkill 
    "tarantula" 
    local msgs getmessages("Server Log"
    local qtd msgs.count-
    local qtd2 
    qtd+killedcount 

    for i=killedcount,qtd2 do 
     if 
    msgs[qtd].text:find('Loot of a '..monsterkillthen 
      i
    =killedcount 
      killedcount
    =killedcount+
     end 
    end 
    this like Action/Hotkey

    not will work fine but it helps.
    Last edited by lelao22; 06-26-2012 at 10:21 PM.
    REP+ If I helped you

  6. #6
    Normal User
    Join Date
    Jun 2012
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    14
    Rep Power
    5
    the code that was original i could not get to work. it would count half the time and then when it did it would count by 5000. thats why ive been trying to edit it. ill try it again and see whats up. ty for your help.

  7. #7
    Normal User
    Join Date
    Feb 2012
    Posts
    129
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    1 Post(s)
    Reputation
    12
    Rep Power
    5
    I edited the action again

    you have to be with the server log clean without message of damage

    tested killing 300~ minotaurs the only problem is if u put "minotaur" it will got "minotaur mage/guard/archer"

    PHP Code:
    killedcount 0
    taskposx 
    30 
    taskposy 
    30 
    monsterkill 
    "minotaur" 
    msgs getmessages("Server Log"
    qtd msgs.count-


    for i=0,qtd do 
     if 
    msgs[qtd].text:find('Loot of a '..monsterkillthen
       i
    =killedcount 
      killedcount
    =killedcount+1
      end 
    end 

    addtext
    ('you have killed '..killedcount,taskposx,taskposy
    remember that you need to do two codes one for hud another for actions
    REP+ If I helped you

  8. #8
    Normal User
    Join Date
    Feb 2012
    Posts
    129
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    1 Post(s)
    Reputation
    12
    Rep Power
    5
    many problems, I give up.
    REP+ If I helped you

  9. #9
    Normal User
    Join Date
    Jun 2012
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    14
    Rep Power
    5
    ill keep messing around with it and see if i can get it to work. would be great if we can post from actions to hud so that some actions can have a read out on the display.

Posting Permissions

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