[Changed] Neutral units?

[Changed] Neutral units?

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Sheekel
Posts: 1391
Joined: 19 Apr 2005, 19:23

[Changed] Neutral units?

Post 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?
Last edited by Sheekel on 23 Nov 2007, 06:21, edited 2 times in total.
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Yup, it's easy.
LuaRules is probably what you want (or LuaCob).
User avatar
kiki
Posts: 859
Joined: 05 Nov 2007, 03:06

Post by kiki »

CTF?
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

whats ctf?
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Capture The Flag
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: [Changed] Neutral units?

Post 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.
User avatar
DOT
Posts: 138
Joined: 26 Nov 2007, 15:39

Post 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
User avatar
HildemarDasce
Posts: 74
Joined: 13 Nov 2005, 12:06

Post 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.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Sure. Maps can run Lua too.
User avatar
HildemarDasce
Posts: 74
Joined: 13 Nov 2005, 12:06

Post by HildemarDasce »

Great! Thanks.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [Changed] Neutral units?

Post 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...
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: [Changed] Neutral units?

Post 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)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [Changed] Neutral units?

Post 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.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [Changed] Neutral units?

Post 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
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: [Changed] Neutral units?

Post by jK »

changelog.txt wrote: - UnitDef names are always lower case now.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [Changed] Neutral units?

Post 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>
Last edited by Argh on 03 Jan 2008, 02:28, edited 1 time in total.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: [Changed] Neutral units?

Post by jK »

only in lua
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [Changed] Neutral units?

Post 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"...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: [Changed] Neutral units?

Post by Argh »

Double huh. AIs crash Spring when loaded onto a map with Neutral units :?
Post Reply

Return to “Lua Scripts”