| |
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 29 Jul 2016 02:49 PM |
It doesn't work because you gave me no information and apparently can't edit the what I've given you. :\ I have no idea where these NPCs are stored.
Tell your friend to make a post and I'll get to it.
|
|
|
| Report Abuse |
|
|
|
| 29 Jul 2016 02:54 PM |
| @Soy its been awhile for me (using modules,) so I'll ask you... How you would run AI off one server module, in FE of course. What is the best way to do this, and most efficient. (I have the AI code, just how would I run it for all the AI, including die events etc...) |
|
|
| Report Abuse |
|
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 29 Jul 2016 02:59 PM |
In the ServerScriptService, I'd have one sensory script that gathers data about each of the AI, like position, proximity to players, etc, then if you're set on the idea of using a module script to house the meat of your AI, use the sensory script to send the data it collects as arguments to your numerous functions in the module script.
|
|
|
| Report Abuse |
|
|
|
| 29 Jul 2016 03:00 PM |
| Example? Its been so long, that i'm just plain lost... |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 29 Jul 2016 03:21 PM |
Like, have your AI as a little robot dude in the workspace, then have your script collect data at intervals you specify.
ActiveRobots = {} serialStep = 1
function CreateAI(pos) -- robots are people too you know! robot = game.ReplicatedStorage.BlankRobot:clone() robot.Name = "Robot"..serialStep serialStep = serialStep+1 robot.Parent = workspace robot.Torso.CFrame = pos table.insert(ActiveRobots,{{robot.Name},{100},{pos},{Mode}} -- those data can be anything you want to know end
CreateAI(CFrame.new(0,0,0)) -- spawn them where you want by calling this
local Tick05 = coroutine.wrap(function() while wait(.5) do for i,v in pairs(ActiveRobots) do local robot = game.Workspace:FindFirstChild(v[1]) -- check to see if the robot is dead, if so, remove it from the table and skip the rest v[2] = robot.Humanoid.Health v[3] = robot.Torso.CFrame v[4] = -- here you can toggle if the robotis chasing someone or not, loop through workspace and get magnitude of all players, if so, spawn a chase function or run one from your module script. -- infinitely write data to the table we made in the first line for each robot, then either spawn functions to get them to do stuff, or require them from your module script] -- IMO spawn instead ;) end end end)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Jul 2016 04:58 PM |
@Soy so i'm using (below,) so how would I make that into what your saying..?
#Code: (Inside a server script, inside the AI unit)
while wait() do for i,v in pairs(game.Players:GetChildren()) do if v.Character ~= nil and v.Character:FindFirstChild('Torso') ~= nil then if (v.Character.Torso.Position - script.Parent.Torso.Position).Magnitude <= 10 then script.Parent.Humanoid:MoveTo(v.Character.Torso.Position) end end end end
|
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 29 Jul 2016 04:59 PM |
@Soybeen what happened, are you running the scripters forum now
where'd everyone go |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 29 Jul 2016 05:00 PM |
@Lua I don't understand why you find it so difficult to grasp the concept of FE. If you want something replicated: run it off the server, if you don't: run it off the client. It's that simple.
|
|
|
| Report Abuse |
|
|
| |
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 29 Jul 2016 05:33 PM |
I thought it was called a forum
Formerly ToxicDominator - add 17,509 posts |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 29 Jul 2016 06:59 PM |
@Lua Well that's not really what I had in mind when you said AI, mine was actually the foundation for making an AI that is set to scan its self and surroundings and then if a "threshold" stimuli or some other conditional is met, then it would send that data as an argument to a function in your module script and/or spawn a function inside of the same script. The code you posted just makes it search the surroundings for a nearby player, which could be one of your functions. Make that into a function named Aggro or something that takes the name of the player as an argument, and put the bit that scans for nearby players in the Data collection section, as the 3rd element of the Robot's array (Data3). If the magnitude is less than 10, spawn the Aggro function with the player as the argument.
@Aethex Idk I don't run things I'm just very active and I'm learning more every day, lots of people still contribute like cntkillme, Vince, Casualist, Kodran, Jarod, Warspy, WoolHat, etc
|
|
|
| Report Abuse |
|
|
|
| 29 Jul 2016 09:45 PM |
| @Time LOL, I understand FE and I use it all the time... |
|
|
| Report Abuse |
|
|