Jump to content

Recommended Posts

Whew!!

As the title says: this is a basic framework that adds factions to players and with that the ability to easily implement group pvp without friendlyfire to your allies.

Note that this is a toolbox! You will have to create and apply the right factions yourself!

How to use:

Step1: install mod -- all players now have a component called faction

Step2: turn on pvp -- everyone will be neutral by default and neutrals can't be attacked by players

Step3: Set factions for players -- now people with two different factions can pvp each other

Custom Icons:

To use your own custom icons you can implement them in your own custom mod. (You don't need custom icons for a faction to properly function tho)

Use spriter and check out the icon sample I attached. This is the structure it needs to follow:

- Build = factionname_faction.scml
    - bank = factionname_faction
        - Animation = idle

Then add this code to your own modmain.lua and make sure you include all your custom icons in the icons table

Spoiler

 


local io = GLOBAL.io

-- only change this!
local icons = 
	{
	"red_faction",
	"blue_faction",
	--"factionname_faction",
	}
	
Assets = {}
for k,v in pairs(icons) do
	if io.open(MODROOT.."anim/"..v..".zip") ~= nil then
	    Assets[k] = Asset("ANIM", "anim/"..v..".zip")
	end
end

AddPrefabPostInit("world", function(inst)
    for k,v in pairs(icons) do 
	    inst.facicons[k] = v 
	end    	
end)

 

current functionalities:

use player.components.faction:...

...SetFaction("factionname")   to change a players faction ( if there is a valid icon for the faction it will be applied automatically)

...GetFaction() returns the players faction

...HasFaction() returns true if faction isnt nil else returns false

...SetIcon("factionname_faction") sets a new icon while maintaining the current faction

 

defaults:

new players factions are set to neutral by default = pvp off

player factions are saved and loaded on disconnect. Resetting the world will reset factions too.

====================================================================

current release:

v1.0.7
- hotfix

previous versions:

Spoiler

v1.0.1
- first public release

v1.0.2
- fixed bug where sometimes icons werent displayed

v.1.0.3
- bugfixes

v.1.0.4
- even more bugfixes

v.1.0.5
- added ladder framework

v1.0.6
- removed ladder function as it makes no sense for this framework
  will create a new mod for that
- improved implementation for your own custom icons.
- clean up of code structure

 

 

upcoming releases:

v 1.1.0:

new feature: ladder support canceled and exported into an independent mod as it makes no sense to integrate this here

- the obvious a ladder system to store and display the players achievements in pvp

- stores and reads from data in a csv. That way multiple servers on the same machine can access the same ladder table

- table size and contents can be adjusted by creating a startup fileexported.zip

Edited by Andmann
new version 1.0.7

haha =)

well for now I added a general icon support =)

all it needs is a properly named animation. "factionname_faction" for bank and build "idle" for the animation and - Tada -  it'll pop over the faction members head. Obviously an animated icon with this implementation is absolutely within scope.

 

Things that are currently in the planning:

interfaces to access factions:

- chat commands(e.g. "/joinfaction factionname") , npcs, eventtriggers

guilds ( having a leader etc with certain access rights)

on the grand scale I want to open a dedicated Sandbox server with access tp inbuilt round based ladder pvp features etc.. =)

and a shard based survival mode server where two teams survive competitively with an extremly hostile underground cave connecting the two teams. So raiding is possible but difficult :) which ever team dies out first wins ofc =D

Edited by Andmann

the shard wars with a cave connecting the two is alright but eliminates the necessity to fight.  While it preserves the worlds for each team to have at equally, the need to fight over desirable resources kinda fuels the pvp environment.  The best mode to build toward is a capture the flag using glommer and chester as the flags.  That would require making glommer spawn on day 1 and raising(or lowering to 0 like the pig king) the life of glommer and chester to a number impossible to kill or ramping up their regeneration rate to that which again would make them unkillable.  The hardest part, that I can think of, is creating a zone or detection in each team base that would indicate the opponents flag has been captured and delivered declaring a winner.

Regardless I've been waiting for faction fighting for a VERY long time.  I hope this can hit the ground running

 

15 hours ago, Clwnbaby said:

the shard wars with a cave connecting the two is alright but eliminates the necessity to fight.  While it preserves the worlds for each team to have at equally, the need to fight over desirable resources kinda fuels the pvp environment.  The best mode to build toward is a capture the flag using glommer and chester as the flags.  That would require making glommer spawn on day 1 and raising(or lowering to 0 like the pig king) the life of glommer and chester to a number impossible to kill or ramping up their regeneration rate to that which again would make them unkillable.  The hardest part, that I can think of, is creating a zone or detection in each team base that would indicate the opponents flag has been captured and delivered declaring a winner.

Regardless I've been waiting for faction fighting for a VERY long time.  I hope this can hit the ground running

 

that entirely depends on how big each world would be :p I just think this would retain more of the spirit of survival mode.

capture the flag using chester is a really nice idea. for that to work the owner of the eye would have to suffer a speed reduction =) - but I think that is entirely doable. I just think Arena combat like that is more suitable for a sandbox server and not survival mode.

Edited by Andmann
18 hours ago, artemiyME said:

I support your development, seems like fun turn of pvp dirrection, if you can figure out how to add more shards to server and make game reset when one team wins - you can have my babies servers

Well I basically already figured that out. it isn't that hard theres a guide from kleis mod support even on how to configure the servers. SO In theory it shouldn't be that hard. More importantly resetting the server when all member sof a faction die could be interesting. then again. if the code for a standart reset is in the scriptfiles it would need a max of one line of code =D to adjust that :).

- I'll take the babies ! They will make a great addition to my ice box stash for the coming winter :shock:

 

Right now I am more worried about:

1. I really should be stuyding for my math exam tomorrow D:

2. how to best setup the teams etc... and whether to use custom or random worlds or if a mix is possible and more importantly : HOW MUCH FREAKING WORK WILL THAT BE >_>  :D

3. YOU! EXAM! TOMORROW!

4. I almost forgot about that one... I need test subjects ! Lots of guinea pigs !

Edited by Andmann
Guinea pigs!

as long as your meat is nice and tender thats fine ^_^

I'll start setting up a dedicated server on my machine for testing purposes.  Add a "lobby" camp  and a very basic script that just periodically sends people out to survival "hell" ^_^.

Once that one runs I'll start improving the logic  and eventuall add more shards. 

3 hours ago, Andmann said:

for that to work the owner of the eye would have to suffer a speed reduction =)

huh?  why?  that doesn't make any sense whatsoever.  unless you're purposely making whoever captures the flag easier to catch, which is kinda lame. 

12 minutes ago, Clwnbaby said:

huh?  why?  that doesn't make any sense whatsoever.  unless you're purposely making whoever captures the flag easier to catch, which is kinda lame. 

you'd think so - but consider what happens when someone has the flag and everyone runs at the same speed?

You won't ever be able to catch the flag bearer in such a scenario

51 minutes ago, Andmann said:

you'd think so - but consider what happens when someone has the flag and everyone runs at the same speed?

You won't ever be able to catch the flag bearer in such a scenario

maybe add running? I read in shipwreck the monkey is able to run... it could cost hunger, but of course I have no clue, how to mod this :D

well lets worry about that when the time comes.

I just finished creating an ice box that will never run out of meatballs for the lobby ^_^ 2morrow I'll finish up the lobby so players don't die or suffer while waiting for other contestants. I'll also add the two spawns for the two teams. I found something really nice that will help me with the setup. So I'm positive that I'll be done in a couple of hours.

What will be left then is scripting the event that assigns players to their teams and sends them off into the wilds (and removes all their hoarded Meatballs!)

and of course the 2nd event that will reset the server when one team wins =)

 

tho we could discuss about automatic respawn yes or no? if yes how long should the deathtimer be? should there be a scaling deathtimer?

if no? will revival be allowed at all? survival games can last for HOURS! If the players are descent and the option for hearts.

I also plan on adding a new feature but only once the basic are finished.

Creating or lighting a camp fire during the day will be revealed on the mini map. Immersion in a sense that people would spot the smoke. and thus you'd know where enemies might have set up their camp or spotting the last run aways :)

Edited by Andmann

Whoa! what a day =D

factions is up online on the workshop and will receive an update tomorrow.

TeamSurvival is almost ready for upload ^_^  I just have one last thing to sort out...

Currently I'm running my script through "TheWorld:PushEvent("ms_nextphase", myfunction)" I need something different... as it only procs manually. And for the love of god I havent been able to link it to anything clock related :/ really am in a slump right now

Any ideas for a better alternative?

once these issues are sorted out. Ill start hosting a dedicated server. Hopefully people will join ^_^ I will need feedback for further improvements.

 

once all that is sorted out I will begin writing scripts for turn based arena combat on a sandbox server - such as capture the flag, TeamDeathmatch etc...

and once that is complete which will probly take me a while =D we'll see if I still want to continue ^_^ I believe the GUI is quite moddable too? So an actual guild system with a guild tab should be doable right?

This isn't a release yet but a little sneakpeak. I still have some minor issues to sort out like getting the right playerID.

As well as a bigger issue: how to best synch the file across multiple servers running at the same time without causing lag to the servers. Thinking of an advanced form of the dirtybit technique to be appropriate but I'll have to test and see ^_^ so heres what to expect:

v 1.1.0:

new feature: ladder support

- the obvious a ladder system to store and display the players achievements in pvp

- stores and reads from data in a csv. That way multiple servers on the same machine can access the same ladder table

- table size and contents can be adjusted by creating a startup file

 

v 1.2.0:

- sql support for ladder to allow synching of multiple server data on differing machines

version 1.0.7 is out.

I believe this release is close to becoming stable.

The only way that you would probably crash this version would be by assigning a non string value to a factions name - just don't do it ! =D

I removed the ladder functionality as it simply doesn't fit in here. I'm planning on releasing an independant framework for general ladder functionalities. But ladders aren't my main priority atm as it isn't a very important feature for now.

my next releases focus on making everything stable and then adding new features according to feedback or optimising runtimes. And then I guess we can call it the final version at some point.

 

there's a few people who already use the framework. I hope the newest update doesn't break anything for you. I removed quite a few chunks of codes. It might happen ( sorry). There won't be any major restructuring of the code or removals in the future.

how do you do the factions name stuff? Why should a non string value not work? So a name like 2 would not work?
If it is in lua code, you can just use "tostring()" to make anything to string, also a nil value. Or is the problem more difficult?

well I have one line of code that I'm too lazy to fix right now lol...

        TheNet:Announce(self.inst:GetDisplayName().." has changed faction to "..self.faction)

a number for a name shouldn't cause problems. I think Lua can concat numbers and strings no problem. but anything else like a bool would probably crash it. 

to string() would be the fix yeah. I will add it in the next release.

 

Edited by Andmann

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...