Developer PeterA Posted March 20, 2015 Developer Share Posted March 20, 2015 Hey everyone, For those of you who watched our twitch stream today (http://www.twitch.tv/kleientertainment), we showed off the Pig Feed Tournament game mode mod. It's available now on the Steam Workshop. http://steamcommunity.com/workshop/filedetails/?id=410100662 I'm also releasing the cooperative game mode, the Glutton. Where the object to the game is to eat as much calories as possible as a team. You individually build up a glutton bonus by eating, so to get the most points in the time limit, you'll want to collect resources and feed them into a single player. Team work is important here! Cooking and crock pots will also provide a bonus.http://steamcommunity.com/workshop/filedetails/?id=410100011 What this forum is probably more interested in is the usage of the mod RPCs. In both of these game modes, we experimented with a sprinting mechanic. Players can hold shift to sprint. Here's an example of how this works In modmain.lua, add a handler function to receive the callAddModRPCHandler( "pigfeed", "StartSprint",function(inst) --inst is the instance of the player who sent the RPC inst.components.locomotor:SetExternalSpeedMultiplier( inst, "sprinter", 1.5 ) inst.components.hunger.burnrate = 8end )In a replica component on your player inst (look at sprinter_replicae.lua)if not sprinting and TheInput:IsKeyDown(KEY_SHIFT) then SendModRPCToServer( MOD_RPC.pigfeed.StartSprint ) inst:PushEvent("sprinting") sprinting = trueelseif sprinting and not TheInput:IsKeyDown(KEY_SHIFT) then SendModRPCToServer( MOD_RPC.pigfeed.StopSprint ) sprinting = falseendThe key point here is see how we describe the RPC id in the first two parameters to AddModRPCHandler ("pigfeed", "StartSprint"), and then it's combined into MOD_RPC.pigfeed.StartSprint for sending.Please let me know if you have any questions! Link to comment Share on other sites More sharing options...
Mario384 Posted March 29, 2015 Share Posted March 29, 2015 Hmm, making a certain button activate something with your character is something I've been looking for... Thanks for posting this. Link to comment Share on other sites More sharing options...
Corrosive Posted April 3, 2015 Share Posted April 3, 2015 As a (mostly) Wolfgang player, I highly approve of this mod. Link to comment Share on other sites More sharing options...
Maris Posted September 25, 2015 Share Posted September 25, 2015 How to send a number from client to server? Link to comment Share on other sites More sharing options...
Developer PeterA Posted September 28, 2015 Author Developer Share Posted September 28, 2015 How to send a number from client to server? You'll want to look at the RPC code. SendModRPCToServer is the function you'll want to call, and if you include parameters after the rpc code parameter, they'll get sent along too.In the glutton mod, you can find this code in sprinter_replica.lua (SendModRPCToServer) and in main.lua (AddModRPCHandler). Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now