Product Chat / Random Item spawning, Key renaming and Level Objectives Script

Author
Message
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 11th Jun 2016 01:40
Hey I got a bunch of questions again and I don't want to spam the form, so i'm gonna do it in one post:

Is it possible to let a Key spawn randomly in certain areas?

Is it possible to rename Keys, so that I collect a rusty Key for example instead of just a "key" ?

And, are there scripts wich enable Objectives like, collect 5 Notes, or activate the switch ?

If you Guys would tell me the exact way how to do it... that would be awesome
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 11th Jun 2016 10:02
Quote: "Is it possible to let a Key spawn randomly in certain areas?"

I want to have clear about your idea, so I'm goin to mention 2 possible options:

Option 1
You've 3 keys, and you want whatever spawning let's say, over a table. (can o be key1, or key2, or key3)

Option2
You've 1 key, and you want this key spawning randomly over a table, or over a bed, or over a crate.

Just say option1 or option2, or not one.

Quote: "Is it possible to rename Keys, so that I collect a rusty Key for example instead of just a "key" ?"

Yes, do it via item properties panel.

Quote: "And, are there scripts wich enable Objectives like, collect 5 Notes, or activate the switch ? "


Ignore your script skils, anyway I'm going to link you to the script library: https://forum.game-guru.com/thread/207801

Take at look "Quest" section, even "Misc", there you can find useful scripts like "kill x enemies to open door", just change it for "collect x notes to open door", even you has script about notes, than can be useful 4 you as guidelines.

If you need some more help about, please post here, and someone might help, even me.

3com



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

PM
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 11th Jun 2016 10:33
Hi Thanks for your post, here the answers:

Q1= Option 2

Q2= I have tried that. The Name did not change in the game....

Q3= Okay I will look around and try it

Thank you !
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 11th Jun 2016 19:22
Q1
The easiest way for you, is as follow:
1- I've attached script below, to a most used item in GG (a barrel).
2- I've placed 1 table, 2 boxes to set the positions in the video.
3- I've place 3 wooden pallets (item intended to be spawned radomly), in a different position each one.
SpawnAtStart = no, via properties panel, for each one.
4- All 3 woodden pallets are consecutive numbers, in my case they are: 5,6,7

script - attach to you trigger item.



In action



Q2
Did you tried via fpe file?

hth

3com
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

PM
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 11th Jun 2016 21:03
Thank you very much, i'm gonna try this
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 14th Jun 2016 14:46 Edited at: 14th Jun 2016 14:49
Duchenkuke said in Youtube
Quote: "so I made a trigger zone with the script you gave me in the forum. placed 3 keys, named them 5,6 and 7.
tested it, and no key spawned... what did i do wrong? I want to have the keys spawned on different places evertime the game is started. My Name in th e Forums is Duchenkuke btw "


I prefer answer here instead of yt.

Quote: "placed 3 keys, named them 5,6 and 7."


5,6,7 are not the item name, but the item number, mouseover item and you can see at bottom of the screen, the number of the entity. Looks like "5{70005}", without quotes.

I stay a bit in the video when this comes, looking for you has time to notice it, please re-look video again.

So if your items are different number than 5,6, or 7; perhaps thats the issue.

3com
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

PM
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 15th Jun 2016 08:39
Ah okay ! Thanks 3com, i will try it again.
@bod, looks interesting, I will look it up
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 15th Jun 2016 08:59
Okay so the Item number of one key is [629 {70629} ] 5
The Name of the Key in properties is 5.
thats why it it's 5 at the end i guess.

SO renaming the Key was wrong? should i name them key1, key2, key3 or something like that?
How can I make the door to recognize all of them?
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 15th Jun 2016 09:03
Okay so the Item number of one key is [629 {70629} ] 5
The Name of the Key in properties is 5.
thats why it it's 5 at the end i guess.

SO renaming the Key was wrong? should i name them key1, key2, key3 or something like that?
How can I make the door to recognize all of them?

Bod, good Video ! pretty cool
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 15th Jun 2016 16:24
Firts at all forguet item name, we are going to work with item numbers (ids), and does ot matter what's the name is.

When you place an item in a map, GG automatically assign some number to the item (usually has to do with the order the item was placed); so the firts one is the number 1, the second is the number 2, and so on.

Please notice arrow plus rectangle in the pic below.



You can notice the jetpack being the item number 6 (6{70006}), so if your key is let's say, number 2 and 3 and 4, so you has to change this line in script below: notice here - 6{70006} - number 6 being the firts number, out of the brakets.

number = math.random( 5, 7 ) -- for me entities number are: 5, 6, 7

This line should looks like:

number = math.random( 2, 4 ) -- since your keys numbers are: 2, 3, and 4.

Here you want 1 key being spawned in random position .
So, instead of work with 3 differents positions for 1 key, we are going to work with 3 keys, each one place in a different position in the map. I do considered this way as the easier for you.

So, each time you run the script, you will spawn a ramdom key, so you'll get you goal, with different approach.

1- place 3 key in different position each one, in your map.
2- attach the script to your trigger - as explain above.
3- Make all keys, " SpawnAtStart = no", for each one. via properties panel.

run your level, and enjoy.

3com





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

PM

Login to post a reply

Server time is: 2024-06-26 08:44:59
Your offset time is: 2024-06-26 08:44:59