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: 190
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.
0 x

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.
0 x

User avatar
daryl
Posts: 190
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??
0 x

User avatar
Beherith
Moderator
Posts: 4958
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)
0 x

User avatar
daryl
Posts: 190
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
0 x

User avatar
smoth
Posts: 22300
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?
0 x

User avatar
daryl
Posts: 190
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
0 x

User avatar
Beherith
Moderator
Posts: 4958
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.
0 x

User avatar
daryl
Posts: 190
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??
0 x

User avatar
smoth
Posts: 22300
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)?
0 x

User avatar
daryl
Posts: 190
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
0 x

User avatar
smoth
Posts: 22300
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
0 x

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
0 x

User avatar
daryl
Posts: 190
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!!!
0 x

Post Reply

Return to “Map Creation”