i managed to get one working, all you do in this is press e to read and walk away to close note. 1st time reading can trigger a spawn as well. Sorry if it's a bit messy.
Sound slot 0 = sound of note/message being picked up
Sound slot 1 = sound of note/message being put down.
-- Note Reader -- Tarkus1971
-----------------
-- My 1st botched/ edited script, it works, assign to a dynamic entity
-- Press E to read note, and just walk away and it will disappear again, 1st reading could trigger
-- entity spawning.
---------------------------
-- firstpress is used for triggering spawn if read for the 1st time.
local firstpress = 0
-- this is the actual image number to display.
local note = 0
-- checks if E is pressed.
local keydown = 0
-- player distance
local dist = 60
function note00_init(e)
--images must be in folder "scriptbank\images\testnotes" & named "000.png" / "001.png" / "002.png" etc
--testnotes must be changed to the folder which contains your images.
LoadImages("testnotes",0)
end
function note00_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist > dist and g_PlayerHealth > 0 then
if keydown == 1 then
HideImage(note)
StopSound(e,0)
PlaySound(e,1)
Show(e)
keydown = 0
end
end
if PlayerDist < dist and g_PlayerHealth > 0 then
SourceAngle = g_PlayerAngY
while SourceAngle < 0.0 do
SourceAngle = SourceAngle + 360.0
end
while SourceAngle > 340.0 do
SourceAngle = SourceAngle - 360.0
end
PlayerDX = (g_Entity[e]['x'] - g_PlayerPosX)
PlayerDZ = (g_Entity[e]['z'] - g_PlayerPosZ)
DestAngle = math.atan2( PlayerDZ , PlayerDX )
-- Convert to degrees
DestAngle = (DestAngle * 57.2957795) - 90.0
Result = math.abs(math.abs(SourceAngle)-math.abs(DestAngle))
if Result > 180 then
Result = 0
end
if Result < 20.0 then
--[[
SourceAngle = g_PlayerAngX
while SourceAngle < 0.0 do
SourceAngle = SourceAngle + 360.0
end
while SourceAngle > 335.0 do
SourceAngle = SourceAngle - 360.0
end
DestAngle = math.atan2( PlayerDZ , PlayerDY )
-- Convert to degrees
DestAngle = (DestAngle * 57.2957795) - 90.0
Result = math.abs(math.abs(SourceAngle)-math.abs(DestAngle))
if Result > 180 then
Result = 0
end
if Result < 25.0 then
--]]
if keydown == 0 then
PromptLocal (e,"Press E to use laptop.")
end
-- Prompt(firstpress)
if g_KeyPressE == 1 and firstpress == 0 and keydown == 0 then
SetImageAlignment(0)
SetImagePosition(50,50)
Hide(e)
PlaySound(e,0)
ShowImage(note)
-- Place spawns here --
Spawn(10)
-- set for entity 6, you can edit it to what ever you like.
firstpress = 1
keydown = 1
end
if g_KeyPressE == 1 and firstpress == 1 and keydown == 0 then
SetImageAlignment(0)
SetImagePosition(50,50)
Hide(e)
PlaySound(e,0)
ShowImage(note)
keydown = 1
end
--end
end
end
-- Last end
end
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, AMD HD7870 gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit.