I'm making a PVP game and i want people to make their own guilds but how do i start? I read the guide already.
Jan 20 2014, 3:30 pm
Best response
|
|
Create a datum for guilds and store the members in a list variable contained in the datum.
|
I'm not going to walk you step-by-step through how to create a game-specific feature that you can probably find by using the search feature.
If you create a new guild datum, give it a name or something to distinguish it, and assign it members, you have a basic "team" functionality and what you do with it is entirely up to you. |
Here is an example for you..
Guild Note; Credits goes to Ter13 |
Should probably be passing the correct value to the first argument of input() and alert(), otherwise you're not gonna get them sent to the right place.
|
In response to Atol Soldier
|
|
This one looks promising but when you leave the guild does the save delete?
|
In response to Dimensive
|
|
Well, I traced the code and I don't really see a leave proc. You'll probably have to design that yourself. It's really simple.
We'll take the Create() proc as a base: Create(var/mob/player/m) If we basically understand those two lines that I commented, then you can go about doing something like this: Leave(var/mob/player/m) |
@xirre; no. Just no. Bad bad bad.
The system ter made, seems to be more of a party guild. When everyone leaves it auto-disbands. I remember when I couldn't understand how to create a clan system or party system.. now I laugh cause it's so easy. Practice pays off. |
In response to Flysbad
|
|
Flysbad wrote:
@xirre; no. Just no. Bad bad bad. It was hard? When? And don't tell me no, punk. D: I skimmed through it. Pardon me. I didn't see the Logout() part thoroughly. |
In response to Flysbad
|
|
Flysbad wrote:
@xirre; no. Just no. Bad bad bad. Actually, Xirre is spot on with his example. The reason that you are thinking it's a party-based thing where when everyone logs out that's in the guild, it disbands, is because you aren't paying close enough attention to how the guilds save. Basically, when everyone in the guild goes offline, we don't need to keep the guild datum in memory, so we delete the guild from the loaded guilds global list. The guild still exists in the file structure even though it's no longer in memory. We just don't want to keep objects around in memory that aren't being used, because if none of the members are online, we obviously won't be doing anything with the guild. This introduces some complications, like searching for guild information when everyone in the guild is offline. My solution doesn't account for this, but adding it would be somewhat trivial. |
In response to Flysbad
|
|
Guild I've taken the liberty of fixing this snippet I hastily typed out for Atol Soldier in a private chat. You will find that there are now commands that allow people to leave the guild, as well as people to be kicked from the guild. I also fixed a small number of bugs in the implementation, and some oversights, such as what happens when someone is kicked from the guild when they are offline. Note that the player's guild_name variable can be inaccurate on initial load, hence we check to see if the player is actually in the guild after initial login and loading of the old guild information. If that player was kicked, and the only person in that guild to come online, the guild will automatically unload itself immediately, and won't save anything, because the guild information is always up-to-date. You should of course, always save the player after a change in guild status, because every time we invite a person to the guild, or kick a person from the guild, we are saving the guild information. If you don't save the player, you can potentially wind up with desynchronized guild information. This is particularly bad when you don't save the player after they join a guild, because there's no way to figure out which guild the player belongs to without searching through the contents of every guild on the server, thus loading every guild on the server to do it. It's better to just ensure that the player's information is saved any time that the player's guild status changes. You'll have to write a lot of your own behaviors for actually allowing people to access them, but it should be pretty simple to do all of that. |