g_storyinzone_mode = {}
function collect_item_play_video_init(e)
g_storyinzone_mode[e] = 0
end
function collect_item_play_video_main(e)
local Ent = g_Entity[e]
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 100 and g_PlayerHealth > 0 then
if video_ShowDecal ~= nil then
video_ShowDecal(Ent.x , Ent.y+ 20, Ent.z , g_PlayerAngX, g_PlayerAngY, g_PlayerAngZ,500)
end
PromptDuration("Press E to collect the potion ",500)
if g_storyinzone_mode[e] ~= nil then
if g_storyinzone_mode[e] == 0 then
g_storyinzone_mode[e] = 1
HideHuds()
if radar_hideallsprites ~= nil then radar_hideallsprites() end
else
if g_storyinzone_mode[e] == 1 and g_KeyPressE == 1 then
PlaySound(e,0)
PlayVideo(e,1)
StopSound(e,0)
g_storyinzone_mode[e] = 2
Hide(e)
ActivateIfUsed(e)
else
if g_storyinzone_mode[e] == 2 then
if radar_showallsprites ~= nil then radar_showallsprites() end
ShowHuds()
PlaySound(e,2)
Destroy(e)
PromptDuration("Collected ",3000)
g_storyinzone_mode[e] = 3
end
end
end
end
end
end
And here is the decal script.
function video_decal_init(e)
--Scale(e, 200)
Hide(e)
end
local timer = 0
local decal = nil
function video_ShowDecal(x, y, z, xA, yA, zA, t)
if decal then
local terrY = GetTerrainHeight(x, z)
if y < terrY + 10 then y = terrY + 10 end
ResetPosition(decal, x, y, z)
ResetRotation(decal, xA, yA, zA)
timer = g_Time + t
end
end
function video_decal_main(e)
if decal == nil then
decal = e
end
if timer ~= 0 then
Show(e)
--CollisionOn(e)
RotateToCamera(e)
if g_Time > timer then
timer = 0
Hide(e)
end
end
end