RAI attack Neutral units

RAI attack Neutral units

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

Moderator: Moderators

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

RAI attack Neutral units

Post by daryl »

Hi all,
when I start a singleplayer skirmish game all it's ok,
after some minutes only units controlled by RAI AI start to attack neutral units.
What can be the problem?
units are created in the map by this script:

Code: Select all

function gadget:GetInfo()
   return {
      name = "unita_iniziali",
      desc = "Aggiunge unità all'inizio del gioco.",
      author = "daryl ,  -- thx to http://springrts.com community,  knorke,  smoth,  Beherith,  jK .
      date = "September 19st,  2010",
      license = "GPL,  v.2,  2008",
      layer = 1,
      enabled = true,
   }
end
 
local gaiaTeamId        = Spring.GetGaiaTeamID()

-- metto lo spazioporto a parte in quanto può essere utilizzato nelle missioni 

-- all your units
local unitList = {
        { "palmforest006", 7321, 0, 8349, 0, gaiaTeamId },
        { "palmforest007", 7321, 0, 8461, 0, gaiaTeamId },
        { "palmforest008", 7321, 0, 8562, 0, gaiaTeamId },
        { "palmforest009", 7321, 0, 8665, 0, gaiaTeamId },
        { "palmforest007", 7446, 0, 8349, 0, gaiaTeamId },
        { "palmforest009", 7446, 0, 8461, 0, gaiaTeamId },
        { "palmforest006", 7446, 0, 8562, 0, gaiaTeamId },
        { "palmforest009", 7446, 0, 8665, 0, gaiaTeamId },
        { "palmforest009", 7548, 0, 8349, 0, gaiaTeamId },
        { "palmforest009", 9097, 0, 7861, 0, gaiaTeamId },
        { "palmforest008", 9097, 0, 7963, 0, gaiaTeamId },
        { "palmforest007", 9097, 0, 8065, 0, gaiaTeamId },
        { "eridlon_antenna", 8238, 0, 10361, 0, gaiaTeamId },
        { "eridlon_gate", 7080, 0, 10071, 0, gaiaTeamId },
        { "eridlon_gate_wall", 7300, 0, 10071, 0, gaiaTeamId },
        { "palmforest006", 9694, 0, 8116, 0, gaiaTeamId },
        { "palmforest007", 9638, 0, 8160, 0, gaiaTeamId },
        { "palmforest008", 9589, 0, 8185, 0, gaiaTeamId },
        { "palmforest009", 9423, 0, 8370, 0, gaiaTeamId },
        { "palmforest010", 9344, 0, 8327, 0, gaiaTeamId },
        { "palmforest011", 9832, 0, 7765, 0, gaiaTeamId },
        { "palmforest009", 8760, 0, 7671, 0, gaiaTeamId },
        { "palmforest007", 8860, 0, 7539, 0, gaiaTeamId },
        { "pala001", 8799, 0, 8310, 90, gaiaTeamId },
        { "pala002", 8799, 0, 8110, 0, gaiaTeamId },
        { "pala003", 8799, 0, 8010, 0, gaiaTeamId },
        { "pala004", 8799, 0, 7910, 0, gaiaTeamId },
        { "pala005", 8799, 0, 7810, 0, gaiaTeamId },
        { "pala004", 8899, 0, 7710, 0, gaiaTeamId },
        { "pala002", 8899, 0, 8310, 0, gaiaTeamId },
        { "pala005", 8899, 0, 8110, 0, gaiaTeamId },
        { "pala001", 8899, 0, 8010, 0, gaiaTeamId },
        { "pala003", 8899, 0, 7910, 0, gaiaTeamId },
        { "pala005", 8899, 0, 7810, 0, gaiaTeamId },
        { "pala005", 8999, 0, 7710, 0, gaiaTeamId },
        { "pala003", 8999, 0, 8110, 0, gaiaTeamId },
        { "pala004", 8999, 0, 8010, 0, gaiaTeamId },
        { "pala002", 8999, 0, 7910, 0, gaiaTeamId },
        { "pala001", 8999, 0, 7810, 0, gaiaTeamId },
        { "eridlon_semaforo_60", 7675, 0, 8327, 0, gaiaTeamId },
        { "eridlon_semaforo_60", 7720, 0, 8364, 0, gaiaTeamId },
        { "eridlon_semaforo_sx", 7324, 0, 8324, 0, gaiaTeamId },
        { "eridlon_semaforo", 7346, 0, 8340, 0, gaiaTeamId },
        { "eridlon_semaforo", 7421, 0, 8340, 0, gaiaTeamId },
        { "eridlon_semaforo_dx", 7438, 0, 8250, 0, gaiaTeamId },
        { "pala001", 9199, 0, 7710, 180, gaiaTeamId },
        { "pala005", 9199, 0, 7610, 0, gaiaTeamId },
        { "pala007", 9199, 0, 8110, 0, gaiaTeamId },
        { "pala004", 9199, 0, 8010, 0, gaiaTeamId },
        { "pala002", 9199, 0, 7910, 90, gaiaTeamId },
        { "pala002", 9199, 0, 7810, 0, gaiaTeamId },
        { "pala001", 9299, 0, 7710, 90, gaiaTeamId },
        { "pala005", 9299, 0, 7610, 0, gaiaTeamId },
        { "pala003", 9299, 0, 8110, 0, gaiaTeamId },
        { "pala001", 9299, 0, 8010, 270, gaiaTeamId },
        { "pala002", 9299, 0, 7910, 0, gaiaTeamId },
        { "pala004", 9299, 0, 7810, 0, gaiaTeamId },
        { "pala001_d", 5585, 0, 7910, 0, gaiaTeamId },
        { "pala004_d", 5685, 0, 7910, 0, gaiaTeamId },
        { "pala002_d", 5785, 0, 7910, 0, gaiaTeamId },
        { "pala005_d", 5785, 0, 8010, 90, gaiaTeamId },
        { "pala001_d", 5785, 0, 8310, 90, gaiaTeamId },
        { "pala002_d", 5785, 0, 8410, 90, gaiaTeamId },
        { "pala004_d", 5685, 0, 8410, 90, gaiaTeamId },
        { "pala005_d", 5585, 0, 8410, 90, gaiaTeamId },
        { "pala003_d", 5585, 0, 8510, 90, gaiaTeamId },
        { "pala003_d", 5685, 0, 8510, 0, gaiaTeamId },
        { "pala003_d", 5785, 0, 8510, 180, gaiaTeamId },
        { "pala003", 5885, 0, 8510, 90, gaiaTeamId },
        { "pala004", 5985, 0, 8510, 90, gaiaTeamId },
        { "pala002", 5885, 0, 8410, 90, gaiaTeamId },
        { "pala001", 5985, 0, 8410, 90, gaiaTeamId },
        { "palmforest006", 7798, 0, 8152, 90, gaiaTeamId },
        { "palmforest007", 7683, 0, 8178, 90, gaiaTeamId },
        { "palmforest008", 7784, 0, 8202, 90, gaiaTeamId },
        { "palmforest009", 7397, 0, 10379, 90, gaiaTeamId },
        { "palmforest010", 7382, 0, 10450, 90, gaiaTeamId },
        { "rock010", 7348, 0, 9708, 90, gaiaTeamId },
        { "rock011", 7364, 0, 9753, 90, gaiaTeamId },
        { "palmforest011", 7369, 0, 9564, 90, gaiaTeamId },
        { "rock010", 7583, 0, 8814, 90, gaiaTeamId },
        { "rock011", 7597, 0, 8767, 90, gaiaTeamId },
        { "rock012", 7526, 0, 8835, 90, gaiaTeamId },
        { "palmforest011", 6803, 0, 8150, 0, gaiaTeamId },
        { "palmforest009", 6941, 0, 8290, 0, gaiaTeamId },
        { "palmforest010", 6867, 0, 8105, 0, gaiaTeamId },
        { "eridlon_antenna", 5966, 0, 7938, 0, gaiaTeamId },
        { "eridlon_fence", 7070, 0, 11615, 0, gaiaTeamId },
        { "eridlon_fence", 7070, 0, 11215, 0, gaiaTeamId },
        { "eridlon_fence", 7070, 0, 11015, 0, gaiaTeamId },
        { "eridlon_fence", 7070, 0, 10815, 0, gaiaTeamId },
        { "eridlon_fence", 7070, 0, 10615, 0, gaiaTeamId },
        { "eridlon_fence", 7070, 0, 10415, 0, gaiaTeamId },
        { "eridlon_fence_dx", 7255, 0, 11615, 0, gaiaTeamId },
        { "eridlon_fence_dx", 7255, 0, 11415, 0, gaiaTeamId },
        { "eridlon_fence_dx", 7255, 0, 11215, 0, gaiaTeamId },
        { "eridlon_fence_dx", 7255, 0, 10815, 0, gaiaTeamId },
        { "eridlon_fence_dx", 7255, 0, 10615, 0, gaiaTeamId },
        { "eridlon_fence_dx", 7255, 0, 10415, 0, gaiaTeamId },
        { "car001", 9019, 0, 8166, 45, gaiaTeamId },
        { "bridge_destroy", 4468, 0, 6005, 0, gaiaTeamId },
        { "bridge_destroy2", 4468, 0, 4636, 0, gaiaTeamId },



        { "pala001_d", 3083, 0, 10770, 0, gaiaTeamId },
        { "pala001_d", 3453, 0, 10573, 0, gaiaTeamId },
        { "pala001_d", 3555, 0, 10573, 0, gaiaTeamId },
        { "pala001_d", 3453, 0, 10670, 0, gaiaTeamId },
        { "pala001_d", 3555, 0, 10670, 0, gaiaTeamId },

        { "palmforest006", 9096, 0, 8167, 90, gaiaTeamId },
        { "palmforest008", 9096, 0, 7760, 90, gaiaTeamId },
        { "palmforest009", 9096, 0, 7658, 90, gaiaTeamId },

        { "ruspa_gru", 3388, 0, 10748, 0, gaiaTeamId },
        { "ruspa", 3219, 0, 10787, -90, gaiaTeamId },

        { "eridlon_pala_eolica", 1076, 0, 11265, 0, gaiaTeamId },
        { "eridlon_pala_eolica", 1224, 0, 11668, 0, gaiaTeamId },
        { "eridlon_pala_eolica", 1688, 0, 11538, 0, gaiaTeamId },

        { "eridlon_pala_eolica", 7806, 0, 10181, 0, gaiaTeamId },

        { "eridlon_pala_eolica", 10285, 0, 10402, 0, gaiaTeamId },
        { "eridlon_pala_eolica", 10149, 0, 10710, 0, gaiaTeamId },
        { "eridlon_pala_eolica", 9865, 0, 10868, 0, gaiaTeamId },

--palazzi in basso a sx
	{ "pala001", 2726, 0, 10800, 180, gaiaTeamId },
        { "pala005", 2826, 0, 10800, 0, gaiaTeamId },
        { "pala007", 2926, 0, 10800, 0, gaiaTeamId },


{ "pala005", 2526, 0, 10150, 0, gaiaTeamId },
    
        { "pala004", 2826, 0, 9950, 0, gaiaTeamId },
        { "pala005", 2926, 0, 9950, 90, gaiaTeamId },
        { "pala001", 3026, 0, 9950, 0, gaiaTeamId },


        { "pala002", 2826, 0, 10050, 0, gaiaTeamId },
        { "pala003", 2926, 0, 10050, 90, gaiaTeamId },
        { "pala001", 3026, 0, 10050, 0, gaiaTeamId },




	{ "pala005", 2526, 0, 10150, 0, gaiaTeamId },
        { "pala003", 2626, 0, 10150, 0, gaiaTeamId },
        { "pala001", 2726, 0, 10150, 270, gaiaTeamId },
        { "pala002", 2826, 0, 10150, 0, gaiaTeamId },
        { "pala004", 2926, 0, 10150, 0, gaiaTeamId },
        { "pala004", 3026, 0, 10150, 0, gaiaTeamId },
        { "pala002", 3126, 0, 10150, 90, gaiaTeamId },
        { "pala002", 3226, 0, 10150, 0, gaiaTeamId },
        { "pala001", 3326, 0, 10150, 90, gaiaTeamId },
       

-- inserimento rocce 1

        { "eridlon_rock001", 4468, 0, 7786, 90, gaiaTeamId },
        { "eridlon_rock002", 4608, 0, 7596, 90, gaiaTeamId },
        { "eridlon_rock003", 4586, 0, 7738, 90, gaiaTeamId },
        { "eridlon_rock004", 4524, 0, 7500, 90, gaiaTeamId },
        { "eridlon_rock001", 4672, 0, 7446, 90, gaiaTeamId },
        { "eridlon_rock002", 4609, 0, 7372, 90, gaiaTeamId },
        { "eridlon_rock003", 4350, 0, 7937, 90, gaiaTeamId },




        { "eridlon_rock001", 4389, 0, 7821, 90, gaiaTeamId },
        { "eridlon_rock002", 4407, 0, 7765, 90, gaiaTeamId },
        { "eridlon_rock001", 4447, 0, 7734, 90, gaiaTeamId },
        { "eridlon_rock002", 4508, 0, 7740, 90, gaiaTeamId },
        { "eridlon_rock001", 4582, 0, 7444, 90, gaiaTeamId },
        { "eridlon_rock001", 4600, 0, 7496, 90, gaiaTeamId },
        { "eridlon_rock002", 4641, 0, 7473, 90, gaiaTeamId },
        { "eridlon_rock001", 4466, 0, 7637, 90, gaiaTeamId },
        { "eridlon_rock001", 4497, 0, 7671, 90, gaiaTeamId },
        { "eridlon_rock001", 4570, 0, 7652, 90, gaiaTeamId },

-- inserimento palme
        { "palmforest006", 4545, 0, 7406, 90, gaiaTeamId },
        { "palmforest007", 4467, 0, 7699, 90, gaiaTeamId },
        { "palmforest008", 4434, 0, 7783, 90, gaiaTeamId },
        { "palmforest009", 4642, 0, 7530, 90, gaiaTeamId },
        { "palmforest010", 4397, 0, 7903, 90, gaiaTeamId },

        { "palmforest011", 6514, 0, 5868, 90, gaiaTeamId },
        { "palmforest006", 6664, 0, 5824, 90, gaiaTeamId },
        { "palmforest007", 6597, 0, 5710, 90, gaiaTeamId },
        { "palmforest008", 6911, 0, 5733, 90, gaiaTeamId },
        { "palmforest009", 6881, 0, 5616, 90, gaiaTeamId },
        { "palmforest010", 6974, 0, 5644, 90, gaiaTeamId },



}
 
-- loop through unit list
for _,v in pairs( unitList) do
        local unitId = Spring.CreateUnit(v[1], v[2], v[3], v[4], v[5], v[6])
        if unitId ~= nil then
                Spring.SetUnitNeutral (unitId,  true)
                Spring.SetUnitAlwaysVisible(unitId,  true)
                Spring.SetUnitNoMinimap(unitId,  true)
        else
                Spring.Echo("failed to create unit", v[1])
        end




end
but i think it's all ok...
Do you have an idea??
abma
Spring Developer
Posts: 3721
Joined: 01 Jun 2009, 00:08

Re: RAI attack Neutral units

Post by abma »

daryl wrote:What can be the problem?
i guess its Spring.CreateUnit() vs Spring.CreateFeature() ?!

the ai seems to not ignore gaia units, not sure if this a bug or feature.

moved the thread to "Lua Scripts" as the people there can help better i guess.
User avatar
daryl
Posts: 192
Joined: 08 Oct 2006, 10:33

Re: RAI attack Neutral units

Post by daryl »

abma wrote:
daryl wrote:What can be the problem?
i guess its Spring.CreateUnit() vs Spring.CreateFeature() ?!

the ai seems to not ignore gaia units, not sure if this a bug or feature.

moved the thread to "Lua Scripts" as the people there can help better i guess.

hello, because no answer to my problem i decided to make all of the units as features instead as units. Naturally have not animation (features are static right?) and my new answer is: can features explode ? or they simple disappearing when healt = 0?
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10382
Joined: 24 Jan 2006, 21:12

Re: RAI attack Neutral units

Post by PicassoCT »

Features do not have lua scripts. Features can spawn other features on death.
Also feature performance compared to unit performance is bad. (Perma visibility and transparency).

What is it that makes a man neutral?
Money?
Gold?
Woman?
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10382
Joined: 24 Jan 2006, 21:12

Re: RAI attack Neutral units

Post by PicassoCT »

PicassoCT wrote:Features do not have lua scripts. Features can spawn other features on death.
Also feature performance compared to unit performance is bad. (Perma visibility and transparency).

"What is it that makes a man neutral?
Money?
Gold?
Woman?"
Zap Brannigan
User avatar
daryl
Posts: 192
Joined: 08 Oct 2006, 10:33

Re: RAI attack Neutral units

Post by daryl »

PicassoCT wrote:Features do not have lua scripts. Features can spawn other features on death.
Also feature performance compared to unit performance is bad. (Perma visibility and transparency).
I had no alternative because RAI attack neutral units (i mean GAIA Units)-
Thx for info!
Post Reply

Return to “Lua Scripts”