I'm probably the noobiest person on this forum.
( sorry for the bad english, not my native language )
I have copied dozens of scripts ( ex: small'g scripts ) and none of them never do anything. Example: Today i'm trying to create an object that shows a imagem when press e with the following script:
function show_img_init(e)
LoadImages("scriptbank\\images\\Get to the River\\001.png",1)
SetImagePosition(50,50)
SetImageAlignment(0)
i_state[e] = "unhidden"
end
function show_img_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 100 then
if i_state[e] == "unhidden" then
Prompt ("any thing")
if g_KeyPressE == 1 and keypressed == 0 then
keypressed = 1
ShowImage(1)
i_state[e] = "hidden"
end -- g_KeyPressE == 1
elseif i_state[e] == "hidden" then
Prompt ("Press E To hide image")
if g_KeyPressE == 1 and keypressed == 0 then
keypressed = 1
HideImage(1)
i_state[e] = "unhidden"
end
end --i_state[e] == {"hidden"}
end -- PlayerDist < 100
if g_KeyPressE == 0 then keypressed = 0 end
end -- main
so, I get this code, create a new lua script with notepad++, paste the code, save as image.lua in script folder
then, open game guru, grab any dinamic entity , put on map, go on properties set as static = no and select the image.lua
Run the game and nothing happens. The object has no prompt
Samething with other scripts, like the mannequin one, that the enemy only follows you if are not looking. Nothing happens.
What the heck I'm doing wrong? I'm using wrongly the scripts?
The author of this post has marked a post as an answer.
Go to answer