Page 1 of 1

Random hero script? [Solved]

Posted: Sat May 31, 2014 10:51 am
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

Re: random hero script?

Posted: Sat May 31, 2014 11:04 am
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

Re: random hero script?

Posted: Sat May 31, 2014 1:50 pm
by RacoonLR
OK I'll try that, do you know if this script is compatible with the al hero script?