Units on Fire - Modding Question

Units on Fire - Modding Question

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

Moderator: Moderators

Post Reply
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Units on Fire - Modding Question

Post by REVENGE »

I took the lateset units_on_fire luarule from CA, and now I'm trying to mod it so that instead of looking at the 'weapontype', it'll try and find the keyword "Flame" in the weapon category 'name' instead.

My (non-working) code:

Code: Select all

local flamerWeaponDefs = {}
for i=1,#WeaponDefs do
  if (WeaponDefs[i].name:find("Flame")) then --// == flamethrower
     --// 0.5 cus we want to differ trees an metal/tanks 
     --// (fireStarter-tag: 1.0->always flame trees, 2.0->always flame units/buildings too)
    flamerWeaponDefs[i]=WeaponDefs[i].fireStarter
  end
end
vs.
CA Original Code:

Code: Select all

local flamerWeaponDefs = {}
for i=1,#WeaponDefs do
  if (WeaponDefs[i].type=="Flame") then --// == flamethrower
     --// 0.5 cus we want to differ trees an metal/tanks 
     --// (fireStarter-tag: 1.0->always flame trees, 2.0->always flame units/buildings too)
    flamerWeaponDefs[i]=WeaponDefs[i].fireStarter
  end
end
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Units on Fire - Modding Question

Post by REVENGE »

My issue has been resolved by changing to the following:

Code: Select all

if (WeaponDefs[i].name:find("flame")) then --// == flamethrower
That, and I believe my search pattern was just wrong. :oops:
User avatar
REVENGE
Posts: 2382
Joined: 24 Aug 2006, 06:13

Re: Units on Fire - Modding Question

Post by REVENGE »

Actually, my search pattern was fine.

For the weapondefs table,

'name' refers to the [weaponname] in the tdf file
'description' refers to the "name" tag in the tdf file.

So nothing really means what it seems to mean... :evil:
Post Reply

Return to “Lua Scripts”