Scripts / Creating a story with several prompt commands

Author
Message
VRGames
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: The Netherlands
Posted: 10th Jun 2014 23:19
Is it possible to create a short story with several prompt commands?? I was trying with if g_KeyPressE but getting a global LUA error (nil error)??;


-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- prompts

function story_main(e)
PlayerDX = g_Entity[e]['x'] - g_PlayerPosX;
PlayerDY = g_Entity[e]['y'] - g_PlayerPosY;
PlayerDZ = g_Entity[e]['z'] - g_PlayerPosZ;
PlayerDist = math.sqrt(math.abs(PlayerDX*PlayerDX)+math.abs(PlayerDY*PlayerDY)+math.abs(PlayerDZ*PlayerDZ));

if PlayerDist < 80 then
Prompt("text1");
keypress?
Prompt("text2");
keypress?
Prompt("text3");
end
end
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Jun 2014 23:45


just continue adding if statements (while increasing the multiplier by 1) if you want more lines (or remove them if you need less)

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
VRGames
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: The Netherlands
Posted: 10th Jun 2014 23:59
Oke thanks for your help, I will try it out and give feedback.

Greetings
PM
AuShadow
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 11th Jun 2014 14:51
Or it could be set to work on key press E if you wanted the user to press e before the story moves on. I may look into this tonight or tomorrow if that's what you wanted

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz

Feel free to visit and edit the public FPSCR resource wiki page: http://fpscrresource.wikispaces.com/home
VRGames
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: The Netherlands
Posted: 11th Jun 2014 22:23
Thanks, if you want, I can choose from different story scripts.

Greetings
PM
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 12th Jun 2014 04:43 Edited at: 12th Jun 2014 05:30
Do we have the ability to move the position of the text yet? Should be pretty simple.



Here is how I do it in my Black Ops modded server, albeit, its a different language


[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
Slaur3n
GameGuru TGC Backer
16
Years of Service
User Offline
Joined: 16th Sep 2008
Location: Norway
Posted: 13th Jun 2014 01:32
smallg`s script didnt work for me
tomjscott
User Banned
Posted: 13th Jun 2014 01:55 Edited at: 13th Jun 2014 01:58
Quote: "smallg`s script didnt work for me "




You might want to use the StartTimer and GetTimer functions as they would make the code a bit simpler and not too difficult to make work. Just use StartTimer to get the ball rolling and then GetTimer to see if the required time has elapsed. This is not a full script, but just the basic idea:







The timer checks for 1000, 2000, 3000, etc. are in milliseconds so each one is a one second interval. Adjust according to your needs.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.007
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 13th Jun 2014 03:07
Works beautifully for me but I need to know how to prompt with "Press E to continue" instead of a timer. I think its much more suitable at this stage of the development and you dont have to worry about some one getting frustrated by waiting. . . .

I say prompt with E because thats all we are allowed to use so far for what ever reason! I also need to get the messages used into the center of the stupid screen! Thats possibly not that hard but again, limited!

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
tomjscott
User Banned
Posted: 13th Jun 2014 03:15
@Imchasinyou, there is no way to move the text at this point. Sorry about that. I tried a few things to see if long text strings would wrap around or if it would obey new line characters, but no go. I think you could do scrolling text from right to left w
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 13th Jun 2014 03:23
Wow, thx tom! If you feel so inclined, try the text scroll

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
tomjscott
User Banned
Posted: 13th Jun 2014 03:35
Here you go.



System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.007
tomjscott
User Banned
Posted: 13th Jun 2014 03:37
Quote: " If you feel so inclined, try the text scroll"


I would, but I need to get back to work on my comp entry. Still lots of work to be done.

System Specs: OS - Windows 7 Home Premium 64-bit SP1, CPU - AMD Phenom II X4 945, 3.0Ghz, RAM - 8Gb DDR3, GFX Card - 2048MB NVIDIA GeForce GT 640, FPSC-R Version - Beta 1.007
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 13th Jun 2014 03:59
no worries Tom. I appreciate that effort! Do well in the comp. . . .

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 14th Jun 2014 18:59
So, with this, I have added the pick up part to the script. How ever, i cant figure out how to make the last bit of text remain a little longer. 4 seconds. Ive tried so many things, I think Ive confused myself several times.

Idea: Player finds item (key in this case) is prompted that they have found it, then told to pick it up by pressing E. The item is collected (key) and can be then used on a locked door in the map that would allow them to progress further. Id like the last bit of text to remain longer than the prompting text.



[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
Avram
GameGuru TGC Backer
18
Years of Service
User Offline
Joined: 3rd Sep 2006
Location: Serbia
Posted: 14th Jun 2014 19:23
I think the text disappears the moment the entity gets destroyed (not sure). You should probably hide it and disable collision, then work out how to display the text a bit longer (for example with a timer) and when timer expires you should destroy the entity (which should hide the text )

Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 14th Jun 2014 19:39
So. . . . . I have No clue what to do with this information as of yet

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Jun 2014 20:18 Edited at: 14th Jun 2014 20:18
so long as what you had before works (pre- destroy) this should do it





life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 14th Jun 2014 20:40
Unfortunately, no. Its the same. Im imagining a second timer function for that final message but cant seem to figure that out either.

Yes, I know its bad to be this poor at Lua

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Jun 2014 21:57
haha no it actually took me quite a while to figure this out because i was thinking the timer would reset before it checked the final timepassed but it wasnt.

anyway here is a working version


life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 14th Jun 2014 22:33
You sir, are beyond excellent! Thank you for fixing what i didnt even know what to do with. One way to learn I recon. Try, try again, then try again, cry a little, get mad and develop a major head ache, then ask for help!

Great job!

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM

Login to post a reply

Server time is: 2024-12-22 05:02:20
Your offset time is: 2024-12-22 05:02:20