generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Table help

Previous Thread :: Next Thread 
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 09:17 PM
I've confused myself, lol

How would I store two variables in a key in a table:
Minimum spawn level
Max spawn level

So for example, if I have a enemy in a table, I want to define the min/max spawn level in the table too.

enemies = {enemy.Noob (min/max level stuff here), enemy.Noob2 (min/max level stuff here)}

I want to do something like that. It's probably rly simple but I'm tired and too lazy to be smart lol
Report Abuse
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 09:27 PM
b
Report Abuse
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 09:32 PM
b2
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
07 Jul 2017 09:35 PM
local enemies={
enemy.Noob={
Min=1,
Max=2,
},
enemy.Noob2={
Min=3,
Max=4,
}
}
Report Abuse
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 09:42 PM
Oh lol thx
Report Abuse
RBXJared is not online. RBXJared
Joined: 08 Sep 2011
Total Posts: 469
07 Jul 2017 09:43 PM
You would basically create a table inside a table, Its called a Dictionary
Report Abuse
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 09:46 PM
'local enemies={
enemy.Noob={
Min=1,
Max=2,
},
enemy.Noob2={
Min=3,
Max=4,
}
}
'

This errors.
ServerScriptService.WaveManager:4: '}' expected (to close '{' at line 3) near '='
Report Abuse
WillieTehWierdo200 is not online. WillieTehWierdo200
Joined: 13 Aug 2008
Total Posts: 1147
07 Jul 2017 09:49 PM
It's because the keys were bad. This should compile:

local enemies = {
Noob = {
Min = 1,
Max = 2,
},
Noob2 = {
Min = 3,
Max = 4,
}
}
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
07 Jul 2017 09:49 PM
local enemies={
["enemies.Noob"]={
Min=1,
Min=2
},
["enemies.Noob2"]={
Min=3,
Min=4
}
}
Report Abuse
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 09:54 PM
Question:

local waves =
{
wave1 = {Noob = 4};
wave2 = {Noob = 7};
wave3 = {Noob = 10};
}

I have a simple wave script. How would I define Noob as the first enemy?
Typing ef.Noob will cause the table to error.
Report Abuse
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 10:00 PM
bump
Report Abuse
WillieTehWierdo200 is not online. WillieTehWierdo200
Joined: 13 Aug 2008
Total Posts: 1147
07 Jul 2017 10:19 PM
What do you mean, "define Noob as the first enemy?" It looks like you already have the first wave as 4 Noobs?
Report Abuse
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 10:19 PM
'What do you mean, "define Noob as the first enemy?" It looks like you already have the first wave as 4 Noobs?'

Yes, but should I have a "local Noob = ef.Noob" before the table to define them?
Report Abuse
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 10:21 PM
Nvm, would "wave1 = {[ef.Noob] = 4}" work?
Report Abuse
WillieTehWierdo200 is not online. WillieTehWierdo200
Joined: 13 Aug 2008
Total Posts: 1147
07 Jul 2017 10:24 PM
Just iterate through the waves like this to get them in the right order:

local waves =
{
{Noob = 4}, -- first wave
{Noob = 7}, -- second
{Noob = 10} -- third
}

for i=1, #waves do
for enemy, number in pairs(waves[i]) do
print(enemy, number)
end
end
Report Abuse
Negativize is online. Negativize
Joined: 02 May 2011
Total Posts: 25068
07 Jul 2017 10:26 PM
Oh lol, thx
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image