Staff Pick: Camera Utilities
By
DNxCreated: 2016/07/17 02:45:17 UTC-07:00 (8 years and 161 days ago)
Edited: 2016/07/30 21:35:57 UTC-07:00 (8 years and 147 days ago)
Likes: 0
Staff pick as of: 2017/01/16 09:38:45 UTC-08:00 (7 years and 342 days ago)
Denizen Version: 0.9.8
Script Version: 0.01
Description:
same like http://mcmonkey.org/denizen/repo/entry/79
WITHOUT PIG SOUNDS!!
Usage:
# Used to force player's camera to a location
- run CameraUtil def:attach|<l@location> as:<p@player>
# Used to free player from the forced camera
- run CameraUtil def:detach as:<p@player>
Download script |
View raw scriptCameraUtil_Version:
type: version
track: true
name: "Camera Utilities"
id: 102
description: "Player's Camera utilities."
version: 0.02
CameraUtil:
type: task
debug: false
speed: 0t
definitions: action|location
script:
- if <def[action]> == attach {
- inject locally path:detach
- inject locally path:create
- teleport <def[location]>
- wait 1t
- inject locally path:attach
- queue clear
}
- if <def[action]> == detach {
- inject locally path:detach
}
create:
- spawn e@CameraUtil_Entity <def[location]> save:x
- define attach_to <entry[x].spawned_entities.first>
- flag <player> camerautil_attached_to:<def[attach_to]>
attach:
- define to <player.flag[camerautil_attached_to].as_entity||null>
- if <def[to]> != null {
- flag <player> camerautil_lastgamemode:<player.gamemode>
- adjust <player> gamemode:spectator
- async {
- while <player.has_flag[camerautil_attached_to]> {
- adjust <player> spectate:<def[to]>
- wait 10t
}
}
}
detach:
- if <player.has_flag[camerautil_attached_to]> {
- if <player.has_flag[camerautil_lastgamemode]> {
- adjust <player> gamemode:<player.flag[camerautil_lastgamemode]>
- flag <player> camerautil_lastgamemode:!
}
- define as <player.flag[camerautil_attached_to]>
- flag <player> camerautil_attached_to:!
- adjust <player> spectate:<player>
- remove <def[as]>
}
CameraUtil_Listener:
type: world
debug: false
events:
on system time hourly:
- if <s@CameraUtil_Version.yaml_key[track]> {
- webget "http://morphanone.space/webizen.aspx/tracker?script=<s@CameraUtil_Version.yaml_key[id]>&version=<s@CameraUtil_Version.yaml_key[version]>"
}
on player quits:
- inject s@CameraUtil path:detach
on world unload:
- foreach <context.world.entities.filter[scriptname.is[==].to[CameraUtil_Entity]]> {
- remove <def[value]>
}
CameraUtil_Entity:
type: entity
debug: false
entity_type: e@armor_stand
gravity: false
visible: false
invulnerable: true
View History