User:Celtic Minstrel/UnitBehaviourProposal

From The Battle for Wesnoth Wiki
< User:Celtic Minstrel
Revision as of 13:48, 29 March 2016 by Celtic Minstrel (talk | contribs) (New proposal for unit behaviour)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is an idea for generalizing the "unit formulas" concept.

[unit]
    [ai]
        [behavior]
            id=some_id
            engine=fai
            # Same as the old syntax for unit formulas
            formula="move(me.loc, dest_loc)" # Or loop_formula
            priority=3
            [vars]
                dest_loc="loc(12,20)"
            [/vars]
        [/behavior]
        # ai_special could translate to something like this:
        [behavior]
            id=some_id2
            engine=cpp
            mode=guardian
        [/behavior]
        # And you could do similar things in Lua, too:
        [behavior]
            id=some_id3
            engine=lua
            priority=5 # Or, evaluation=<< ... >> for variable priorities
            code=<<
                local me, cfg, data = ...
                ai.move(me.loc, cfg.dest_x, dest_cfg.y)
            >>
            [args]
                dest_x,dest_y=12,20
            [/args]
        [/behavior]
    [/ai]
[/unit]
This page was last edited on 29 March 2016, at 13:48.