This is pretty interesting, but I don’t see myself using it anytime soon.
Self-aware AI means conscious & sentient intelligence. As of now, this ability is only reserved to humans.
This script isn’t self-aware, nor is it AI. It can’t do anything than fulfilling the existing tasks. Want to describe something in the environment that’s not covered by the if-statements (while perceived by the ‘senses’ of the NPC)? This script can’t.
Did you know that monkeys can be self aware they pass the test.
Well, that’s an insane amount of if statements and variable declarations to a point that practically nobody will ever bother to read the code. Can’t judge because I aint reading that pain.
To be self aware an AI must be aware of its surroundings. You show me your AI project and how it works then you let me know what you think of this module. Because I think it’s funny how you know nothing yet decide to tout your opinion this is literally the type of string constructing algorithm to describe to a large language model what it sees. I would like to reiterate I do not care for your negative opinions, you are likely clueless and do not really know what you are talking about.
My responses coming off condescending because the only ones who decided to say anything where the negative people and they are not even making good arguments. Research the topic and provide informed input. This is how you would send surroundings information to an AI model. You can ask it to find a point of interest from the surroundings and make decisions based on that. My chatbot has the abilities to perform action commands from strings. So I could interpret the output to make the AI chatbot self aware by giving it the ability to make autonomous decisions based on its environment.
For example perhaps the AI decides to pick up an apple on the ground because it has some arbitrary hunger or thirst stat. The AIs decisions could also be influenced by survival and input from its surroundings. This is not a common implementation of a large language model but it would be very interesting to give the AI human goals. Like what literal universities have published on Automonous agents.This script is a strong concept for other developers as it provides a structured way to construct a description of the chatbots surroundings.
You could use raycasting and project a ray from only the front of the AI if you wish to only get what it would see in front of it.
For example if you were making a AI character who was a reactive NPC that made dialogue. You could send a message to the model describing the surroundings. Then the model can respond to that input of the world with their character like in that youtube video but within the confines of ROBLOX studio.
self-a·ware·ness
[ˌselfəˈwernəs]
NOUN
- conscious knowledge of one’s own character, feelings, motives, and desires:
“the process can be painful but it leads to greater self-awareness”
Also, I updated the code I shared to not include the NPC description algorithm because it is too lengthy and tailored to my custom NPC combat algorithm
But I will post it here just because.
function aware.DescribeNPC(Char)
local MagicID=Char:FindFirstChild("MagicID")
if MagicID~=nil then
local fly=""
local Aggression=""
local AttackVector=""
local Barrier=""
local Buffs=""
local BaseHealth=""
local BaseMagicDMG=""
local BaseRangeDMG=""
local BaseMeleeDMG=""
local CanBeFrozen=""
local ChangeStyles=""
local Cooldown=""
local Cost=""
local CostMax=""
local Cure=""
local Description=""
local Dodge=""
local Element=""
local Element2=""
local Element3=""
local Hide=""
local Level=""
local MainStyle=""
local Multiply=""
local Paralyze=""
local Poison=""
local Power=""
local Prayer=""
local ProtectFromStyle=""
local Recoil=""
local Range=""
local Parasite=""
local Species=""
local Teleport=""
local Transform=""
local Weakness=""
local rating=0
--construct a long combined string of the above local strings.
if MagicID:GetAttribute("Aggression")==1 then
Aggression="aggressive, "
rating=rating+1
end
if MagicID:GetAttribute("Fly")==true then
fly="can Fly, "
rating=rating+1
end
if MagicID:GetAttribute("Barrier")==true then
Barrier="uses Barrier, "
rating=rating+1
end
if MagicID:GetAttribute("Buffs")==true then
Buffs="uses Buffs, "
rating=rating+1
end
if MagicID:GetAttribute("Multiply")==true then
Buffs="uses Multiply, "
rating=rating+1
end
if MagicID:GetAttribute("ChangeStyle")==true then
ChangeStyles="melee and magic user, "
rating=rating+1
BaseMagicDMG="base Magic damage is"..tostring(MagicID:GetAttribute("BaseMagicDMG"))..", "
BaseMagicDMG="base Melee damage is"..tostring(MagicID:GetAttribute("BaseMeleeDMG"))..", "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="melee range is"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
elseif MagicID:GetAttribute("ChangeStyle")==false then
if MagicID:GetAttribute("MainStyles")~=nil then
if MagicID:GetAttribute("MainStyles")==1 then
MainStyle="uses Melee only, "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="melee range:"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
elseif MagicID:GetAttribute("MainStyles")==2 then
MainStyle="uses Magic only, "
elseif MagicID:GetAttribute("MainStyles")==3 then
MainStyle="uses Range only, "
end
end
end
if MagicID:GetAttribute("BaseHealth")~=nil then
local hpr=Char.Humanoid.MaxHealth/100
rating=rating+hpr
BaseHealth="base health "..tostring(MagicID:GetAttribute("BaseHealth"))..", "
end
--write code to complete above context
if MagicID:GetAttribute("CanBeFrozen")==false then
CanBeFrozen="cannot be frozen, "
rating=rating+1
end
if MagicID:GetAttribute("Cooldown")~=nil then
Cooldown="it's cooldown is "..tostring(MagicID:GetAttribute("Cooldown"))..", "
rating=rating+(5-MagicID:GetAttribute("Cooldown"))
end
if MagicID:GetAttribute("Cost")~=nil then
Cost="it's action cost is "..tostring(MagicID:GetAttribute("Cost"))..", "
rating=rating+1
end
if MagicID:GetAttribute("CostMax")~=nil then
CostMax="It's max power is"..tostring(MagicID:GetAttribute("CostMax"))..", "
end
if MagicID:GetAttribute("Cure")==true then
Cure="can Heal, "
rating=rating+1
end
if MagicID:GetAttribute("Description")~=nil then
Description=MagicID:GetAttribute("Description")..""
end
if MagicID:GetAttribute("Dodge")==true then
Dodge="can Dodge, "
rating=rating+1
end
if MagicID:GetAttribute("Teleport")==true then
Teleport="can Teleport, "
rating=rating+1
end
if MagicID:GetAttribute("Transform")==true then
Transform="can Transform, "
rating=rating+1
end
if MagicID:GetAttribute("Element")~=nil and MagicID:GetAttribute("Element")~="" then
Element="uses "..MagicID:GetAttribute("Element")
rating=rating+1
if MagicID:GetAttribute("Element2")~="" and MagicID:GetAttribute("Element2")~=nil then
Element2=","..MagicID:GetAttribute("Element2")
rating=rating+1
end
if MagicID:GetAttribute("Element3")~="" and MagicID:GetAttribute("Element2")~=nil then
Element3="and "..MagicID:GetAttribute("Element3")
rating=rating+1
end
end
if MagicID:GetAttribute("Parasite")==true then
Parasite=", it's parasitic"
rating=rating+1
end
if MagicID:GetAttribute("Poison")==true then
Poison=", it's poisonous"
rating=rating+1
end
if MagicID:GetAttribute("Prayer")==true then
Prayer="uses Prayers"
rating=rating+1
elseif MagicID:GetAttribute("ProtectFromStyle")==1 then
rating=rating+1
ProtectFromStyle=", strong against Melee"
elseif MagicID:GetAttribute("ProtectFromStyle")==2 then
rating=rating+1
ProtectFromStyle=", strong against Magic"
elseif MagicID:GetAttribute("ProtectFromStyle")==3 then
rating=rating+1
ProtectFromStyle=", strong against Range"
end
--Power="Power Multiplier:" MagicID:GetAttribute("Power")
--Range=""
if MagicID:GetAttribute("Recoil")==true then
rating=rating+1
Recoil="hurts to touch, "
end
rating=rating+tonumber(Level)
--write rest of code for above context
return Description..Element..Element2..
Element3.." magic. It's "..Level.." "..ChangeStyles..MainStyle..Cooldown..fly..Aggression..Barrier..Buffs..BaseHealth..
BaseMagicDMG..BaseRangeDMG..BaseMeleeDMG..AttackVector..CanBeFrozen..
Cost..CostMax..Cure..Dodge..
Hide..Multiply..Paralyze..Poison..Power..
Prayer..ProtectFromStyle..".",aware.judgepower(rating,25)
else return "",nil
end
end
This topic is related to my main topic! Which has a module that you can input search queries based on a database.
For example if you are looking for an Apple. You can search a list of strings and return a string describing an Apple.
This is a part of a multi-model AI-chatbot Agent I’m working on. When it’s done I will be releasing some sort of open-source version that has a simple framework to work from for other developers.
I have recently released a new ChatModule which is the most recent version of the main algorithms that powers the bots ability to compare input robustly with a database of strings and provide output. It also can solve basic geometry for example “What is the circumference of a circle with a radius of 4?” and worded algebra problems “If I have 4 groups of 5 how many do I have in total?” output= “4*5=20”.
The way it’s designed is to answer questions with the chatbot using my specific database for my games lore and hints when it can. Then, if it does not know the answer it gets the answer from a variety of APIs including wikipedia, How to wiki, conversational AIs that think they are the input personality, and GPT2. It uses zero-shot classification to determine which model to use. It saved all of the data it recieves from the AIs and APIs for that database or specific character. I’m also incorporating more APIs and premium AI models in the future. It’s important to have levels to things like this. It can be visualized like this Chatbot determines the intent based on rules and algorithms if conditions are met then->zero-shot-classification AI to determine the inputs intent->APICall to AI Model or wiki.
Premium architecture would be just be Chatbot Input if any->APICall to AI with specified character and context with user query
Artificially Intelligent Chatbot LUAU Algorithm [Open Source] - Resources / Community Resources - Developer Forum | Roblox
-
It’s not “Self Aware”, it’s only capable of what it’s allowed to do, true sentience is impossible, you can only simulate it
-
You literally said it’s an AI
I like the idea. However, it is a bit messy.
Why is everyone mad?
OP did make a self aware AI but not in the way that pleases your definition of what it means to be self aware.
Make this simple for yourselves and avoid explaining your definition of the word AI, as I’m very sure OP meant to call it NPC. It’s just a small miss direction. Honest mistakes can be made.
This is part of my AI project. Which includes artificial intelligence models. If you have a AI that has no information about its surroundings then it cannot make relevant observations of its surroundings.
This algorithm creates artificial data to give AI context about its surroundings. If you were involved in working with Language Models this concept is easy to grasp and quite important within the restrictions of ROBLOx’s coding environment.
I’ll take ur words for it.
I’d like to suggest that it may seem better to add an API example and write a showcase for others to glance at. It may help them avoid looking at your work and discard it like the people above.
(post deleted by author)
Self-aware can be defined as a character that can think by itself, interact with its surroundings by itself, react or express emotions. All I see in your code is just what you limited it to do. You cannot train it, it is not self aware, and less an AI.
That aside, this is one of the most unformatted and ridiculous code I’ve seen in all of DevForum. Even worse - it looks like that most of this was written by ChatGPT. The source code is straight up unreadable, let alone anyone being able to do anything with it.
Unnecessary functions, unnecessary variable definitions, insane amount of if statements that could’ve been simplified in other methods. Instead of using functions for actual uses you still went with the copy-paste method. Half of your code has ChatGPT comments, the rest is straight up Ctrl+C Ctrl+V. We can do better, let’s say:
- First, there’s zero need to define insane amounts of variables at the start, just use a table for it. The benefit of using tables is that we can also loop through them, so we don’t create a clutter in the code.
- Then, you don’t need to define say
local element3629
in the start. Just declare it when it exists. Simple! - I’m also not sure why you’re using Attributes. Just place all of this in the code. Plus, there’s no need to define your values as “value x is y”, why do you need that??? Like, instead of
value = "cannot heal"
you’re just wasting a Variable becausecanHeal = false
already implies that the character cannot heal. - Also I’m very sure
Vector3.magnitude
does not exist. It’sMagnitude
. Did you even test this?
All it does is check for distances, instances, orientation and objects near it. You cannot call this “self aware”. This is ridiculous. I remind you, AI has the ability to learn by itself, hence why artificial intelligence. We living beings are able to think and process what we perceive, and so does AI, since it’s also an intelligence, albeit not natural. If it can’t learn and put it to use - it’s not AI.
That’s a bit derailed from what I suggested, I’m partly to blame here lol since I called it API.
What I mean is a code example that uses your module in a showcase format. It would be nice to list all the functions one would use in the module. Just to help give an idea to those who come across your work.
But you have said that this is a work in progress, so it’s fair.
Try saying:
This could be better if you do X,Y,Z
Instead of saying:
This is bad because you suck lol
Here’s the comment where he tells us it’s an algorithm-based approach: Creating Self Aware AI: "Describing surroundings" (Open Source) - #4 by Magus_ArtStudios
I guess you guys don’t like being misled which is fair but it didn’t have to go down that road.
A bit unfortunate that you had to experience these horrible responses but I commend you for sharing your work.
Your title labels your project as “Self-Aware AI”. Then you instantly said “It’s not an AI but an algorithm.”
Now we’re here? Do you even know what you’re doing? Do you even have the minimal knowledge in AI?
This post defines it all.
Consider reading this again and label your product accordingly.
If I were to even consider arguing with you I would just tell you this. An AI needs to see right???
How would you get Chat GPT API to know its surroundings? You could tell it where it is and whats its surroundings look like. Or you can just leave it as a talking head who has no actual idea of what is going on around it. Either is useful! But do not come here trying to dis on my project kid.
This is the same method NVIDIA used to input information to GPT-4 to create autonomous agents in minecraft.
Minecraft AI - NVIDIA uses GPT-4 to create a SELF-IMPROVING autonomous agent. - YouTube
I have updated and completed the aware module.
It now requires the ChatModule linked here
Artificially Intelligent Chatbot LUAU Algorithm [Open Source] - Resources / Community Resources - Developer Forum | Roblox
The required module is located here
local aware = {}
local chatmodule=require(script.Parent.ChatModule)
syntheticdatasynonms={
{"very close","quite close","extremely close"},
{"close","near","not far"},
{"kind of close","pretty near","somewhat near"},
{" tiny "," mini "," minuscule "},
{" small "," little "," petite "},
{" large "," big ","huge"},
{"gigantic","colossal","massive"},
{"a few","some","a couple"},
{"many","numerous","several"},
{"lots of","tons of","a good number of"},
{"There is","Over there is"},
{"I see","I can see"},
{"Nearby is","Close by is"},
{"Additionally","Furthermore","Moreover"},
{"Also","In addition","Plus"},
{"However","But","Though"},
{"to the north","northward","northern"},
{"to the south","southward","southern"},
{"to the east","eastward","eastern"},
{"to the west","westward","western"}
}
function aware.GetCombatDescription(Char)
local MagicID=Char:FindFirstChild("MagicID")
if MagicID~=nil then
local fly=""
local Aggression=""
local AttackVector=""
local Barrier=""
local Buffs=""
local BaseHealth=""
local BaseMagicDMG=""
local BaseRangeDMG=""
local BaseMeleeDMG=""
local CanBeFrozen=""
local ChangeStyles=""
local Cooldown=""
local Cost=""
local CostMax=""
local Cure=""
local Description=""
local Dodge=""
local Element=""
local Element2=""
local Element3=""
local Hide=""
local Level=""
local MainStyle=""
local Multiply=""
local Paralyze=""
local Poison=""
local Power=""
local Prayer=""
local ProtectFromStyle=""
local Recoil=""
local Range=""
local Parasite=""
local Species=""
local Teleport=""
local Transform=""
local Weakness=""
--construct a long combined string of the above local strings.
if MagicID:GetAttribute("Aggression")==1 then
Aggression="aggressive, "
end
if MagicID:GetAttribute("Fly")==true then
fly="can Fly, "
end
if MagicID:GetAttribute("Barrier")==true then
Barrier="uses Barrier, "
end
if MagicID:GetAttribute("Buffs")==true then
Buffs="uses Buffs, "
end
if MagicID:GetAttribute("Multiply")==true then
Buffs="uses Multiply, "
end
if MagicID:GetAttribute("ChangeStyle")==true then
ChangeStyles="melee and magic user, "
BaseMagicDMG="base Magic DMG:"..tostring(MagicID:GetAttribute("BaseMagicDMG"))..", "
BaseMagicDMG="base Melee DMG:"..tostring(MagicID:GetAttribute("BaseMeleeDMG"))..", "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="Melee Range:"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
--if MagicID:GetAttribute("MainStyles")~=nil then
-- if MagicID:GetAttribute("MainStyles")==1 then
-- MainStyle="Melee focused, "
-- elseif MagicID:GetAttribute("MainStyles")==2 then
-- MainStyle="Magic focused, "
-- elseif MagicID:GetAttribute("MainStyles")==3 then
-- MainStyle="Range focused, "
-- end
--end
elseif MagicID:GetAttribute("ChangeStyle")==false then
if MagicID:GetAttribute("MainStyles")~=nil then
if MagicID:GetAttribute("MainStyles")==1 then
MainStyle="Melee only, "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="Melee Range:"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
elseif MagicID:GetAttribute("MainStyles")==2 then
MainStyle="Magic only, "
elseif MagicID:GetAttribute("MainStyles")==3 then
MainStyle="Range only, "
end
end
end
if MagicID:GetAttribute("BaseHealth")~=nil then
BaseHealth="Base Health "..tostring(MagicID:GetAttribute("BaseHealth"))..", "
end
--write code to complete above context
if MagicID:GetAttribute("CanBeFrozen")==false then
CanBeFrozen="cannot be Frozen, "
end
if MagicID:GetAttribute("Cooldown")~=nil then
Cooldown="Cooldown:"..tostring(MagicID:GetAttribute("Cooldown"))..", "
end
if MagicID:GetAttribute("Cost")~=nil then
Cost="Power Cost:"..tostring(MagicID:GetAttribute("Cost"))..", "
end
if MagicID:GetAttribute("CostMax")~=nil then
CostMax="Max Power:"..tostring(MagicID:GetAttribute("CostMax"))..", "
end
if MagicID:GetAttribute("Cure")==true then
Cure="can Heal, "
end
if MagicID:GetAttribute("Description")~=nil then
Description=MagicID:GetAttribute("Description")..""
end
if MagicID:GetAttribute("Dodge")==true then
Dodge="can Dodge, "
end
if MagicID:GetAttribute("Teleport")==true then
Teleport="can Teleport, "
end
if MagicID:GetAttribute("Transform")==true then
Transform="can Transform, "
end
if MagicID:GetAttribute("Element")~=nil and MagicID:GetAttribute("Element")~="" then
Element=" /"..MagicID:GetAttribute("Element")
if MagicID:GetAttribute("Element2")~="" and MagicID:GetAttribute("Element2")~=nil then
Element2="/"..MagicID:GetAttribute("Element2")
end
if MagicID:GetAttribute("Element3")~="" and MagicID:GetAttribute("Element2")~=nil then
Element3="/"..MagicID:GetAttribute("Element3")
end
end
if MagicID:GetAttribute("Parasite")==true then
Parasite="Parasitic, "
end
if MagicID:GetAttribute("Poison")==true then
Poison="Poisonous, "
end
if MagicID:GetAttribute("Prayer")==true then
Prayer="uses Prayers, "
elseif MagicID:GetAttribute("ProtectFromStyle")==1 then
ProtectFromStyle="strong against Melee, "
elseif MagicID:GetAttribute("ProtectFromStyle")==2 then
ProtectFromStyle="strong against Magic, "
elseif MagicID:GetAttribute("ProtectFromStyle")==3 then
ProtectFromStyle="strong against Range, "
end
--Power="Power Multiplier:" MagicID:GetAttribute("Power")
--Range=""
if MagicID:GetAttribute("Recoil")==true then
Recoil="hurts to touch, "
end
--write rest of code for above context
return Description..Element..Element2..
Element3.." Type."..Level..ChangeStyles..MainStyle..Cooldown..fly..Aggression..Barrier..Buffs..BaseHealth..
BaseMagicDMG..BaseRangeDMG..BaseMeleeDMG..AttackVector..CanBeFrozen..
Cost..CostMax..Cure..Dodge..
Hide..Multiply..Paralyze..Poison..Power..
Prayer..ProtectFromStyle
end
end
function aware.DescribeNPC(Char)
local MagicID=Char:FindFirstChild("MagicID")
if MagicID~=nil then
local fly=""
local Aggression=""
local AttackVector=""
local Barrier=""
local Buffs=""
local BaseHealth=""
local BaseMagicDMG=""
local BaseRangeDMG=""
local BaseMeleeDMG=""
local CanBeFrozen=""
local ChangeStyles=""
local Cooldown=""
local Cost=""
local CostMax=""
local Cure=""
local Description=""
local Dodge=""
local Element=""
local Element2=""
local Element3=""
local Hide=""
local Level=""
local MainStyle=""
local Multiply=""
local Paralyze=""
local Poison=""
local Power=""
local Prayer=""
local ProtectFromStyle=""
local Recoil=""
local Range=""
local Parasite=""
local Species=""
local Teleport=""
local Transform=""
local Weakness=""
local rating=0
--construct a long combined string of the above local strings.
if MagicID:GetAttribute("Aggression")==1 then
Aggression="aggressive, "
rating=rating+1
end
if MagicID:GetAttribute("Fly")==true then
fly="can Fly, "
rating=rating+1
end
if MagicID:GetAttribute("Barrier")==true then
Barrier="uses Barrier, "
rating=rating+1
end
if MagicID:GetAttribute("Buffs")==true then
Buffs="uses Buffs, "
rating=rating+1
end
if MagicID:GetAttribute("Multiply")==true then
Buffs="uses Multiply, "
rating=rating+1
end
if MagicID:GetAttribute("ChangeStyle")==true then
ChangeStyles="melee and magic user, "
rating=rating+1
BaseMagicDMG="base Magic damage is"..tostring(MagicID:GetAttribute("BaseMagicDMG"))..", "
BaseMagicDMG="base Melee damage is"..tostring(MagicID:GetAttribute("BaseMeleeDMG"))..", "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="melee range is"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
elseif MagicID:GetAttribute("ChangeStyle")==false then
if MagicID:GetAttribute("MainStyles")~=nil then
if MagicID:GetAttribute("MainStyles")==1 then
MainStyle="uses Melee only, "
if MagicID:GetAttribute("AttackVector3")~=nil then
AttackVector="melee range:"..tostring(MagicID:GetAttribute("AttackVector3"))..", "
end
elseif MagicID:GetAttribute("MainStyles")==2 then
MainStyle="uses Magic only, "
elseif MagicID:GetAttribute("MainStyles")==3 then
MainStyle="uses Range only, "
end
end
end
if MagicID:GetAttribute("BaseHealth")~=nil then
local hpr=Char.Humanoid.MaxHealth/100
rating=rating+hpr
BaseHealth="base health "..tostring(MagicID:GetAttribute("BaseHealth"))..", "
end
--write code to complete above context
if MagicID:GetAttribute("CanBeFrozen")==false then
CanBeFrozen="cannot be frozen, "
rating=rating+1
end
if MagicID:GetAttribute("Cooldown")~=nil then
Cooldown="it's cooldown is "..tostring(MagicID:GetAttribute("Cooldown"))..", "
rating=rating+(5-MagicID:GetAttribute("Cooldown"))
end
if MagicID:GetAttribute("Cost")~=nil then
Cost="it's action cost is "..tostring(MagicID:GetAttribute("Cost"))..", "
rating=rating+1
end
if MagicID:GetAttribute("CostMax")~=nil then
CostMax="It's max power is"..tostring(MagicID:GetAttribute("CostMax"))..", "
end
if MagicID:GetAttribute("Cure")==true then
Cure="can Heal, "
rating=rating+1
end
if MagicID:GetAttribute("Description")~=nil then
Description=MagicID:GetAttribute("Description")..""
end
if MagicID:GetAttribute("Dodge")==true then
Dodge="can Dodge, "
rating=rating+1
end
if MagicID:GetAttribute("Teleport")==true then
Teleport="can Teleport, "
rating=rating+1
end
if MagicID:GetAttribute("Transform")==true then
Transform="can Transform, "
rating=rating+1
end
if MagicID:GetAttribute("Element")~=nil and MagicID:GetAttribute("Element")~="" then
Element="uses "..MagicID:GetAttribute("Element")
rating=rating+1
if MagicID:GetAttribute("Element2")~="" and MagicID:GetAttribute("Element2")~=nil then
Element2=","..MagicID:GetAttribute("Element2")
rating=rating+1
end
if MagicID:GetAttribute("Element3")~="" and MagicID:GetAttribute("Element2")~=nil then
Element3="and "..MagicID:GetAttribute("Element3")
rating=rating+1
end
end
if MagicID:GetAttribute("Parasite")==true then
Parasite=", it's parasitic"
rating=rating+1
end
if MagicID:GetAttribute("Poison")==true then
Poison=", it's poisonous"
rating=rating+1
end
if MagicID:GetAttribute("Prayer")==true then
Prayer="uses Prayers"
rating=rating+1
elseif MagicID:GetAttribute("ProtectFromStyle")==1 then
rating=rating+1
ProtectFromStyle=", strong against Melee"
elseif MagicID:GetAttribute("ProtectFromStyle")==2 then
rating=rating+1
ProtectFromStyle=", strong against Magic"
elseif MagicID:GetAttribute("ProtectFromStyle")==3 then
rating=rating+1
ProtectFromStyle=", strong against Range"
end
--Power="Power Multiplier:" MagicID:GetAttribute("Power")
--Range=""
if MagicID:GetAttribute("Recoil")==true then
rating=rating+1
Recoil="hurts to touch, "
end
rating=rating+tonumber(Level)
--write rest of code for above context
return Description..Element..Element2..
Element3.." magic. It's "..Level.." "..ChangeStyles..MainStyle..Cooldown..fly..Aggression..Barrier..Buffs..BaseHealth..
BaseMagicDMG..BaseRangeDMG..BaseMeleeDMG..AttackVector..CanBeFrozen..
Cost..CostMax..Cure..Dodge..
Hide..Multiply..Paralyze..Poison..Power..
Prayer..ProtectFromStyle..".",aware.judgepower(rating,25)
else return "",nil
end
end
local function tablehandler(location)
-- Get the folder from the workspace
local tableobj={}
local mapObjectsFolder = location
-- Check if the folder exists
if mapObjectsFolder then
-- Loop through the objects in the folder
for _, obj in pairs(mapObjectsFolder:GetChildren()) do
-- Add them to the stable
table.insert(tableobj, obj)
end
-- Connect a function to the ChildAdded event of the folder
mapObjectsFolder.ChildAdded:Connect(function(child)
-- Add the new object to the stable
table.insert(tableobj, child)
end)
-- Connect a function to the ChildRemoved event of the folder
mapObjectsFolder.ChildRemoved:Connect(function(child)
-- Find the index of the removed object in the stable
local index = table.find(tableobj, child)
-- Remove it from the stable
table.remove(tableobj, index)
end)
end
-- Return the stable
return tableobj
end
-- Call the function and assign it to a variable
mapObjects = tablehandler(workspace.MapObjects)
plants = tablehandler(workspace.Plants)
enemys=tablehandler(workspace.Enemys)
rubble = tablehandler(workspace.Rubble)
trees=tablehandler(workspace.Trees)
chests=tablehandler(workspace.Chests)
grounditems = tablehandler(workspace.grounditems)
houses=tablehandler(workspace.Houses)
playerstable=tablehandler(game.Players)
dungeons=tablehandler(workspace.DungeonRender)
npcs = tablehandler(workspace.NPCS)
function getnearest(list,root,dist,getone)
local list=list
local pos=root.Position
local torso = nil
local dist = 30
local temp = nil
local human = nil
local temp2 = nil
local amnt=0
local scope=nil
local list=list
if list~=nil then
for x = 1, #list do
temp2 = list[x]
if temp2==root.Parent then
temp=nil
elseif temp2:IsA("BasePart") then
temp = temp2
elseif temp2:IsA("Model") then
if temp2.PrimaryPart~=nil then
temp=temp2.PrimaryPart
else
temp=temp2:FindFirstChildOfClass("BasePart")
end
elseif temp2:IsA("Player") then
temp=temp2.Character:FindFirstChild("HumanoidRootPart")
elseif temp2:IsA("Folder") then
local m=temp2:FindFirstChildOfClass("Model")
if m then
temp=m:FindFirstChildOfClass("BasePart")
end
end
if (temp ~= nil) then
if (temp.Position - pos).magnitude < dist then
amnt=amnt+1
torso = temp2
dist = (temp.Position - pos).magnitude
scope = temp.Size
if getone==true then
return torso,scope
end
end
end
end
end
return torso,amnt,scope
end
function aware.judgedistance(position, position2, maxDist)
local distVector = (position - position2).Magnitude
local judgedDist = {0.2, 0.4, 0.6, 0.8, 1, 1.5, 2}
local judgeStrings = {{"very close"}, {"close"}, {"kind of close"},{"not far"}, {"kinda far"}, {"far"}, {"very far"}}
local index = 1
local distanceJudge = ""
repeat
if distVector <= maxDist * judgedDist[index] then
distanceJudge = judgeStrings[index]
break
end
index = index + 1
until index > #judgedDist
-- Get direction
local dirVector = (position2 - position).Unit -- Unit vector pointing to position2
local angle = math.atan2(dirVector.Z, dirVector.X) -- Angle in radians
local dirName = ""
if angle > math.rad(157.5) or angle < math.rad(-157.5) then
dirName = "south"
elseif angle > math.rad(112.5) then
dirName = "southwest"
elseif angle > math.rad(67.5) then
dirName = "west"
elseif angle > math.rad(22.5) then
dirName = "northwest"
elseif angle > math.rad(-22.5) then
dirName = "north"
elseif angle > math.rad(-67.5) then
dirName = "northeast"
elseif angle > math.rad(-112.5) then
dirName = "east"
else
dirName = "southeast"
end
return distanceJudge,dirName
end
function aware.judgeamnt(amnt,judgestrings)
local judgedistribution={1,2,3,4,5,6,8}
local judgestrings={{"a single"},{"a couple"},{"a few"},{"a quartet"},{"several"},{"a bunch"},{"a lot"}}
local index=1
repeat
local distvector=amnt
if distvector<=judgedistribution[index] then
return judgestrings[index][1]
end
until index>=#judgedistribution
end
function aware.judgething(size, bigSize,judgeSizes,judgeStrings)
local index = 1
local sizeJudge = ""
for i, judge in ipairs(judgeSizes) do
if size <= bigSize * judge then
local sizeJudge2 = judgeStrings[i]
sizeJudge=sizeJudge2[math.random(1,#sizeJudge)]
break
end
end
return sizeJudge
end
function aware.judgesize(size, bigSize)
local judgeSizes = {0.1, 0.25, 0.5, 0.75, 1, 1.5, 2}
local judgeStrings = {{"tiny"}, {"small"}, {"medium-small"}, {"medium"}, {"medium-large"}, {"large"}, {"huge"}}
local sizeJudge= aware.judgething(size, bigSize,judgeSizes,judgeStrings)
return sizeJudge
end
function aware.judgepower(power, bigpower)
local judgeSizes = {0.1, 0.25, 0.5, 0.75, 1, 1.5, 2}
local judgeStrings = {{"very weak"}, {"weak"}, {"kind of weak"}, {"average"}, {"kind of strong"}, {"strong"}, {"powerful"}}
local sizeJudge= aware.judgething(power, bigpower,judgeSizes,judgeStrings)
return sizeJudge
end
function aware.judgeobject(instance)
if instance:FindFirstChild("Humanoid")~=nil then
return instance.Humanoid.DisplayName
elseif instance:IsA("folder")~=nil then
return instance.Name
elseif instance:IsA("BasePart") then
local s=instance:FindFirstChild("Species")
if s~=nil then
return s.Value
end
elseif instance:IsA("Model") then
return instance.Name
end
end
function aware.getsurroundingobjects(root)
local closestPlant, numPlants,plantsize = getnearest(plants, root, 40)
local closestTree, numTrees = getnearest(trees, root, 80)
local closestStructure, numStructures,structuresize = getnearest(mapObjects, root, 160)
local closestEnemy, numEnemies = getnearest(enemys, root, 60)
local closestNPC, numNPCs = getnearest(npcs, root, 60)
local closestPlayer, numPlayers = getnearest(playerstable, root, 80)
local closestRubble, numRubble = getnearest(rubble, root, 20)
local closestChest, numChests = getnearest(chests, root, 30)
local closestGroundItem, numGroundItems = getnearest(grounditems, root, 40)
local closestHouse, numHouses,housesize = getnearest(houses, root, 100)
local closestDungeon, numDungeons,dungsize = getnearest(dungeons, root, 200)
local pos=root.Position
local function describeTrees()
if numTrees > 0 then
local treeText = aware.judgeamnt(numTrees).." of trees surround the area"
return treeText
end
end
local function describePlants()
if numPlants > 0 then
local plantText = aware.judgeamnt(numPlants).." of plants are scattered around"
return plantText
end
end
local function describeRubble()
if numRubble > 0 then
local rubbleText = aware.judgeamnt(numRubble).." of pieces of rubble lay on the ground"
return rubbleText
end
end
local function describeEnemies()
if numEnemies > 0 then
local enemyText = aware.judgeamnt(numEnemies).." of enemies are lurking nearby"
return enemyText
end
end
local function describeNPCs()
if numNPCs > 0 then
local npcText = aware.judgeamnt(numNPCs).." of strangers are in the area"
return npcText
end
end
local function describePlayers()
if numPlayers > 0 then
local playerText = aware.judgeamnt(numPlayers).." of players are nearby"
return playerText
end
end
local function describeChests()
if numChests > 0 then
local chestText = aware.judgeamnt(numChests).." of chests are scattered around"
return chestText
end
end
local function describeGroundItems()
if numGroundItems > 0 then
local groundItemText = aware.judgeamnt(numGroundItems).." of items lay on the ground"
return groundItemText
end
end
local function describeHouses()
if numHouses > 0 then
local houseText = aware.judgeamnt(numHouses).." of houses stand nearby"
return houseText
end
end
local function describeDungeons()
if numDungeons > 0 then
local dungeonText = aware.judgeamnt(numDungeons).." of areas around here."
return dungeonText
end
end
local function describestructures()
if numStructures > 0 then
local structureText = aware.judgeamnt(numDungeons).." of interesting places to check out around here."
return structureText
end
end
local function describeSurroundings(pos)
local info = aware.getsurroundingobjects(pos)
local descStrings = {}
local opener={"Their are ","I see ","Surrounding us are "}
table.insert(descStrings, ""..describeTrees())
table.insert(descStrings, ""..describePlants())
table.insert(descStrings, ""..describeRubble())
table.insert(descStrings, ""..describeEnemies())
table.insert(descStrings, ""..describeNPCs())
table.insert(descStrings, ""..describePlayers())
table.insert(descStrings, ""..describeChests())
table.insert(descStrings, ""..describeGroundItems())
table.insert(descStrings, ""..describeHouses())
table.insert(descStrings, ""..describeDungeons())
-- Remove any nil values
local finalStrings = {}
local paragraphstring=""
for i,str in ipairs(descStrings) do
if str ~= "" then
--table.insert(finalStrings, opener[math.random(1,#opener)]..str..".")
paragraphstring=paragraphstring..str..", "
end
end
if paragraphstring~="" then
paragraphstring=opener[math.random(1,#opener)]..paragraphstring.."."
table.insert(finalStrings,paragraphstring)
end
-- Join the strings together
return finalStrings
end
local function describeSurroundings2(pos)
local info = aware.getsurroundingobjects(pos)
local function describeRubble2(context)
local rubbleText = ""
if closestRubble then
local dist, dir = aware.judgedistance(pos, closestRubble.Position, 20)
local size = aware.judgesize(closestRubble.Size)
rubbleText = "piece of " ..size.. " rubble is " ..dist.. " to the " ..dir
end
if numRubble > 1 then
if context==nil then
return rubbleText,aware.judgeamnt(numRubble).. " of pieces of rubble lay on the ground"
else
rubbleText = rubbleText .. context.. aware.judgeamnt(numRubble).. " of pieces of rubble lay on the ground"
end
end
return rubbleText
end
local function describeChests2(context)
local chestText = ""
if closestChest then
local dist, dir = aware.judgedistance(pos, closestChest.PrimaryPart.Position, 30)
--local size = aware.judgesize(closestChest.Size)
chestText = "chest is " ..dist.. " to the " ..dir
end
if numChests > 1 then
if context==nil then
return chestText,aware.judgeamnt(numChests).." of chests are scattered around"
else
chestText = chestText .. context .. aware.judgeamnt(numChests).." of chests are scattered around"
end
end
return chestText
end
local function describeGroundItems2(context)
local groundItemText = ""
if closestGroundItem then
local dist, dir = aware.judgedistance(pos, closestGroundItem.Item:FindFirstChildOfClass("BasePart").Position, 40)
local size = aware.judgesize(closestGroundItem.Size)
groundItemText = aware.judgeobject(closestGroundItem)" is " ..dist.. " to the " ..dir
end
if numGroundItems > 1 then
if context==nil then
return groundItemText,aware.judgeamnt(numGroundItems).." of items lay on the ground"
else
groundItemText = groundItemText .. context .. aware.judgeamnt(numGroundItems).." of items lay on the ground"
end
end
return groundItemText
end
local function describeHouses2(context)
local houseText = ""
if closestHouse then
local dist, dir = aware.judgedistance(pos, closestHouse.Position, 100)
local size = aware.judgesize(closestHouse.Size)
houseText = "" ..size.. " house is " ..dist.. " to the " ..dir
end
if numHouses > 1 then
if context==nil then
return houseText,aware.judgeamnt(numHouses).." of other houses stand nearby"
else
houseText = houseText .. context .. aware.judgeamnt(numHouses).." of other houses stand nearby"
end
end
return houseText
end
local function describestructures2(context)
if numStructures > 0 then
local structureText = aware.judgeamnt(numDungeons).." of interesting places to check out around here"
return structureText
end
local dungeonText=""
if closestDungeon then
local dist, dir = aware.judgedistance(pos, closestStructure.PrimaryPart.Position, 200)
local size = aware.judgesize(closestStructure.PrimaryPart.Size)
dungeonText = aware.judgeobject(closestStructure).." is "..dist.. " to the " ..dir
end
if numStructures > 1 then
if context==nil then
return dungeonText,aware.judgeamnt(numStructures)" of interesting places to check out around here"
else
dungeonText = dungeonText .. context..aware.judgeamnt(numStructures)" of interesting places to check out around here"
end
end
end
local function describeDungeons2(context)
local dungeonText = ""
if closestDungeon then
local dist, dir = aware.judgedistance(pos, closestDungeon:FindFirstChildOfClass("BasePart").Position, 200)
local size = aware.judgesize(closestDungeon.Size)
dungeonText = aware.judgeobject(closestDungeon).." is "..dist.. " to the " ..dir
end
if numDungeons > 1 then
if context==nil then
return dungeonText,aware.judgeamnt(numDungeons)" of areas around here"
else
dungeonText = dungeonText .. context..aware.judgeamnt(numDungeons)" of areas around here"
end
end
return dungeonText
end
local function describeTrees2(context)
local treeText = ""
if closestTree then
local dist, dir = aware.judgedistance(pos, closestTree.PrimaryPart.Position, 160)
treeText = aware.judgeobject(closestTree).." is " ..dist.. " to the " ..dir
end
if numTrees > 1 then
if context==nil then
return treeText, aware.judgeamnt(numTrees).." of other trees surround the area"
else
treeText = treeText ..context.. aware.judgeamnt(numTrees).." of other trees surround the area"
end
end
return treeText
end
local function describePlants2(context)
local plantText = ""
if closestPlant then
local dist, dir = aware.judgedistance(pos, closestPlant.Position, 40)
local size = aware.judgesize(closestPlant.Size)
plantText =size.. " "..aware.judgeobject(closestPlant).." is " ..dist.. " to the " ..dir
end
if numPlants > 1 then
if context==nil then
return plantText, aware.judgeamnt(numPlants).." of other plants are scattered around"
else
plantText = plantText ..context.. aware.judgeamnt(numPlants).." of other plants are scattered around"
end
end
return plantText
end
local function describeEnemies2(context)
local enemyText = ""
if closestEnemy then
local dist, dir = aware.judgedistance(pos, closestEnemy.HumanoidRootPart.Position, 60)
enemyText = aware.judgeobject(closestEnemy).. " is " ..dist.. " to the " ..dir
end
if numEnemies > 1 then
if context==nil then
return enemyText,aware.judgeamnt(numEnemies).." enemies are lurking nearby"
else
enemyText = enemyText ..context.. aware.judgeamnt(numEnemies).." enemies are lurking nearby"
end
end
return enemyText
end
local function describePlayers2(context)
local enemyText = ""
if closestPlayer then
local dist, dir = aware.judgedistance(pos, closestPlayer.Character.HumanoidRootPart.Position, 80)
enemyText = aware.judgeobject(closestEnemy).. " is " ..dist.. " to the " ..dir
end
if numPlayers > 1 then
if context==nil then
return enemyText,aware.judgeamnt(numPlayers).." of players are nearby"
else
enemyText = enemyText ..context.. aware.judgeamnt(numPlayers).." of players are nearby"
end
end
return enemyText
end
local function describeNPCs2(context)
local npcText = ""
if closestNPC then
local dist, dir = aware.judgedistance(pos, closestNPC.HumanoidRootPart.Position, 80)
npcText = aware.judgeobject(closestNPC).." is " ..dist.. " to the " ..dir
end
if numNPCs > 1 then
if context==nil then
return npcText,aware.judgeamnt(numNPCs).." of strangers are in the area"
else
npcText = npcText ..context.. aware.judgeamnt(numNPCs).." strangers are in the area"
end
end
return npcText
end
local descStrings = {}
local opener={"Their are ","I see ","Surrounding us are "}
table.insert(descStrings, ""..describeTrees2(", and their are "))
table.insert(descStrings, ""..describePlants2(", and their are "))
table.insert(descStrings, ""..describeRubble2(", and their are "))
table.insert(descStrings, ""..describeEnemies2(", and their are "))
table.insert(descStrings, ""..describeNPCs2(", and their are "))
table.insert(descStrings, ""..describePlayers2(", and their are "))
table.insert(descStrings, ""..describeChests2(", and their are "))
table.insert(descStrings, ""..describeGroundItems2(", and their are "))
table.insert(descStrings, ""..describeHouses2(", and their are "))
table.insert(descStrings, ""..describeDungeons2(", and their are "))
local descStrings2 = {}
local opener2={"Their is ","","I can see "}
local tre,tree2=describeTrees2()
local plan,plan2=describePlants2()
local rub,rub2=describeRubble2()
local enem,enem2=describeEnemies2()
local npc1,npc2=describeNPCs2()
local plr1,plr2=describePlayers2()
local chest,ches2=describeChests2()
local g1,g2=describeGroundItems2()
local hous,house=describeHouses2()
local dung,dungeon=describeDungeons2()
local struc,struc2=describestructures2()
local function DetermineGoal()
local interest=""
if closestPlayer then
interest=interest.." I can see that "..plr1..""
end
if enem then
if interest~="" then
interest=interest..", w"
else
interest="W"
end
interest=interest.."atch out, their is "..enem..""
end
if npc1 then
if closestPlayer and interest~="" then
interest=interest..", and"
end
interest=interest.." "..npc1..""
end
if dung then
--if not npc1 and interest~="" then
-- interest=interest..", we "
--else
-- interest=interest.." We "
--end
if interest~="" then
interest=interest.."."
end
interest=interest.." We are in a place called "..aware.judgeobject(closestDungeon)..""
end
if struc then
if interest~="" then
interest=interest.."."
end
interest=interest.." Their is a "..struc
end
if chest then
if interest~="" then
interest=interest.."."
end
interest=interest.." I notice a "..chest..""
end
if g1 then
if interest~="" then
interest=interest..","
end
interest=interest..g1
end
if hous then
if struc and interest~="" then
interest=interest.."."
end
interest=interest.." I can see a "..hous..""
end
if tree2 then
if interest~="" then
interest=chatmodule.randomizeString(interest..". Additionally, t")
else
interest=interest.."T"
end
interest=interest.."heir are "..tree2
end
if plan2 then
if interest~="" then
interest=interest..","
else
interest=interest.." Their are "
end
interest=interest..""..plan2..""
end
if interest~="" then
interest=interest.."."
end
return interest
end
--example enemyText = aware.judgeobject(closestEnemy.Parent).. " is " ..dist.. " to the " ..dir
--return enemyText,aware.judgeamnt(numPlayers).." of players are nearby"
-- enemyText = enemyText ..context.. aware.judgeamnt(numPlayers).." of players are nearby"
-- Remove any nil values
local finalStrings = {}
local paragraphstring=""
for i,str in ipairs(descStrings) do
if str ~= "" then
table.insert(finalStrings, opener[math.random(1,#opener)]..str..".")
paragraphstring=paragraphstring..str..", "
end
end
table.insert(finalStrings,DetermineGoal())
if paragraphstring~="" then
paragraphstring=paragraphstring.."."
table.insert(finalStrings,paragraphstring)
end
-- Join the strings together
return finalStrings
end
local d1=describeSurroundings(pos)
local d2=describeSurroundings2(pos)
local syntheticdata= function()
for i,str in ipairs(d1) do
if str ~= "" then
table.insert(d2, str)
--paragraphstring=paragraphstring..str..", "
end
end
for i,str in ipairs(d2) do
if str ~= "" then
d2[i]=chatmodule.randomizeStringLight(str,syntheticdatasynonms)
--paragraphstring=paragraphstring..str..", "
end
end
return d2
end
return syntheticdata()
--,
--{
-- closestPlant = closestPlant,
-- numPlants = numPlants,
-- plantsize = plantsize,
-- closestTree = closestTree,
-- numTrees = numTrees,
-- closestStructure = closestStructure,
-- numStructures = numStructures,
-- structuresize = structuresize,
-- closestEnemy = closestEnemy,
-- numEnemies = numEnemies,
-- closestNPC = closestNPC,
-- numNPCs = numNPCs,
-- closestPlayer = closestPlayer,
-- numPlayers = numPlayers,
-- closestRubble = closestRubble,
-- numRubble = numRubble,
-- closestChest = closestChest,
-- numChests = numChests,
-- closestGroundItem = closestGroundItem,
-- numGroundItems = numGroundItems,
-- closestHouse = closestHouse,
-- numHouses = numHouses,
-- housesize,
-- closestDungeon = closestDungeon,
-- numDungeons = numDungeons,
-- dungsize = dungsize
--}
end
return aware