Page 1 of 2

[Changed] Neutral units?

Posted: 22 Nov 2007, 02:11
by Sheekel
My mod requires that the player captures neutral feature around the map, and that the features become part of the player's team, adopt the teamcolor, and "activate" as units. Is this possible?

Posted: 22 Nov 2007, 02:23
by trepan
Yup, it's easy.
LuaRules is probably what you want (or LuaCob).

Posted: 06 Dec 2007, 18:58
by kiki
CTF?

Posted: 06 Dec 2007, 19:42
by AF
whats ctf?

Posted: 06 Dec 2007, 19:47
by Tobi
Capture The Flag

Re: [Changed] Neutral units?

Posted: 06 Dec 2007, 21:25
by KDR_11k
Sheekel wrote:My mod requires that the player captures neutral feature around the map, and that the features become part of the player's team, adopt the teamcolor, and "activate" as units. Is this possible?
I have a King of the Doomsday game option in Fibre now (not released). There's a neutral unit that, when captured and supplied with enough energy, can fire devastating laser beams.

It's probably better to use a neutral unit (assign to Gaia team and SetUnitNeutral()) than a feature.

Posted: 08 Dec 2007, 22:59
by DOT
AF wrote:whats ctf?
in teh capture teh flags

yoo capture with yer big butt to teh enemy flag and going with yer big butt to your base and touching yer flag and yer team will gain -1 points

epic lulz

this is a reply

Posted: 20 Dec 2007, 13:29
by HildemarDasce
Would it be possible to do the same thing with buildings inherent to the map (rather than buildings spawned by the mod)?
So, you can capture for example factories that were placed when constructing the map.

Posted: 20 Dec 2007, 16:58
by KDR_11k
Sure. Maps can run Lua too.

Posted: 20 Dec 2007, 17:48
by HildemarDasce
Great! Thanks.

Posted: 20 Dec 2007, 18:04
by SinbadEV
Uhm, no, it's not capture the flag, what you are refering to is "steal the bacon" or "Extreme Murder Ball"... unless you mean the capture the flag where the opponents can't move their own flag... in which case you'd need an additional way to only allow the flag to be captured by the correct team.

No Sheekel is actually probably talking about his Spring Wars game where you will need to capture resource generation units and bases to win and there will be neutral copies on the map to start with.

Re: [Changed] Neutral units?

Posted: 02 Jan 2008, 23:23
by Argh
I've been trying to get Units to spawn as truly neutral, and anything on non-Gaia teams fires on them, and vice-versa.

Um... wtf? I thought Gaia was, by definition, supposed to be neutral, unless specified otherwise. At any rate, how do I change everything that's been assigned to Spring.GetGaiaTeamID to Spring.SetUnitNeutral??? I mean, if I'm Creating a unit like this:

Spring.CreateUnit("GaiaUnit", x,y,z, 0, Spring.GetGaiaTeamID())

... is it just a param, and where does it go? Or what?

I have 90% of a working randomizer for the vast majority of maps, including some nifty animated stuff (my whole using Units instead of Features thing is almost done), but this part is being a royal pain- I need some things to be hostile to all players, and some to be true neutral, so that players can capture them and use them without having to fight them first...

Re: [Changed] Neutral units?

Posted: 02 Jan 2008, 23:59
by imbaczek
Gaia is neutral as in "it's neither us nor them, so shoot it anyway" by default; it's changeable (Fibre does this I believe), but I don't know how 8)

Re: [Changed] Neutral units?

Posted: 03 Jan 2008, 00:13
by Argh
<checks Fibre>

Ah, it's in Charge.lua. And it is per-unit. Thank goodness. Now I just need to figure out how to apply it and I'm all set.

Re: [Changed] Neutral units?

Posted: 03 Jan 2008, 02:08
by Argh
Hmm. Still stuck on making things neutral. The main code, for placing everything, works just fine. I can make everything neutral, at this point, but I'm still stuck on making things selectively neutral.

Here's the code I'm currently using... any ideas where things are going wrong? gaia_fusion is obviously returning 0 every time...

Code: Select all

if (gadgetHandler:IsSyncedCode()) then
--------------------------------------------------------------------------------
--  SYNCED
--------------------------------------------------------------------------------

gaia_fusion = UnitDefNames.GaiaFusion.id

	function gadget:GameFrame(f)
		if((f - 8) % 16 < 0.1) then	
	
			for _,u in ipairs(Spring.GetTeamUnits(Spring.GetGaiaTeamID())) do	
		
	
				if (Spring.GetUnitDefID(u) == gaia_fusion) then
					Spring.SetUnitNeutral(u, true)
				end	
			end
		end	
	end	
end

Re: [Changed] Neutral units?

Posted: 03 Jan 2008, 02:20
by jK
changelog.txt wrote: - UnitDef names are always lower case now.

Re: [Changed] Neutral units?

Posted: 03 Jan 2008, 02:22
by Argh
Just in LUA? Or do I have to do that in my FBIs, too?

[edit]

Ok, just in LUA. And now the whole thing works. Muahaha, maps, at least in PURE, will never be the same :twisted:

Soooo... now all I've gotta do is figure out how to set this up to read from a config list, and maybe even set up placement from those lists output from the "scenario builder" <gasp, pant> so that we have a complete tool for mappers, scenario designers, et al. worth releasing under GPL... <pores over list stuff>

Re: [Changed] Neutral units?

Posted: 03 Jan 2008, 02:24
by jK
only in lua

Re: [Changed] Neutral units?

Posted: 03 Jan 2008, 03:14
by Argh
Huh. Apparently "neutral" units will still attempt to attack players, even if players don't want to attack them!

I guess I can send a value to COB, halting all aim functions on something that's "neutral", but that just seems like a bug to me- first the default of "neutral" being "shoot at me", then "neutral" being "shoot at everybody who is not me"...

Re: [Changed] Neutral units?

Posted: 03 Jan 2008, 03:25
by Argh
Double huh. AIs crash Spring when loaded onto a map with Neutral units :?