Scripts / [SOLVED] Need Help to fix this script

Author
Message
GamerLLL
5
Years of Service
User Offline
Joined: 22nd Jun 2019
Location:
Posted: 18th Jul 2019 22:37

Hello, I would like a help, this script when I create another entity, the next entity that places the script, it appears that it has already been activated, I wanted a script in which I could appear an image / sprite on the screen and after a few seconds disappear , but that he could do it whenever he wanted.




livre2_pressed = 0

function book_init(e)
LoadImages("book",0)
end



function book_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 250 then
if g_Entity[e]['activated'] == 0 then
if g_Entity[e]['haskey'] == -1 then
SetActivated(e,1)
else
if g_Entity[e]['haskey'] == 1 then
Prompt("Press E to read the book")
if g_KeyPressE == 1 then
SetActivated(e,1)
end
else
Prompt("...")
end
end
else
if g_Entity[e]['activated'] == 1 then

Prompt("Press E to read the book")
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and livre2_pressed == 0 then

g_Entity[e]['animating'] = 1
SetActivated(e,2)
ActivateIfUsed(e)
SetImagePosition(50,50)
ShowImage(0)
PlaySound(e,0)
StartTimer(e)
livre2_pressed = 1
end
else
if g_Entity[e]['activated'] == 2 then
-- Timer... (ex : 8000 = 8 seconds)
if GetTimer(e)>8000 then
--HideImage(0)
Prompt("This book has already been read...")
HideImage(0)
end

if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and livre2_pressed == 0 then
g_Entity[e]['animating'] = 1
SetActivated(e,1)
livre2_pressed = 1
end
end
end
end
end
if g_KeyPressE == 0 then
livre2_pressed = 0
end
end

The author of this post has marked a post as an answer.

Go to answer

Attachments

Login to view attachments
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 19th Jul 2019 03:48
Do you say something like this?





It only happens once, if I've got your point.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GamerLLL
5
Years of Service
User Offline
Joined: 22nd Jun 2019
Location:
Posted: 19th Jul 2019 19:05
Nope, tks for answer more i need script or edit my script, for not already read book,"This book has already been read...", i need all times press E appear sprite/image, without "This book has already been read..." all times i can see and read "book".
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 20th Jul 2019 10:44
Try this one.



hth
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GamerLLL
5
Years of Service
User Offline
Joined: 22nd Jun 2019
Location:
Posted: 20th Jul 2019 22:14
=/ thanks again more dont work =(
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 20th Jul 2019 22:45
As it does not work, you watch the video below.



The player can always read the book, and you no longer receive the message "This book has already been read." never again, just as you said you wanted.
You will have to better explain your problem.
Use the code tags, it is much easier to read the code.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GamerLLL
5
Years of Service
User Offline
Joined: 22nd Jun 2019
Location:
Posted: 22nd Jul 2019 02:57
Now work THANKSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
PM
GamerLLL
5
Years of Service
User Offline
Joined: 22nd Jun 2019
Location:
Posted: 22nd Jul 2019 03:20

I have one more question if I do not ask too much, how can I duplicate this "book1" to "book2" and in "book2" use to appear another image?
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 22nd Jul 2019 04:40 Edited at: 22nd Jul 2019 04:51
This post has been marked by the post author as the answer.
Try this one.




hth

Edit: Enter the images in your folder, in the video I have: scriptbank> images> book1> and the 4 images.
Notice images names such as 000,001,002,003.
In video I Named each barrel such as Barrel (Acid)1, Barrel (Acid)2, Barrel (Acid)3, Barrel (Acid)4.
Attach the script to each trigger entity, in the video 4 barrels.
Each barrel show you a different pic.
You can ask again and again to watch the pics, books or wharever image, you want to.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM
GamerLLL
5
Years of Service
User Offline
Joined: 22nd Jun 2019
Location:
Posted: 23rd Jul 2019 18:56
You are the best man, THANK YOUUUUUUUUUUUUUU
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 23rd Jul 2019 19:52
Glad to help.
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics
cpu mark: 10396.6
2d graphics mark: 947.9
3d graphics mark: 8310.9
memory mark 2584.8
Disk mark: 1146.3
Passmark rating: 3662.4

PM

Login to post a reply

Server time is: 2024-12-22 14:11:09
Your offset time is: 2024-12-22 14:11:09