Paste #10501: Inventory Issues

Date: 2014/10/15 18:47:03 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


On Death Body Generation Event:
    #
    # Please keep all flags for the class under a <script.name>.<def[name of yur flag]>
    #
    type: world
    events:
        on player death:
        - create player <context.entity.name.display> <context.entity.location> traits:inventory save:body
        - define npc <entry[body].created_npc>
        - wait d@10t
        - adjust <def[npc]> "set_assignment:s@dead body assignment"
        - announce "%npc% <def[npc]>"
        - inventory swap d:<%npc%.inventory> o:<player.inventory> 
        - determine NO_DROPS_OR_XP

        #todo: mor  
        #on npc death:
        #- determine NO_DROPS_OR_XP


tie:
    type: assignment
    actions:
        on assignment:
        - animate <npc> animation:sleep

        on click:
        - inventory open d:<npc.inventory>
swp:
    type: task
    script:
    - inventory swap d:<player.selected_npc.inventory> o:<player.inventory>

dead body assignment:
    type: assignment
    actions:
        on assignment:
        - 
        - flag npc date_of_death:<server.current_time_millis>
        - flag npc deadbody
        - wait d@3t
        - animate <npc> animation:sleep
        - run remove def:<npc> delay:d@10m

        #todo:
        #right click loot
        #shift right click pickup body
        on click:
        - define age_millis <server.current_time_millis.sub_int[<npc.flag[date_of_death]>]>
        - narrate "The body appears to be <def[age_millis].div[1000].as_duration.formatted> old..."
        - announce "<npc.name> <npc.inventory>"
        - inventory open d:<npc.inventory>


        #3 days
        on spawn:
        - if <util.date.time.duration.in_ticks.sub_int[<d@3d.in_ticks>]> > <npc.flag[date_of_death]> remove <npc>

        on remove:
        - announce "The body of <npc.name> is decaying."
        #maybe one day put a gravestone there with a chest underneath with date and name and reason of death
        # Gravestone? maybe a temp gravestone then....