Random hero script? [Solved]

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
RacoonLR
Second Lance Corporal
Second Lance Corporal
Posts: 105
Joined: Fri Apr 25, 2014 5:31 pm
xbox live or psn: No gamertag set
Location: UNDER YOUR BED

Random hero script? [Solved]

Post by RacoonLR »

does someone know a lua script for random Heros?
I want to Play on kashyyyk either as obi-wan or plo-koon,
but I don't have any script for it.
Please Help
Last edited by RacoonLR on Sun Jun 01, 2014 3:27 pm, edited 1 time in total.
Marth8880
Resistance Leader
Posts: 5042
Joined: Tue Feb 09, 2010 8:43 pm
Projects :: DI2 + Psychosis
Games I'm Playing :: Silent Hill 2
xbox live or psn: Marth8880
Location: Edinburgh, UK
Contact:

Re: random hero script?

Post by Marth8880 »

Put this at beginning of your mission script:

Code: Select all

RandomHeroes = math.random(1,2)
Replace your SetHeroClass line with this:

Code: Select all

	if not ScriptCB_InMultiplayer() then
		if RandomHeroes == 1 then
			SetHeroClass(REP, "hero1odfname")
		elseif RandomHeroes == 2 then
			SetHeroClass(REP, "hero2odfname")
		else end
	else
		SetHeroClass(REP, "heromultiplayerodfname")	-- since math.random crashes clients in multiplayer, you have to set a hero to be used in online matches
	end
RacoonLR
Second Lance Corporal
Second Lance Corporal
Posts: 105
Joined: Fri Apr 25, 2014 5:31 pm
xbox live or psn: No gamertag set
Location: UNDER YOUR BED

Re: random hero script?

Post by RacoonLR »

OK I'll try that, do you know if this script is compatible with the al hero script?
Post Reply