grant133
|
  |
| Joined: 06 Jun 2010 |
| Total Posts: 91 |
|
|
| 14 Jun 2017 06:22 PM |
| So I was wondering how games like Theme Park Tycoon 2 or Lumber Tycoon 2 or like Bloxburg make games where the people can place items. I mean I know how to make a tycoon, but how do they do the grid setup and place things following the grid setup? |
|
|
| Report Abuse |
|
|
grant133
|
  |
| Joined: 06 Jun 2010 |
| Total Posts: 91 |
|
|
| 14 Jun 2017 06:23 PM |
| Oops spelled the title wrong. |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2017 06:35 PM |
| I'm a beginner in scripts, so I don't know. What I can say is that they are insane programmers, and I have NO idea whatsoever where they learned those programming skills. Oof. |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2017 06:35 PM |
very easy to do
this doesn't require insane scripting
|
|
|
| Report Abuse |
|
|
TaaRt
|
  |
| Joined: 26 Apr 2009 |
| Total Posts: 5039 |
|
|
| 14 Jun 2017 06:38 PM |
1. choose a grid size
2. obtain current mouse position of player
3. determine where in your grid the position currently is (for instance by taking axis position modulo gridsize and substracting that from the axis position, then dividing that remainder by your grid size)
4. set that grid space as 'currently selected'
|
|
|
| Report Abuse |
|
|
|
| 14 Jun 2017 07:30 PM |
^^ can proabably be done in a few lines of code |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2017 07:44 PM |
| model = game.ReplicatedStorage.Model:Clone() mouse = game.Players:GetMouse() placing = false function PlaceModel() if placing == false then placing = true model.Parent = game.Workspace.CurrentCamera mouse.TargetFilter = model repeat model:MoveTo(mouse.Hit.p) until placing == false model.Parent = game.Workspace end ################################# ## k == "p" then PlaceModel() mouse.KeyDown:connect(function(pk) if pk == "p" then placing = false end end end) end) --That is a simple script. I wrote it pretty quickly so there might be a problem, but I doubt it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Jun 2017 07:47 PM |
Whoops, didn't fully understand what you posted lol. But you just need to add a couple lines to my script that move the model after the mouse moves a certain distance, and when the player is placing an object, the script adds a grid model into the current camera.
|
|
|
| Report Abuse |
|
|