Units fire red lines (instahit)

Moderators: Uveso, burnie222

Re: Units fire red lines (instahit)

Postby CSI » 21 Dec 2017, 00:27

Error running OnScriptBitSet script ... bad argument #1 to `insert' (table expected, got nil)

First time I get this kind of error idk what is wrong :(


Also X does not match any Y category, where X is a unit and Y a category like Air, Naval...
CSI
Avatar-of-War
 
Posts: 100
Joined: 09 Apr 2017, 18:59
Has liked: 18 times
Been liked: 5 times
FAF User Name: CSI

Re: Units fire red lines (instahit)

Postby Uveso » 21 Dec 2017, 06:01

This is basicaly the OnScriptBitSet function from unit.lua:

Code: Select all
     OnScriptBitSet = function(self, bit)
        if bit == 0 then -- Shield toggle
             [...]
        elseif bit == 1 then -- Weapon toggle
             [...]
        end
    end,

Argument #1 should be "self" (Table with unitdata) and argument #2 "bit" should be a number (Integer).

What do you mean with x, y and categories ?
User avatar
Uveso
Supreme Commander
 
Posts: 1144
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 39 times
Been liked: 167 times
FAF User Name: Uveso

Re: Units fire red lines (instahit)

Postby CSI » 21 Dec 2017, 14:11

Ok I think I screed u the script because I tried to add a shield to the Blackops Seraph T4 Point defense but it already had a lambda field.

For the other thing I have a submarine in the mod and I can see in the log "This unit doesn't match any naval category" but it doesn't cause any trouble in game.

One more thing, I know that I can organize units with keywords like 'SORTDEFENSE' but how do choose more precisely ? I mean relative positions of 2 units in the Defense subcategory

Thanks :)
CSI
Avatar-of-War
 
Posts: 100
Joined: 09 Apr 2017, 18:59
Has liked: 18 times
Been liked: 5 times
FAF User Name: CSI

Re: Units fire red lines (instahit)

Postby Uveso » 21 Dec 2017, 19:24

Newer saw an error message like "This unit doesn't match any naval category". Maybe just a check message from Hussars Unitanalyzer ?

To sort the Icons use this inside an Unit Blueprint:
Code: Select all
BuildIconSortPriority = 25,
User avatar
Uveso
Supreme Commander
 
Posts: 1144
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 39 times
Been liked: 167 times
FAF User Name: Uveso

Re: Units fire red lines (instahit)

Postby Uveso » 21 Dec 2017, 19:32

Found this error message inside "formations.lua" line 1468
I am not sure if this is the right one, because the text is slight different.

Code: Select all
LOG('*FORMATION DEBUG: Unit ' .. u:GetUnitId() .. ' does not match any ' .. type .. ' categories.')


Just a guess, the categories.NAVAL is missing inside the unitblueprint.
User avatar
Uveso
Supreme Commander
 
Posts: 1144
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 39 times
Been liked: 167 times
FAF User Name: Uveso

Re: Units fire red lines (instahit)

Postby CSI » 21 Dec 2017, 21:17

Yes this is this message !

Thank you very much
CSI
Avatar-of-War
 
Posts: 100
Joined: 09 Apr 2017, 18:59
Has liked: 18 times
Been liked: 5 times
FAF User Name: CSI

Re: Units fire red lines (instahit)

Postby CSI » 21 Dec 2017, 23:26

Do you know how I can remove a 'BUILTBYCOMMANDER' attribute from a base game unit ?

For now I hook the blueprints with 'merge' I guess I should erase and rewwrite the whole file or something like that
CSI
Avatar-of-War
 
Posts: 100
Joined: 09 Apr 2017, 18:59
Has liked: 18 times
Been liked: 5 times
FAF User Name: CSI

Re: Units fire red lines (instahit)

Postby Uveso » 22 Dec 2017, 06:18

Code: Select all
BluePrint.Categories = RemoveItemFromArray('BUILTBYCOMMANDER',BluePrint.Categories)

function RemoveItemFromArray(REMOVEME,ARRAY)
   zold = 1
   while ARRAY[zold] do
      if ARRAY[zold] == REMOVEME then
         table.remove(ARRAY, zold)
      else
         zold = zold + 1
      end
   end
   return ARRAY
end


:mrgreen:
User avatar
Uveso
Supreme Commander
 
Posts: 1144
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 39 times
Been liked: 167 times
FAF User Name: Uveso

Re: Units fire red lines (instahit)

Postby CSI » 29 Dec 2017, 15:19

What part of the blueprint tells a unit to turn towards the target's position when it fires ? ^^

Also I edited a point defense but it doesn't attack automatically
CSI
Avatar-of-War
 
Posts: 100
Joined: 09 Apr 2017, 18:59
Has liked: 18 times
Been liked: 5 times
FAF User Name: CSI

Re: Units fire red lines (instahit)

Postby Sprouto » 31 Dec 2017, 04:19

Whenever a weapon generates an OnGotTarget event, it will begin to turn and face the target

The ability of a weapon to generate this event is related to several things;

- the target must be either seen or on radar (blip)
- the target must be on a layer that the weapon is allowed to target (see FireTargetLayerCapsTable)
- the target must be of a category that the weapon is allowed to target (see TargetRestrictDisallow/TargetRestrictAllow)
- the target must be within the tracking radius (this allows the weapon to begin tracking before it's in firing range - see TrackingRadius)

There are some other factors that will affect when the weapon starts firing - such as FiringTolerance - and of course, some of these requirements are overridden when you manually target something.

As for the unit (as opposed to the weapon) turning when attacking an enemy, there is the weapon variable;

- AutoInitiateAttackCommand which will cause the unit to execute an attack order on the enemy unit that this weapon is targeted on

The above feature is what often causes some units to go 'wandering' on their own without direct orders from the player.

and in the AI block of the unit blueprint;

- AttackAngle (which will cause a unit to assume a posture when firing at an enemy - used mostly by large naval vessels)
Sprouto
Priest
 
Posts: 333
Joined: 08 Sep 2012, 05:40
Has liked: 53 times
Been liked: 69 times
FAF User Name: Sprouto

PreviousNext

Return to Total Mayhem

Who is online

Users browsing this forum: No registered users and 1 guest