#Party system

1 messages · Page 1 of 1 (latest)

gleaming crater
#

I'm trying to figure out a good way to make a decent party system so people can invite their friends and play in the same game. I'm not good with scripting AT ALL, so as you can imagine it's pretty difficult. Any ideas or guides are extremely helpful!

tropic quail
gleaming crater
#

Precisely, I'm trying to work on a top down horde shooter. Ambitious, I know but I wanna make that passion project that I've been neglecting for years lol

tropic quail
#

Have you tried like once on a part if 4 players for example are on it it waits 5 seconds to launch then once countdown done it make those 4 people join an alt server ?

gleaming crater
#

I honestly don't have a clue how to do that lol, I figured it would be easier to just have a basic ui option to and specific players an invite then launch them in their own alt server together

soft flower
# gleaming crater I'm trying to figure out a good way to make a decent party system so people can ...

make a module that has a function taht returns a table with member 1, 2, 3, and 4. if the value of a thing is nil then theres not a member in taht slot. heres a simple system its not really fully done or anything, you could set up an init if you wanted too.

I wasn't sure if you wanted a queue system or a in game party system (im guessing its a mixture of both) so i made something that can be used in both ways with enough tweaking.

This should be pretty readable, but OOP can be a bit confusing if you haven't seen it before. The keyword self is just the object you created, using party.new(founder, "name", size) will create an object in your script.

local party = {};
party.__index = party;

function party.new(plr : Player, partyName : string?, maxSize : number?)
  local self = setmetatable({}, party);
  self.leader = plr;
  self.name = partyName or (plr.Name.."'s Party");
  self.members = {plr.Name};
  self.maxSize = maxSize or 4; 
  -- add more things if needed
  return self;
end

function party:invite(plr : Player)
  if self.members[plr.Name]
    return warn("Player is already in party.");
  end
  if #self.members >= self.maxSize then
    return warn("Max players in party");
  end
  table.insert(self.members, plr.Name);
  -- any function to set the attribute of the player being in the party blah blah blah, this is to get party members
end

function party:getMembers()
  return self.members;
end

-- ex things you could add: 
-- party:teleportPlayers()
-- party:giveStatBonuses()
return party