Scripts / CosmicProphet Traffic light.

Author
Message
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 29th Oct 2017 13:17 Edited at: 29th Oct 2017 13:18
hi all.

i have downloaded the free stuff of CosmicProphet. so i wanted to use the traffic light. In the download files i do not have the script for the traffic light. So i want to make my own script. i have used the ai_viewanimations the see the animation frames. the frames from 0 to 918 is the one's i want to use. i have change the frames in the fpe to :
;Animationinfo
animmax = 1
anim0 = 0,918

my script that i want to use is this:


But it does not work. . Please can someone tel me what am i doing wrong.
i want the traffic light just to loop the animation from 0 to 918 constantly when the player is in range.
i have tried the loop function also, but it do not work.

Thanks for any help.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 4GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Oct 2017 15:44
You need to have a toggle flag:

toggle = true

....

if g_Entity[e]['plrvisible'] == 1 then
if toggle then
toggle = false
     LoopAnimation(e)
end
else
toggle = true
end
Been there, done that, got all the T-Shirts!
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 29th Oct 2017 17:39
@AmenMoses. thank you my friend , its woorking perfect .
but if possible can you explain to me why one need the togle flag,
Sorry i ask.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 4GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 29th Oct 2017 17:47
Because without it the call to LoopAnimation (or PlayAnimation) was being called every frame.

Always remember that the code in the _main part is being called every frame so it you want something to happen only once or periodically, on a timer for example, you need to put some logic around it to achieve that.

Been there, done that, got all the T-Shirts!
PM
PCS
8
Years of Service
User Offline
Joined: 7th Jul 2016
Playing:
Posted: 29th Oct 2017 18:10
Ah ok. make sence. thanks again.
Windows 7 Professional 64-bit
Intel(R) Pentium(R) CPU G3260 @ 3.30GHz (2 CPUs), ~3.3GHz RAM 4GB NVIDIA GeForce GT 730
DirectX Version: DirectX 11

Login to post a reply

Server time is: 2024-12-23 00:10:16
Your offset time is: 2024-12-23 00:10:16