Map and Neutral Object.

Map and Neutral Object.

Discuss maps & map creation - from concept to execution to the ever elusive release.

Moderator: Moderators

Post Reply
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Map and Neutral Object.

Post by daryl »

Hola,
I have a little problem with neutral "dinamic" object:
this objects are neutral ( see white object), but the attacker units ( blue ) continue to engage neutral object, but they don't shot.
Image


And in a large battle some units ( blue) don't shot the enemy (red ) because they are engaging neutral object.
Image


I created this units between the file: \LuaRules\Gadgetsunitàiniziali.lua
of the map folder.

I used WORLD_BUILDER SCRIPT to create these two neutral units

Code: Select all

local u
local CreateUnit = Spring.CreateUnit
local GetGaiaTeamID = Spring.GetGaiaTeamID
local GiveOrderToUnit = Spring.GiveOrderToUnit
local AddBuildOrders = Spring.AddBuildOrders
local CreateFeature = Spring.CreateFeature


function GameStart()
u = CreateUnit("generatore",2867,0,1434,0,GetGaiaTeamID())
u = CreateUnit("generatore",2867,0,1770,90,GetGaiaTeamID())
in the FBI of the unit "generatore" I setted these values:
stealth=1;
gaia=1;
neutral=1;

so... How can I set these objects as neutral??
I would not want attacker try to engage neutral units.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Map and Neutral Object.

Post by jK »

You have to use Spring.SetUnitNeutral, there is no neutral UnitDef tag it seems.
Last edited by jK on 22 Sep 2010, 08:15, edited 1 time in total.
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Map and Neutral Object.

Post by daryl »

jK wrote:You have to use Spring.SetUnitNeutral, there is no neutral UnitDef tag it seems.
Can you help me please? i'm not a good scripter.
what I need to write??
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Map and Neutral Object.

Post by Beherith »

Should work:
Documentation here

Code: Select all

local u
local CreateUnit = Spring.CreateUnit
local GetGaiaTeamID = Spring.GetGaiaTeamID
local GiveOrderToUnit = Spring.GiveOrderToUnit
local AddBuildOrders = Spring.AddBuildOrders
local CreateFeature = Spring.CreateFeature


function GameStart()
u = CreateUnit("generatore",2867,0,1434,0,GetGaiaTeamID())
Spring.SetUnitNeutral(u)
u = CreateUnit("generatore",2867,0,1770,90,GetGaiaTeamID())
Spring.SetUnitNeutral(u)
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Map and Neutral Object.

Post by daryl »

Beherith wrote:Should work:
Documentation here

Code: Select all

local u
local CreateUnit = Spring.CreateUnit
local GetGaiaTeamID = Spring.GetGaiaTeamID
local GiveOrderToUnit = Spring.GiveOrderToUnit
local AddBuildOrders = Spring.AddBuildOrders
local CreateFeature = Spring.CreateFeature


function GameStart()
u = CreateUnit("generatore",2867,0,1434,0,GetGaiaTeamID())
Spring.SetUnitNeutral(u)
u = CreateUnit("generatore",2867,0,1770,90,GetGaiaTeamID())
Spring.SetUnitNeutral(u)

hi behe, i'm sorry but i don't know LUA script...
thx for answer.
so, I tried your code but i meet the same conditions:
at start of the game the script create the generators, they are neutral but the units try to attack it, but don't fought...
I can order to my units to attack the generators, they try to attack but don't fight.

i would like that the units don't try to attack the generators becouse the generators would be neutral
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Map and Neutral Object.

Post by smoth »

Worldbuilder is not widely used. I can teach you how to use feature placer as an alternative. What are the needs of your map?
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Map and Neutral Object.

Post by daryl »

smoth wrote:Worldbuilder is not widely used. I can teach you how to use feature placer as an alternative. What are the needs of your map?

hi smoth,
i'm doing a mission on my map. Simply i would like add some dinamic capturable features. But it is not important.
I know, at the moment, how to add static reclaimable features ( I use MapConv to do this).
I am glad if you can teach me alternative feature placer.


thx
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Map and Neutral Object.

Post by Beherith »

I was under the impression units shouldnt target neutrals. If this is the case, then this may be an engine bug. If so, Ill file a bug report.
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Map and Neutral Object.

Post by daryl »

Beherith wrote:I was under the impression units shouldnt target neutrals. If this is the case, then this may be an engine bug. If so, Ill file a bug report.
I created i file named "start.lua" into "LuaRules\Gadgets" folder of my map contains.
Start.lua have this code now (thx behe):

Code: Select all

function gadget:GetInfo()
	return {
		name = "initial_units",
		desc = "add some units at start of game.",
		author = "daryl - www.totalannihilation.it - www.springrts.com",
		date = "September 19st, 2010",
		license = "GPL, v.2, 2008",
		layer = 1,
		enabled = true,
	}
end


local u
local CreateUnit = Spring.CreateUnit
local GetGaiaTeamID = Spring.GetGaiaTeamID
local GiveOrderToUnit = Spring.GiveOrderToUnit
local AddBuildOrders = Spring.AddBuildOrders
local CreateFeature = Spring.CreateFeature


function GameStart()
u = CreateUnit("generatore",2867,0,1434,0,GetGaiaTeamID())
Spring.SetUnitNeutral(u)
u = CreateUnit("generatore",2867,0,1770,90,GetGaiaTeamID())
Spring.SetUnitNeutral(u)

when i'm in the game, my units or enemy units try to engage neutral object but they don't fire.
( see image above).

so. It's a game bug??
I need to report this??
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Map and Neutral Object.

Post by smoth »

A few questions,

can you use mumble( a voice chat program)? "
where are you, like what country/timezone if your country is big(so I can have an idea when you are awake)?
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Map and Neutral Object.

Post by daryl »

smoth wrote:A few questions,

can you use mumble( a voice chat program)? "
where are you, like what country/timezone if your country is big(so I can have an idea when you are awake)?
hi smoth,
I'm Italian and now are the 19.24 PM ( use Rome time )
I'm sorry but i can't speak becouse my english spoken suck!. I can try to speak a bad english but I don't understand english spoken :)

But I can write and read english, if you want add me in msn, molixx81 @@ hotmail dot com or tell me if you use other chat client
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Map and Neutral Object.

Post by smoth »

well, honestly if that is the case you can try and catch me in lobby. I am usually in #gundam
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Map and Neutral Object.

Post by knorke »

try
Spring.SetUnitNeutral (u, true)

or try setting nochasecategory in unitdefs
User avatar
daryl
Posts: 195
Joined: 08 Oct 2006, 10:33

Re: Map and Neutral Object.

Post by daryl »

knorke wrote:try
Spring.SetUnitNeutral (u, true)

or try setting nochasecategory in unitdefs

finally! it's working :)

thx to all!!!
Post Reply

Return to “Map Creation”