SWBFGamers

Modding for the Original SWBF1 and SWBF2 => SWBF1 Modding Tutorials => Topic started by: SleepKiller on April 26, 2012, 04:21:29 PM

Title: [TUT]Setting up multiplayer specific LUA.
Post by: SleepKiller on April 26, 2012, 04:21:29 PM
I think the tittle was pretty descriptive. In this your going to learn how to do some basic LUA scripting to set up a test that if it is correct runs commands.

For starters go to some place in your mission script. Now type in.
if(ScriptCB_InNetGame()) then
Now this finds out if your in a net game, and if you are to then run the commands below the line.

We're not done yet. I'm using this to set-up Multiplayer only bleed. Although you could put anything you want here.
AddBleedThreshold(ATT, 31, 0.0)
AddBleedThreshold(ATT, 21, 0.75)
AddBleedThreshold(ATT, 11, 2.25)
AddBleedThreshold(ATT, 1, 3.0)
AddBleedThreshold(DEF, 31, 0.0)
AddBleedThreshold(DEF, 21, 0.75)
AddBleedThreshold(DEF, 11, 2.25)
AddBleedThreshold(DEF, 1, 3.0)
Example only, you can put anything there.

Now type this.
end
This ends the blockwithout it ScriptMunge and your game will crash.

Alternatively we could type in this instead of end.
else
And put some commands here that would run if the test failed.

so for instance we could put it instead of the CIS addclass section to make Countduko playable only in Singleplayer.
if(ScriptCB_InNetGame())then
AddUnitClass(CIS, "cis_inf_battledroid",10)
AddUnitClass(CIS, "cis_inf_assault",1)
AddUnitClass(CIS, "cis_inf_pilotdroid",2)
AddUnitClass(CIS, "cis_inf_assassindroid",2)
AddUnitClass(CIS, "cis_inf_droideka",1)
SetHeroClass(CIS, "cis_inf_countdooku")
else
AddUnitClass(CIS, "cis_inf_battledroid",10)
AddUnitClass(CIS, "cis_inf_assault",2)
AddUnitClass(CIS, "cis_inf_pilotdroid",2)
AddUnitClass(CIS, "cis_inf_assassindroid",2)
AddUnitClass(CIS, "cis_inf_countdooku",0)
SetHeroClass(CIS, "cis_inf_droideka")
end



Don't say I never share stuff.
Title: Re: [TUT]Setting up multiplayer specific LUA.
Post by: Des on April 26, 2012, 04:29:13 PM
You never share stuff


edit by buckler:  if you are going to be a smart-alec, at least put in a smiley  ;)
Title: Re: [TUT]Setting up multiplayer specific LUA.
Post by: SleepKiller on April 26, 2012, 04:41:02 PM
Quote from: Des on April 26, 2012, 04:29:13 PM
You never share stuff
The only thing I have to see to that is Rage's skin changer exists is because I chose to release my source scripts. End of discussion, please PM if you want to argue I don't want this topic locked.
Title: Re: [TUT]Setting up multiplayer specific LUA.
Post by: Snake on April 26, 2012, 04:50:09 PM
Quote from: SleepKiller on April 26, 2012, 04:21:29 PM
Don't say I never share stuff.

Why even start this? Good tutorial anyhow.
Title: Re: [TUT]Setting up multiplayer specific LUA.
Post by: Phobos on April 26, 2012, 04:50:52 PM
I am grateful for what assets and mod stuff SK has shared with the community, and yes the skin changer I made would not have been possible without the collaborative efforts of several great modders. Sleepkillers legion changer script, pandemics ifs_pausemenu script, and the skin mods of several Cloud city modders all went together in making it, along with 2 intense weeks of very challenging, but fun modding on my end.

Many of the stock mission LUAs have their own script annotated _h, which is for campaign mode I believe. This tutorial should provide mission modders tips for enhanced customization regarding differences in multiplayer and instant action singleplayer.
Title: Re: [TUT]Setting up multiplayer specific LUA.
Post by: Led on April 26, 2012, 05:11:47 PM
Very nice, SK.

I wonder if the commands that force players to particular teams would work if they are in between the IF THEN END statements.
Title: Re: [TUT]Setting up multiplayer specific LUA.
Post by: Des on April 26, 2012, 06:10:11 PM
You never share stuff ----->  ::) <------ i want to be a smart alec here is my smile
Title: Re: [TUT]Setting up multiplayer specific LUA.
Post by: Led on April 26, 2012, 06:17:35 PM
Quote from: Des on April 26, 2012, 06:10:11 PM
You never share stuff ----->  ::) <------ i want to be a smart alec here is my smile

Much better, now we can know you were kidding  :tu:
EhPortal 1.34 © 2024, WebDev