Help with coding #103


  • New
  • Other
Open
Assigned to coldandtired
  • _ForgeUser9980911 created this issue Jan 6, 2013

    What is the issue?
    Basically I'm a bit of a noob at coding this but here's what I came up with:
    My idea is to log every time an animal is killed, where it was killed and who killed it.
    <event>
      <outcome affected_mobs="pig,cow,sheep,chicken,mooshroom">
          <actions>
            <log>Mob was killed by %player%</log>
          </actions>
      </outcome>
    </event>

    Also I'm looking to modify xp or item drops of mobs depending on whether they were killed in a certain coordinate (an incentive to use our arena for easier xp or different drops).
    Many thanks for any help given :)

  • _ForgeUser9980911 added the tags New Other Jan 6, 2013
  • coldandtired posted a comment Jan 6, 2013

    Both are possible. Place something like this in the dies.txt file:

    <event>
      <outcome affected_mobs="pig,cow,sheep,chicken,mushroom_cow">
        <action_group>
          <actions>
            <log>Mob was killed by ^killer^</log>
            <continue/>
          </actions>
        </actions_group>
      </outcome>
      <outcome affected_mobs="pig,cow,sheep,chicken,mushroom_cow">
        <condition_group>
          <conditions>
            <x>above 10, 15 to 20</x>
          <conditions>
        </condition_group>
        <action_group>
          <actions>
            <drop_exp>50</drop_exp>
          </actions>
        </action_group>
      </outcome>
    </event>
    

    That's a quick example. Take a look at the tutorial website to see more actions and conditions.

  • _ForgeUser9980911 posted a comment Jan 7, 2013

    Ok thank you :) With the first script it'll say who killed the mob, but will it also record the location of the event?

    I can work the rest out though, getting the basic structure was something I wasn't sure about.

    And I assume in the spawns file I could write similar code to the first one to log when withers are created (in the event someone uses it to grief a house).

  • coldandtired posted a comment Jan 8, 2013

    All the event files use the same syntax so it would work (without the killer part of course).

    Looking at the code, it seems I never added a location constant :( I'll add that soon. There is a ^world_name^ one though.

  • _ForgeUser9980911 posted a comment Jan 9, 2013

    Ok been playing with the code but no matter how I do it (using tutorial) dropping items or exp doesn't work. Is this a known bug? P.s. thanks for all the help with the logging though, I'll make an individual event for each mob (so i know what mob was killed). Can't wait for location to be recorded also, will be a very useful anti-griefing tool :)

  • _ForgeUser9980911 posted a comment Jan 15, 2013

    Lastly I'm wondering whether mobs has the ability to log spawning of a wither and who spawned it (location obviously once you update that). Is this possible? Thinking adding this and the ^killer^ tag (and any others) to the subelement page? You said they use the same syntax so would it be ^spawner^ to know who spawned a wither boss?


    Edited Jan 15, 2013
  • coldandtired posted a comment Jan 16, 2013

    It's all in the works. I'm currently moving this all to a separate plugin which will handle all logging of actions and conditions (with different levels of information).


To post a comment, please login or register a new account.