Page 1 of 1

Map and Neutral Object.

Posted: 19 Sep 2010, 14:21
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.

Re: Map and Neutral Object.

Posted: 19 Sep 2010, 14:45
by jK
You have to use Spring.SetUnitNeutral, there is no neutral UnitDef tag it seems.

Re: Map and Neutral Object.

Posted: 25 Dec 2010, 13:15
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??

Re: Map and Neutral Object.

Posted: 25 Dec 2010, 15:14
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)

Re: Map and Neutral Object.

Posted: 25 Dec 2010, 20:56
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

Re: Map and Neutral Object.

Posted: 26 Dec 2010, 04:22
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?

Re: Map and Neutral Object.

Posted: 26 Dec 2010, 10:05
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

Re: Map and Neutral Object.

Posted: 26 Dec 2010, 12:07
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.

Re: Map and Neutral Object.

Posted: 26 Dec 2010, 12:22
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??

Re: Map and Neutral Object.

Posted: 26 Dec 2010, 16:39
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)?

Re: Map and Neutral Object.

Posted: 26 Dec 2010, 19:30
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

Re: Map and Neutral Object.

Posted: 26 Dec 2010, 20:12
by smoth
well, honestly if that is the case you can try and catch me in lobby. I am usually in #gundam

Re: Map and Neutral Object.

Posted: 31 Dec 2010, 15:39
by knorke
try
Spring.SetUnitNeutral (u, true)

or try setting nochasecategory in unitdefs

Re: Map and Neutral Object.

Posted: 01 Jan 2011, 08:55
by daryl
knorke wrote:try
Spring.SetUnitNeutral (u, true)

or try setting nochasecategory in unitdefs

finally! it's working :)

thx to all!!!