Denizen/Script Samples: Difference between revisions
From Citizens Wiki
< Denizen
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
For more up-to-date information and full details on specific features (individual commands or tags, for example), check the [https://one.denizenscript.com/denizen/cmds/ Meta Documentation]. | |||
If you want a full tutorial to help get you set up, check out the [https://one.denizenscript.com/denizen/cmds/denizen/vids Tutorial Videos] on youtube or the [https://guide.denizenscript.com/ Beginner's Guide] text website. | |||
If you need quick help, visit our [https://discord.gg/Q6pZGSR Discord group]. | |||
<br><br><br> | |||
<span style="font-family:natalya-alternate-one; font-size:300%; margin-right:-7px; margin-left:-10px;">This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!</span> | |||
<br><br><br> | |||
Samples will go here, maybe! | Samples will go here, maybe! | ||
Revision as of 18:25, 26 December 2019
For more up-to-date information and full details on specific features (individual commands or tags, for example), check the Meta Documentation.
If you want a full tutorial to help get you set up, check out the Tutorial Videos on youtube or the Beginner's Guide text website.
If you need quick help, visit our Discord group.
This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!
Samples will go here, maybe!
Checkpoint NPC
View script with dScript highlighting: http://mcmonkey.org/paste/91
# Simply spawn an NPC and do # /npc assign --set respawnmaster # and now you have a checkpoint NPC :D # NPC Assignment script respawnmaster: # Obligatory type type: assignment # Actions = script run when NPC-related events occur actions: # This one is when the NPC is assigned on assignment: # Enable the trigger 'Proximity' with a radius of 10 blocks - trigger name:proximity state:true radius:10 # interact script list interact scripts: # The interact below - 10 respawnmaster_interact # The interact script respawnmaster_interact: # Obligatory type type: interact # List the steps below steps: # First (Default) step 1: # Triggers that fire when a player moves around near an NPC proximity trigger: # Specifically, when a player enters the radius of 10 blocks mentioned above entry: # Run this script... script: # If the player's last set checkpoint was set by this NPC, # cancel the current script queue (Clear it) (Meaning, the the flag/narrate won't happen) - if <player.flag[respawner]> == <npc.id> queue clear # Add a flag on the player, named respawnpoint, set to the player's current location at the time he entered the radius - flag player respawnpoint:<player.location> # Add a flag on the player, named respawner, set to the ID of the NPC that set this checkpoint. - flag player respawner:<npc.id> # Tell the player that he has reached the checkpoint, in green - narrate "<&2>You reached a checkpoint!" # World script to handle respawning respawnhandler: # Obligatory type type: world # List of world events (events not related to an NPC) that we want to run scripts for events: # The event that fires when a player dies and respawns on player respawns: # If the player doesn't have a respawn point, clear the scriptqueue, same as above, preventing the determine - if <player.flag[respawnpoint]> == null queue clear # Run the task script 'respawnnomercy' with a delay of one second - run respawnnomercy delay:2s # Tell the event that we want to change the outcome to the player's flagged respawn point... # in this event, that changes where the player respawns # Thus, the player respawns at the checkpoint set in the prox trigger above - determine <player.flag[respawnpoint]> # A task script to prevent errors on Multiverse/whatever servers respawnnomercy: # Obligatory type type: task # Script below is the only script in a task script: # Teleport the player to the respawn point, in case the determine above didn't do it - teleport <player> <player.flag[respawnpoint]> # Remember, when whatever quest is completed, to run this command: # - flag player respawnpoint:! # To remove the respawnpoint and allow them to respawn normally