Scripts / check point with gate access?

Author
Message
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 15th Jun 2014 23:50 Edited at: 16th Jun 2014 00:08
Is it possible to write a script where a player is prompted, for clearance, if yes, press E then a gate would open?



Ive managed to create my very first Lua script but it is only prompts.





[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
AuShadow
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 16th Jun 2014 11:22
Just somethibg i noticed. The destroy(e) will destroy the zone and the script so anything after that will not run.

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
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 16th Jun 2014 11:23 Edited at: 16th Jun 2014 11:25
you need to set some delays alongside the E presses otherwise it'll skip through much too fast and remove the first destroy(e)



untested but something like this





edit actually this is a zone

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: 16th Jun 2014 12:58
What i ultimately did was to use the script, for the zone, used the doornokey script and removed the text prompt from it and increased the distance for the gate to open. It works but I thought it would be better to have it all in one script.

here is my edited script for examination/improvement. The delays are good in this but I dont know how to add the function to open the gate directly to the script.
Also, the prompt only appears once. if I move to that station and then walk away with out pressing E, it wont appear again.



[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 16th Jun 2014 14:42
why r u using a zone rather than apply the prompts onto the door script? and you will still need 2 scripts if you do it this way because you need to get the e value for the door/gate (unless you want to find the e number of the gate manually)


would this not be better?
apply it directly to the door/gate



if not i will show you how to link multiple scripts

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: 16th Jun 2014 14:51
I'll give it a go when I get home and see what it does. I honestly don't know anything about writing scripts and that's why I used the Zone.

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
AuShadow
GameGuru TGC Backer
10
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 16th Jun 2014 15:57
I have to agree with smallg here for what you want to do its not a zone you want to have the script on but the gate itself

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
Imchasinyou
10
Years of Service
User Offline
Joined: 22nd Mar 2014
Location: OH
Posted: 16th Jun 2014 19:04
Ok, here is how it's set up. I'll let you guys help me here if you like. When the player reaches a desk, that's when the prompt occurs. The desk is in a landing with stairs up to it and then up to the top floor. I've blocked the top floor so that you MUST press E to continue. If a screenshot would help, I can do that later after work.

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 16th Jun 2014 20:31
so the prompt and the door arent in the same place? ok

easiest way is to lock the door and make the character pick up the "key" at the desk (in this case i assume it's a computer screen or a person asking that triggers the prompt?)

so you would set a key at the desk with this script (dont worry the key is invisible - but rename it in the right click menu)
continue.lua


now set the door that is blocking you and change the "use key" field to whatever you named the key

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: 16th Jun 2014 20:46
See, I didn't even have a key. I has the door set to doornokey. Lua and removed the prompt to open the door with E.

My thinking was that the player approaches the desk that will have a character one day. The prompt comes up asking for clearance. Basically different way of activating the gate with out being told to press E to open the gate. I guess the door no key could have all that in it but I was slightly confused as how to set in another prompt. I'll make a video of it in action and post it and you can advise me more! Feel free to friend me on Steam if you use it.

Gen - Imchasinyou

[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: 16th Jun 2014 23:55 Edited at: 16th Jun 2014 23:57
When you walk up the first flight of stairs, there will be a landing with a security desk. As you near the desk, the prompt comes up asking if the player has the correct clearance. Upon the Prompt to press E for acknowledgment, the gate opens (doornokey.lua) and the next prompt appears saying proceed with caution. If you can make my script open the gate with the pressing of E in the acknowledgment line, it would actually accomplish what i was doing with the zone. Here is the script Im using currently.



If image does not appear, paste into browser.

[img]http://files.enjin.com/191696/FPSC-R/Script Process.bmp[/img]

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Jun 2014 00:21
did u get this working in the end?

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: 20th Jun 2014 01:55
I gave up sadly, the more I try, the worse I make it and eventually break the script. Ill have to go back and do it again and see if I can get it to work by just using doornokey.lua and the prompt script above.

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Jun 2014 10:35 Edited at: 20th Jun 2014 10:36
i will write something for u now i understand u need them in seperate areas but have a few questions



does the gate need to shut again?

if so, when? (when the player reenters the prompt area? or when he passes the gate?)

would the gate need to reopen once more if it did shut?

is there an item that currently gives "clearance" you would like to also include in the prompt check?



as i said before there is no easy way you can do it from 1 script alone but it's possible to do almost all of it from the prompt (depending on your answers about the gate shutting at least)

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: 20th Jun 2014 12:53
The gate dont need to close after the player passes but would be neat. I think if I just use it as it is, it would be just fine. I guess by setting 2 scripts. One "doornokey" on the door increasing the range and remove the prompt for the door and then the other script that asks for the clearance and prompts the player to press E to proceed.

I havnt tried to do anything as of late as Ive been kinda busy.

[img]http://files.enjin.com/191696/UA Members Banners/Imchasinyou.jpg[/img]
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 20th Jun 2014 17:43
well i made it work using 3 scripts, definitely not the 1 you were aiming for but if you dont want the door to close you can ignore the 3rd

the main issue i found is that you can't control a specific entity's animation (there's no e value in the command) therefore i couldnt make the door animate directly from the prompt (desk) so it was easier just to make the door code much smaller and make it open as soon as u press E for the clearance.

so u apply this to the zone at the desk
continue.lua


this to the door


and if u want the door to close set this to a trigger zone behind the door (it will also let you back out again currently - wasnt sure if you wanted that or not)


if you dont want to get back out (i.e. door will remain closed just remove the line clearance = 1

not really much better than doing it the normal way but it should help improve the distance checks

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: 20th Jun 2014 18:00
I'll have a look soon as I get home.

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

Login to post a reply

Server time is: 2024-10-18 08:14:27
Your offset time is: 2024-10-18 08:14:27