Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 55 additions & 5 deletions Scripts/scriptbank/global/global_transfer.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
-- Global Transfer v8 by Necrym59
-- DESCRIPTION: A global behavior that will transfer a value from a User Global to player health or another User Global.
-- DESCRIPTION: [@ACTIVATION=1(1=Automatic, 2=Key Press)]
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Global Transfer v9 by Necrym59
-- DESCRIPTION: Will transfer a value from a user global to player health or another user global.
-- DESCRIPTION: Attach to an entity. Set to AlwaysActive
-- DESCRIPTION: [@ACTIVATION=1(1=Automatic, 2=Global Key Press, 3=In Range Key Press)]
-- DESCRIPTION: [ACTIVATION_KEY$="Z"] Bound key to activate
-- DESCRIPTION: [ACTIVATION_RANGE=90(1,100)] In-Range activation
-- DESCRIPTION: [RANGE_PROMPT$="Press Z to use"] In-Range Prompt
-- DESCRIPTION: [@@TRANSFER_FROM$=""(0=globallist)] user global to transfer amount from eg:(MyStamina)
-- DESCRIPTION: [TRANSFER_AMOUNT=10(0,100)] Amount to transfer
-- DESCRIPTION: [@TRANSFER_TO=1(1=Player Health, 2=User Global)]
Expand All @@ -16,6 +20,8 @@ local lower = string.lower
local global_transfer = {}
local activation = {}
local activation_key = {}
local activation_range = {}
local range_prompt = {}
local transfer_from = {}
local transfer_amount = {}
local transfer_to = {}
Expand All @@ -42,9 +48,11 @@ local processed = {}
local tmphealth = {}
local played = {}

function global_transfer_properties(e, activation, activation_key, transfer_from, transfer_amount, transfer_to, user_global, icon_imagefile, screen_position_x, screen_position_y, screen_scale)
function global_transfer_properties(e, activation, activation_key, activation_range, range_prompt, transfer_from, transfer_amount, transfer_to, user_global, icon_imagefile, screen_position_x, screen_position_y, screen_scale)
global_transfer[e].activation = activation or 1
global_transfer[e].activation_key = activation_key
global_transfer[e].activation_range = activation_range
global_transfer[e].range_prompt = range_prompt
global_transfer[e].transfer_from = transfer_from
global_transfer[e].transfer_amount = transfer_amount
global_transfer[e].transfer_to = transfer_to or 2
Expand All @@ -59,6 +67,8 @@ function global_transfer_init(e)
global_transfer[e] = {}
global_transfer[e].activation = 1
global_transfer[e].activation_key = "Z"
global_transfer[e].activation_range = 90
global_transfer[e].range_prompt = "Press Z to use"
global_transfer[e].transfer_from = ""
global_transfer[e].transfer_amount = 0
global_transfer[e].transfer_to = 2
Expand All @@ -77,6 +87,7 @@ function global_transfer_init(e)
processed[e] = 0
tmphealth[e] = 0
played[e] = 0
SetEntityAlwaysActive(e,1)
end

function global_transfer_main(e)
Expand Down Expand Up @@ -147,7 +158,7 @@ function global_transfer_main(e)
end
end

if global_transfer[e].activation == 2 and keypressed[e] == 0 then -- Keypress
if global_transfer[e].activation == 2 and keypressed[e] == 0 then -- Keypress Global
if g_InKey == string.lower(global_transfer[e].activation_key) or g_InKey == tostring(global_transfer[e].activation_key) and keypressed[e] == 0 then
keypause[e] = g_Time + 1000
keypressed[e] = 1
Expand Down Expand Up @@ -184,6 +195,45 @@ function global_transfer_main(e)
end
end
end

if global_transfer[e].activation == 3 and GetPlayerDistance(e) < global_transfer[e].activation_range and keypressed[e] == 0 then -- Keypress In Range
Prompt(global_transfer[e].range_prompt)
if g_InKey == string.lower(global_transfer[e].activation_key) or g_InKey == tostring(global_transfer[e].activation_key) and keypressed[e] == 0 then
keypause[e] = g_Time + 1000
keypressed[e] = 1
if played[e] == 0 then
PlaySound(e,0)
played[e] = 1
end
if currentvalue[e] >= global_transfer[e].transfer_amount then
if doonce[e] == 0 then
if global_transfer[e].transfer_to == 1 then
if g_PlayerHealth+global_transfer[e].transfer_amount < g_PlayerStartStrength then
SetPlayerHealth(g_PlayerHealth+global_transfer[e].transfer_amount)
SetPlayerHealthCore(g_PlayerHealth)
_G["g_UserGlobal['".. global_transfer[e].transfer_from.."']"] = _G["g_UserGlobal['".. global_transfer[e].transfer_from.."']"] - global_transfer[e].transfer_amount
doonce[e] = 1
end
if g_PlayerHealth+global_transfer[e].transfer_amount >= g_PlayerStartStrength then
tmphealth[e] = (g_PlayerStartStrength - g_PlayerHealth)
SetPlayerHealth(g_PlayerStartStrength)
SetPlayerHealthCore(g_PlayerHealth)
_G["g_UserGlobal['".. global_transfer[e].transfer_from.."']"] = _G["g_UserGlobal['".. global_transfer[e].transfer_from.."']"] - tmphealth[e]
doonce[e] = 1
end
end
if global_transfer[e].transfer_to == 2 then
if global_transfer[e].user_global > "" then
if _G["g_UserGlobal['".. global_transfer[e].user_global.."']"] ~= nil then currentvalue[e] = _G["g_UserGlobal['".. global_transfer[e].user_global.."']"] end
_G["g_UserGlobal['".. global_transfer[e].user_global.."']"] = currentvalue[e] + global_transfer[e].transfer_amount
end
doonce[e] = 1
_G["g_UserGlobal['".. global_transfer[e].transfer_from.."']"] = _G["g_UserGlobal['".. global_transfer[e].transfer_from.."']"] - global_transfer[e].transfer_amount
end
end
end
end
end

if g_Time > keypause[e] then
doonce[e] = 0
Expand Down
16 changes: 11 additions & 5 deletions Scripts/scriptbank/markers/entity_in_zone.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Entity In Zone v10 by Necrym59 and Lee
-- DESCRIPTION: If entity of selected type and allegiance enters the zone, will activate linked or IfUsed entities then destroys this zone.
-- Entity In Zone v11 by Necrym59 and Lee
-- DESCRIPTION: If entity of selected type and allegiance enters the zone, will activate linked or IfUsed entities then can destroy zone.
-- DESCRIPTION: [@ENTITY_TYPE=1(1=Active Object Only, 2=Active Character Only, 3=Active Non-Character Only, 4=Non-Static Objects)]
-- DESCRIPTION: [@ALLEGIANCE=3(0=Enemy, 1=Ally, 2=Neutral, 3=None, 4=Any)]
-- DESCRIPTION: [NOTIFICATION$="Entity in zone"]
-- DESCRIPTION: [ZONEHEIGHT=100(0,1000)]
-- DESCRIPTION: [SpawnAtStart!=1] if unchecked use a switch or other trigger to spawn this zone
-- DESCRIPTION: [SelfDestroy!=1] if checked will destroy zone after activation/detection
-- DESCRIPTION: Plays <Sound0> when triggered.

local entityinzone = {}
local entity_type = {}
local allegiance = {}
local zoneheight = {}
local spawnatstart = {}
local selfdestroy = {}

local EntityID = {}
local EntityAL = {}
Expand All @@ -21,12 +23,13 @@ local played = {}
local doonce = {}
local status = {}

function entity_in_zone_properties(e, entity_type, allegiance, notification, zoneheight, spawnatstart)
function entity_in_zone_properties(e, entity_type, allegiance, notification, zoneheight, spawnatstart, selfdestroy)
entityinzone[e].entity_type = entity_type
entityinzone[e].allegiance = allegiance
entityinzone[e].notification = notification
entityinzone[e].zoneheight = zoneheight
entityinzone[e].spawnatstart = spawnatstart
entityinzone[e].selfdestroy = selfdestroy
end

function entity_in_zone_init(e)
Expand All @@ -36,6 +39,7 @@ function entity_in_zone_init(e)
entityinzone[e].notification = "Entity in zone"
entityinzone[e].zoneheight = 100
entityinzone[e].spawnatstart = 1
entityinzone[e].selfdestroy = 1

status[e] = "init"
played[e] = 0
Expand Down Expand Up @@ -119,7 +123,9 @@ function entity_in_zone_main(e)
end
end
end
if g_Time > wait[e] then
Destroy(e)
if g_Time > wait[e] then
if entityinzone[e].selfdestroy == 1 then Destroy(e) end
played[e] = 0
doonce[e] = 0
end
end
49 changes: 38 additions & 11 deletions Scripts/scriptbank/objects/add_movement.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
-- Add_Movement v5 by Necrym59
-- Add_Movement v6 by Necrym59
-- DESCRIPTION: Will add the selected movement effect to the named object.
-- DESCRIPTION: Attach to an object. Set Always active ON
-- DESCRIPTION: [OBJECT_NAME$=""]
-- DESCRIPTION: [MOVE_X=0(0,1000)]
-- DESCRIPTION: [MOVE_Y=0(0,1000)]
-- DESCRIPTION: [MOVE_Z=0(0,1000)]
-- DESCRIPTION: [#MOVE_SPEED=0.50(0.0,2.0)]
-- DESCRIPTION: [RESET_DELAY=0(0,100)] in seconds (0=No Reset)
-- DESCRIPTION: [#MOVE_SPEED=0.50(0.0,5.0)]
-- DESCRIPTION: [#RESET_DELAY=0.0(0.0,100)] in seconds (0=No Reset)
-- DESCRIPTION: [RESET_ROTATION!=1] Rotates when end resets.
-- DESCRIPTION: [RESET_START!=0] Resets to start position .
-- DESCRIPTION: [ActiveAtStart!=1] if unchecked use a switch or zone trigger to activate.
-- DESCRIPTION: <Sound0> - Reset Sound
-- DESCRIPTION: <Sound1> - Moving Sound
Expand All @@ -24,11 +25,15 @@ local move_z = {}
local move_speed = {}
local reset_delay = {}
local reset_rotation = {}
local reset_start = {}
local ActivateAtStart = {}

local object_no = {}
local status = {}
local objEnt = {}
local objectstartxpos = {}
local objectstartypos = {}
local objectstartzpos = {}
local objectxpos = {}
local objectypos = {}
local objectzpos = {}
Expand All @@ -46,14 +51,15 @@ local moved = {}
local rotated = {}
local played = {}

function add_movement_properties(e, object_name, move_x, move_y, move_z, move_speed, reset_delay, reset_rotation, ActivateAtStart)
function add_movement_properties(e, object_name, move_x, move_y, move_z, move_speed, reset_delay, reset_rotation, reset_start, ActivateAtStart)
add_movement[e].object_name = lower(object_name)
add_movement[e].move_x = move_x
add_movement[e].move_y = move_y
add_movement[e].move_z = move_z
add_movement[e].move_speed = move_speed
add_movement[e].reset_delay = reset_delay
add_movement[e].reset_rotation = reset_rotation or 0
add_movement[e].reset_start = reset_start or 0
add_movement[e].ActivateAtStart = ActivateAtStart or 0
add_movement[e].object_no = 0
end
Expand All @@ -66,7 +72,8 @@ function add_movement_init(e)
add_movement[e].move_z = 0
add_movement[e].move_speed = 0
add_movement[e].reset_delay = 0
add_movement[e].reset_rotation = 0
add_movement[e].reset_rotation = 0
add_movement[e].reset_start = 0
add_movement[e].ActivateAtStart = 1
add_movement[e].object_no = 0

Expand All @@ -87,13 +94,17 @@ function add_movement_main(e)
if n ~= nil and g_Entity[n] ~= nil then
if lower(GetEntityName(n)) == add_movement[e].object_name then
add_movement[e].object_no = n
SetEntityAlwaysActive(n,1)
break
end
end
end
end
if add_movement[e].object_no ~= 0 then
local x,y,z,Ax,Ay,Az = GetEntityPosAng(add_movement[e].object_no)
objectstartxpos[e] = x
objectstartypos[e] = y
objectstartzpos[e] = z
objectxpos[e] = x
objectypos[e] = y
objectzpos[e] = z
Expand All @@ -106,12 +117,14 @@ function add_movement_main(e)
if add_movement[e].ActivateAtStart == 1 then SetActivated(e,1) end
if add_movement[e].ActivateAtStart == 0 then SetActivated(e,0) end
end
reached[e] = 0
Show(add_movement[e].object_no)
reset[e] = g_Time + (add_movement[e].reset_delay*1000)
status[e] = "endinit"
end

if g_Entity[e].activated == 1 then
Show(add_movement[e].object_no)
if g_Entity[e].activated == 1 then

local x,y,z,Ax,Ay,Az = GetEntityPosAng(add_movement[e].object_no)
local ox,oy,oz = U.Rotate3D(add_movement[e].move_x, add_movement[e].move_y, add_movement[e].move_z, rad(startxang[e]),rad(startyang[e]),rad(startzang[e]))
objectxpos[e] = x + ox * add_movement[e].move_speed/100 * movedir[e]
Expand Down Expand Up @@ -154,9 +167,9 @@ function add_movement_main(e)
reset[e] = g_Time + (add_movement[e].reset_delay*1000)
end
end
end
if g_Time > reset[e] and add_movement[e].reset_delay > 0 and reached[e] == 1 then
end

if g_Time > reset[e] and add_movement[e].reset_delay > 0 and add_movement[e].reset_start == 0 and reached[e] == 1 then
GravityOff(add_movement[e].object_no)
CollisionOff(add_movement[e].object_no)
SetPosition(add_movement[e].object_no,objectxpos[e],objectypos[e],objectzpos[e])
Expand Down Expand Up @@ -184,7 +197,21 @@ function add_movement_main(e)
if g_Entity[add_movement[e].object_no]['angley'] == 180 then
ResetRotation(add_movement[e].object_no,0,0,0)
end
end
end
end

if g_Time > reset[e] and add_movement[e].reset_delay > 0 and add_movement[e].reset_start == 1 and reached[e] == 1 then
GravityOff(add_movement[e].object_no)
CollisionOff(add_movement[e].object_no)
SetPosition(add_movement[e].object_no,objectstartxpos[e],objectstartypos[e],objectstartzpos[e])
reached[e] = 0
--add_movement[e].object_no = 0
movestate[e] = 0
movedir[e] = 1
moved[e] = 0
rotated[e] = 0
played[e] = 0
status[e] = "init"
end

if add_movement[e].reset_delay == 0 and reached[e] == 1 then SetActivated(e,0) end
Expand Down
2 changes: 1 addition & 1 deletion Scripts/scriptbank/objects/zipline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
-- DESCRIPTION: [@ZIP_RELEASE=2(1=Manual Release, 2=Auto Release)]
-- DESCRIPTION: [ZIP_RELEASE_TEXT$="Q to release"]
-- DESCRIPTION: [ZIPLINE_OBJECT$=""] eg: zipline
-- DESCRIPTION: [@ANCHOR_status=1(1=Visible, 2=Invisible)]
-- DESCRIPTION: [@ANCHOR_STATUS=1(1=Visible, 2=Invisible)]
-- DESCRIPTION: [#RELEASE_ADJUSTMENT=0.10(0.10,3.00)]
-- DESCRIPTION: <Sound0> loop for zipline travel

Expand Down