Scripts / Multiple Key Scripting??

Author
Message
Go Devils
11
Years of Service
User Offline
Joined: 13th Aug 2012
Location: Phoenix Arizona USA
Posted: 11th Jul 2014 19:53
I’m working on a game in which doors either open (or do not open) based upon having a particular key. The current LUA Door script seems to be limited the one key. How does one script for multiple keys?

I think I understand the activation process, but as I look at the Entity(e) variable categories, there is the “Collected” and “Has Key” variables which are used to indicate that the player has the key needed. How do I get the system to collect a 2nd key, and establish a flag system for that key that will be acted upon when the player arrives at a door with requires this different key?

Thanks
tomjscott
User Banned
Posted: 11th Jul 2014 20:35
You can simply create scripts for your multiple keys and set flags for each of them when the player collects them such as hasKey1, hasKey2, hasKey3, etc. In your door script you just check then if hasKey1 == 1 and hasKey2 == 1 and hasKey3 == 1, etc. I don't have time to write up actual scripts right now, but maybe someone else can do that if you still don't quite understand.

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.0071
Go Devils
11
Years of Service
User Offline
Joined: 13th Aug 2012
Location: Phoenix Arizona USA
Posted: 11th Jul 2014 21:46
Thanks Tomjscott

I think I understand the nature of the script to check for the key flag and then activate the animation if the answer is yes (1). What I do not understand is how I establish the HasKey1, Haskey2, etc variables, and how do I set the flag to these variables as the keys are collected during game play?

I tried following the script for the collection of the main Key, and saw where the collection (col) variable was updated but did not see how or where the haskey variable flag was set.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 11th Jul 2014 21:48
Pretty much as Tomscott said. you simply edit the current script for different keys. here's a video tutorial I did awhile ago.




SPECS: Q6600 CPU. Nvidia 260GTX. 8 Gig Memory. Win 7.
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 11th Jul 2014 22:59 Edited at: 11th Jul 2014 23:25
If I understand correctly you don't want to use multiple keys on one door just different keys for each door so scripting is unnecessary.



Simply change the key name (Key 1,Key 2 etc) and enter the name in the related door 'Use Key' properties, this door will then only open with the named key. You can name your keys whatever you like without messing with scripts.



I believe I saw somewhere that Lee had agreed to reintroduce the 'ifused' field which again will negate any messing around with scripts and simply enter a name for the entity to be triggered, it's the whole purpose of this software is to make it easy.



Why walk a mile when the shortest route from A to B is one simple step.

A funny thing happened on the way to the forum...
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Jul 2014 23:07
what rolfy said, just be clear he's talking about in the right click menu after you have placed the key/door in the editor

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
tomjscott
User Banned
Posted: 11th Jul 2014 23:16
Yeah, it does look like he's just asking for different doors to have different keys. I read his post wrong, I think.

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.0071
Go Devils
11
Years of Service
User Offline
Joined: 13th Aug 2012
Location: Phoenix Arizona USA
Posted: 11th Jul 2014 23:56
OK
I like simple answers I will give it a try and let you know.

Thanks

By the way Rolfy Smugglers Cove is Awsome. Looked for the waves at the store but could not find???
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 12th Jul 2014 00:00
Yeah, my video covers both changing the in game editor use key option, and also making custom scripts for other things such as a key card etc. You don't HAVE to edit the scripts.



SPECS: Q6600 CPU. Nvidia 260GTX. 8 Gig Memory. Win 7.
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 12th Jul 2014 00:21 Edited at: 12th Jul 2014 00:31
Since the OP felt it was scripting question and it's in the script board it is understandable that the simple solution was overlooked



@Go Devils the waves should be available sometime next week in the store

A funny thing happened on the way to the forum...
Scene Commander
Support Manager
16
Years of Service
User Offline
Joined: 3rd May 2008
Location:
Posted: 12th Jul 2014 09:09 Edited at: 12th Jul 2014 09:10
We have a growing series of tutorials on our youtube playlist. You can find one for assigning keys to open doors here



SC

i7-4770s 3.10ghz - Geforce GTX 650ti
shakyshawn8151
10
Years of Service
User Offline
Joined: 9th Nov 2013
Location: United States
Posted: 12th Jul 2014 20:06
just change the name of the key, then on the door put in the ifhas "keyname"

------Dead of Night----- Open World Zombie Horror!!

Youtube/ShakyShawn8151 > 10k Subs Celebration
rolfy
17
Years of Service
User Offline
Joined: 23rd Jun 2006
Location:
Posted: 12th Jul 2014 22:26 Edited at: 12th Jul 2014 22:39
Quote: "just change the name of the key, then on the door put in the ifhas "keyname""
The correct info was already given above so why are you confusing things? If you mean the 'if used' field far as I know this does nothing at this point. The 'if used' field is to activate and run a script command on a named entity.

A funny thing happened on the way to the forum...

Login to post a reply

Server time is: 2024-05-03 15:32:26
Your offset time is: 2024-05-03 15:32:26