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: How should I make an model have references to objects?

Previous Thread :: Next Thread 
pighead10 is not online. pighead10
Joined: 03 May 2009
Total Posts: 10341
22 Jun 2012 10:32 AM
A user uses a plugin, which tells him to click in as many places as he likes to position the waypoints for a bot to walk to. The bot needs to realise these waypoints so it can walk to them. Storing only the position is not really an option, as users will want to reposition the waypoints.

So the bot needs to have some way of knowing which bricks it has to go to. I could use StringValues and store the name, but then the objects would have to be in the same directory and must not be renamed. ObjectValues fail when the user changes its parent or name in any way. What would be the best method?
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
22 Jun 2012 10:56 AM
Just put a bunch of parts in a model called "Waypoints" in the workspace?
Report Abuse
pighead10 is not online. pighead10
Joined: 03 May 2009
Total Posts: 10341
22 Jun 2012 10:58 AM
Forgot to mention a few points:

-There can be an unlimited amount of bots, so the waypoints will need to be matched to each one individually.
-The waypoints need to be ordered.
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
22 Jun 2012 11:01 AM
You only need the position. If you want to edit the waypoints later, render them using those positions.
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
22 Jun 2012 11:11 AM
A JSON string stored in a script?
Report Abuse
pighead10 is not online. pighead10
Joined: 03 May 2009
Total Posts: 10341
22 Jun 2012 11:20 AM
@popin - but the user needs to reposition them. I could make another button which says "reposition" and make that edit the positions but that isn't really convenient for the user.

@NXT - JSON? *googles*
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
22 Jun 2012 11:30 AM
Actually, it'd probably be better to just generate lua code:

Saving:

    local listOfWaypoints = {...} --vector3s

    local generatedSource = ""
    for _, vector in ipairs(listOfWaypoints) do
        if _ ~= 1 then generatedSource = generatedSource + ',\n' end
        generatedSource += ("\tVector3.new(%f, %f, %f)"):format(v.x, v.y, v.z)
    end

    workspace.SomeBot.Waypoints.Source = "_G[script] = {\n"..generatedSource.."\n}\n"

Using in game:

    print _G[workspace.SomeBot.Waypoints]

Loading from the plugin:

    loadstring(workspace.SomeBot.Waypoints.Source)();
    print _G[workspace.SomeBot.Waypoints]
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
22 Jun 2012 11:31 AM
Ok, so I wrote some of that as javascript. String concatenation is `..`, not `+`...
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
22 Jun 2012 12:36 PM
[ Content Deleted ]
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
22 Jun 2012 12:44 PM
Ololol do it oysi style! Make so it makes grid like valve does. Make so it puts way points after 2 studs diognaly.
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
22 Jun 2012 02:03 PM
@zars

You only need the positions when saving the waypoints, what do you not understand about that? When it comes time for user interaction, you render them and reference each waypoint from a table in your script.

omfgyusodothis
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
22 Jun 2012 02:48 PM
That's what i meant. Each time it will create table with checkerboard pattern positions.
Report Abuse
pighead10 is not online. pighead10
Joined: 03 May 2009
Total Posts: 10341
22 Jun 2012 04:40 PM
"You only need the positions when saving the waypoints, what do you not understand about that? When it comes time for user interaction, you render them and reference each waypoint from a table in your script.
"

What way which would be convenient for the user do you suggest I do this in?!
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
22 Jun 2012 07:15 PM
You start rendering at startup, and save the positions per change.
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
22 Jun 2012 08:33 PM
@pig
this is what popin is saying i think

1) user clicks to place waypoints
2) user wants to reposition waypoints. press reposition button and make waypoints visible
3) user clicks waypoint, then clicks again to move it
4) repeat 3 until done repositioning. then click "save" button or something.
Report Abuse
pighead10 is not online. pighead10
Joined: 03 May 2009
Total Posts: 10341
23 Jun 2012 04:25 AM
"I could make another button which says "reposition" and make that edit the positions but that isn't really convenient for the user."

No one reads my posts?
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
23 Jun 2012 10:38 AM
WHY DID THIS QUESTION NEED BE ASKED? WHAT SORT OF MENTAL DEFICIENCY DO YOU HAVE?
Report Abuse
pighead10 is not online. pighead10
Joined: 03 May 2009
Total Posts: 10341
23 Jun 2012 10:50 AM
The question needed to be asked because I couldn't think of a better way than the ones I had suggested. Apparently neither can anyone here, because scripters are sticking to the stereotype of "efficiency > user convenience", which sort of beats the purpose of my plugin... :)
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
23 Jun 2012 01:40 PM
@pighead

OMFG WHAT DO YOU NOT UNDERSTAND ABOUT SAVING POSITION--- YOU KNOW WHAT, SINCE YOU OBVIOUSLY HAVEN'T LEARNED ANYTHING THROUGH YEARS OF SCRIPTING I SUGGEST YOU ACTUALLY TRY FROM NOW ON.

*hits pighead over the head with a cast iron frying pan*
Report Abuse
pighead10 is not online. pighead10
Joined: 03 May 2009
Total Posts: 10341
23 Jun 2012 01:46 PM
*engages in lightsaber/cast iron frying pan war*

what do you not understand about my scenario. Yes, I can save position but then to edit the position while still being convenient to the user...
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
23 Jun 2012 02:40 PM
You are writing the code that changes the actual position of the "node." Seriously, you can dynamically save the content as it changes.

1. Render nodes based on position
2. Save node position when changed

WHAT DO YOU NOT UNDERSTAND ABOUT THAT?! IT'S PERFECTLY [expletive] TRANSPARENT AND REQUIRES NO USER INTERACTION!!!
Report Abuse
pighead10 is not online. pighead10
Joined: 03 May 2009
Total Posts: 10341
23 Jun 2012 03:07 PM
and how do I detect when they have been changed!
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