How to make marked units?

Everything about mods can be found here.

Moderator: Morax

How to make marked units?

Postby KeyBlue » 14 Nov 2016, 00:39

So i want to make a mod that adds a diseased/poisoned/cursed/marked (different names for same thing) state to all units.

These marked units would preferably be easily recognizable:
  • add mark to icon
    • so you can easily see which units are affected
  • some visual change to unit
    • some yellow/green glow maybe?
  • some change to footprint could be nice too
    • drops of fluid of the same color as glow? or simply glowy footprints
  • maybe something added to tooltips or naming

And i ofcourse would like it to spread to other units.
  • due to proximity to marked units
  • by being hit by marked units
  • by being close to a certain building

And this state also needs to have some consequences.
  • some damage overtime
  • damage buff/debuff
  • speed buff/debuff

And some way to easily find all marked units in game/in area.

Obviously it would be too much to ask someone to make this for me. ;)
I have decent experience working with the lua game code, but very little with unit stuff.
So if you, yes you, could give me some pointers on where to start or how you would do it, that would be great.

Some similar mods i could take a look at, would be quite usefull aswell.


Thanks in advance,
KeyBlue
User avatar
KeyBlue
Priest
 
Posts: 403
Joined: 28 Jan 2016, 01:06
Has liked: 140 times
Been liked: 93 times
FAF User Name: KeyBlue

Re: How to make marked units?

Postby Exotic_Retard » 14 Nov 2016, 00:50

ok so you need to take a look at the following:

how buffs work and how they are applied - that would cover your speed hp damage w.e.

how selen deselect code works - they pass unit data to the global sync table so you can always find which selens are cloaked super easily and then perform selection code on them or w.e.

you can look at ui party mod which adds ornaments to strategic icons much like the stunned or paused icon midification

things like spreading to adjacent units could be done with a buff perhaps or running a unit script, probably the latter is more straightforward, but you could do something clever like having a timed buff that upon removal does something like spread the effect. maybe.

look at teleportation effects, more specifically the steaming effect which affects every bone. you can use that to add some kind of glow maybe. or just place it on bone 0, same applies to dripping, ect.

also have a look at the blackops cloak mod which changes meshes of all units you can do that and switch them on/off to create some effect if you mess with the shaders. or something.

tooltips are pretty straightforward. look in unit blueprints how they interact with localization then edit the loc files to add your text.

hope for the best.
User avatar
Exotic_Retard
Contributor
 
Posts: 1470
Joined: 21 Mar 2013, 22:51
Has liked: 557 times
Been liked: 626 times
FAF User Name: Exotic_Retard

Re: How to make marked units?

Postby KeyBlue » 14 Nov 2016, 02:44

Thanks for the overview for most of the issues. Now i have a little idea of where to start :)

No clue how the bone system works, is it on wiki? if not maybe some explanation or link would be appreciated.
But i'll try to look into it and ask if i have more specific question.
User avatar
KeyBlue
Priest
 
Posts: 403
Joined: 28 Jan 2016, 01:06
Has liked: 140 times
Been liked: 93 times
FAF User Name: KeyBlue

Re: How to make marked units?

Postby nine2 » 14 Nov 2016, 06:31

The way seen deselect and ui party make markers is pretty terrible. Those are ui mods so they need to use hacks.

Your mod will be a sim mod so maybe there is a better way to do it. (maybe not)
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: How to make marked units?

Postby KeyBlue » 14 Nov 2016, 14:30

@Anihilnine
I'll atleast have a place, i can start looking at to figure out what needs adding.


So i tried to look at some of the buff files and have decided on a 'design'.

I'll make a buff called 'marked' and when this buff gets applied, it does some debuffing and I create a BuffField for that unit that applies the 'marked' buff to all surrounding units.

It seems I can add an emitter effect to a buff, so I'll try to use one one of the teleport emitter blueprints for that, to create a glowy effect.

Once I get that to work I'll see what to i can do with the strategic icons.


Remarks or feedback on how this is totally (not) going to work, will be appreciated.
User avatar
KeyBlue
Priest
 
Posts: 403
Joined: 28 Jan 2016, 01:06
Has liked: 140 times
Been liked: 93 times
FAF User Name: KeyBlue

Re: How to make marked units?

Postby KeyBlue » 14 Nov 2016, 16:47

I've been trying to create my own buffField but i can't seem to get it to work :(
In base game there are only 2 buffFields. And their blueprints are in game.lua
So i tried putting my bufffieldblueprint also in game.lua

Code: Select all
-- inside file : mods/Marked_Units/lua/game.lua
BuffFieldBlueprint {                         
    Name = 'MarkBuffField',
    AffectsUnitCategories = 'ALLUNITS',
    AffectsAllies = true,
    AffectsVisibleEnemies = true,
    AffectsOwnUnits = true,
    AffectsSelf = true,
    DisableInTransport = true,
    InitiallyEnabled = true,
    MaintenanceConsumptionPerSecondEnergy = 0,
    Radius = 15,
    Buffs = {
        'Marked',
    },
}


but this didn't seem to work for some reason. The BuffFieldBlueprints table still only contains the 2 seraphim acu bufffields.
So anyone an idea of how this should work.

It also seems that InitBuffFields function in Unit.lua doesn't seem to work properly (?)
It looks for a self.BuffFields which are never initalized?
And then it makes a new table self.MyBuffFields with the strange explantion:
Code: Select all
--We need a different buff field instance for each unit. This takes care of that.


I'm very confused, so if someone could shine some light on this, i would be very gratefull.

PS: it seems other mods with an aura, used their own function in the unit script. So if nobody knows anything i'll have to resort to such a solution aswell. :(
User avatar
KeyBlue
Priest
 
Posts: 403
Joined: 28 Jan 2016, 01:06
Has liked: 140 times
Been liked: 93 times
FAF User Name: KeyBlue

Re: How to make marked units?

Postby Krapougnak » 15 Nov 2016, 08:47

You could also have a look at DMS mod (Domino Mod Support) it introduced a "disease" ability that marked units with a special marker if memory serves (a Cybran thing), units infected where loosing hit points over time.
User avatar
Krapougnak
Contributor
 
Posts: 340
Joined: 12 Jul 2012, 11:03
Has liked: 193 times
Been liked: 24 times
FAF User Name: Krapougnak

Re: How to make marked units?

Postby KeyBlue » 15 Nov 2016, 12:10

I'm looking at Domino Mod Support v0.8 from the mod vault.
But i can't find any mention on this disease ability.

It seems to only have general 'mod support'. Abilities system was nicely explained, but the mod only contained a very example ability.

So maybe you mean a mod that uses DMS or a later version? Or am i looking at the wrong code parts?
User avatar
KeyBlue
Priest
 
Posts: 403
Joined: 28 Jan 2016, 01:06
Has liked: 140 times
Been liked: 93 times
FAF User Name: KeyBlue

Re: How to make marked units?

Postby nine2 » 15 Nov 2016, 16:32

Yeah I think the mod was actually 4DC, which used DMS.
Also not sure if the one in the mod vault works.
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: How to make marked units?

Postby Krapougnak » 15 Nov 2016, 21:50

Yeah sorry the "Virus Field" is in 4DC mod in hook/lua/sim/unit.lua
User avatar
Krapougnak
Contributor
 
Posts: 340
Joined: 12 Jul 2012, 11:03
Has liked: 193 times
Been liked: 24 times
FAF User Name: Krapougnak


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest