-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathME5_LowHealthIFS.lua
138 lines (116 loc) · 5.01 KB
/
ME5_LowHealthIFS.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
-----------------------------------------------------------------
-----------------------------------------------------------------
-- MASS EFFECT: UNIFICATION Low Health IFS Script by Nedarb7
-- Build 20404/06
-- Screen Names: Nedarb7
-- E-Mail:
-- Apr 04, 2015
-- Copyright (c) 2015 Nedarb7
--
-- About:
-- The purpose of script is to work with MEU's low health function and display a red vignette when the player has low health.
--
--
-- Legal:
-- This script is licensed under the BSD 3-Clause License. A copy of this license (as LICENSE.md) should have been included
-- with this script. If it wasn't, it can also be found here: https://www.w3.org/Consortium/Legal/2008/03-bsd-license.html
--
-- THIS SCRIPT IS NOT MADE, DISTRIBUTED, OR SUPPORTED BY LUCASARTS, A DIVISION OF LUCASFILM ENTERTAINMENT COMPANY LTD.
-----------------------------------------------------------------
-----------------------------------------------------------------
ifs_lowhealth_vignette = NewIFShellScreen {
Timer = nil, -- This is our timer variable. It is useless unless used by the update function.
TimerMngr = nil, -- Manages the amount of frames displayed and prepares the timer for rewinding
TimerType = nil, -- This will only be used for reversing the vision effects
bNohelptext_back = 1, -- Remove the default "back" button
bNohelptext_backPC = 1, -- To be safe, use PC variable as well
bNohelptext_accept = 1, -- Remove the default "accept" button
bg_texture = nil, -- Background texture, leave it at nil since the update function manages that
movieBackground = nil, -- We don't have a movie background
movieIntro = nil, -- We don't have a movie intro
Enter = function(this, bFwd) -- Function runs on entering the screen
gIFShellScreenTemplate_fnEnter(this, bFwd) -- call base class
-- Make sure these variables are only set on entering forward to the screen, not backing in
if(bFwd) and this.TimerType ~= false then -- Further, prevent spawn screen bugs
this.Timer = 10 -- By setting the timer to 10, we have initiated the fake timer
this.TimerMngr = 0 -- We will also keep track of frames
this.TimerType = nil -- Reset the reversal if on entering screen to prevent bugs
end
-- Disable mouse
ScriptCB_EnableCursor(nil)
end,
Update = function(this, fDt)
gIFShellScreenTemplate_fnUpdate(this, fDt) -- Load defaults
-- Keep the mouse invisible (bug fix)
ScriptCB_EnableCursor(nil)
-- Exit this function as soon as possible if the timer is nil
if this.Timer == nil then return end
-- Safety reasons, we don't want to jump frames
if fDt < 0.5 then
-- Subtract the function delay time from our timer variable
this.Timer = this.Timer - ( fDt * 100 )
-- Timer time
if this.Timer <= 0 then
-- Make sure we haven't passed ten frames
if this.TimerMngr < 10 and this.TimerType == nil then
-- Count the frame
this.TimerMngr = this.TimerMngr + 1
-- Change the texture using TimerMngr as our frame number
IFImage_fnSetTexture(ifs_lowhealth_vignette["lowhealth_vignette_textures"], "meu_lowhealth_threshold_" .. this.TimerMngr)
Timer = nil -- End the timer
elseif this.TimerType == true then -- If it is a reversed process, undo the effects
-- Count the frame
this.TimerMngr = this.TimerMngr - 1
-- Change the texture using TimerMngr as our frame number
IFImage_fnSetTexture(ifs_lowhealth_vignette["lowhealth_vignette_textures"], "meu_lowhealth_threshold_" .. this.TimerMngr)
if this.TimerMngr <= 0 then -- Exit the screen when no frames are left
ScriptCB_PopScreen()
end
end
end
end
end,
Exit = function(this, bFwd)
end,
Input_Accept = function(this)
end,
Input_Back = function(this)
end,
Input_GeneralUp = function(this)
end,
Input_GeneralRight = function(this)
end,
Input_GeneralDown = function(this)
end,
Input_GeneralLeft = function(this)
end,
Input_GeneralUp2 = function(this)
end,
Input_GeneralRight2 = function(this)
end,
Input_GeneralDown2 = function(this)
end,
Input_GeneralLeft2 = function(this)
end,
}
-- This function will create our texture table
function ifs_LowHealth_TextureTable(this)
local w,h = ScriptCB_GetScreenInfo()
ifs_lowhealth_vignette["lowhealth_vignette_textures"] = NewIFImage {
ZPos = 255, -- or ZOrder
ScreenRelativeX = 0.5,
ScreenRelativeY = 0.5,
texture = "single_player_campaign",
localpos_l = -w / 2, -- localpos_(x) is how far the image stretches in a direction from the position
localpos_t = -h / 2,
localpos_r = w / 2,
localpos_b = h / 2,
}
-- Make the texture invisible
IFImage_fnSetTexture(ifs_lowhealth_vignette["lowhealth_vignette_textures"], nil)
end
-- Call our texture making function
ifs_LowHealth_TextureTable(ifs_lowhealth_vignette)
ifs_LowHealth_TextureTable = nil
-- Make the screen
AddIFScreen(ifs_lowhealth_vignette,"ifs_lowhealth_vignette")