User:EAi/Tasks

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

A proposed way to expose tasks to scripts, and perhaps allow network syncing. Hasn't really been fully explored...

<task name="CTaskComplexDriveToPoint" parent="CTaskComplexCarDrive">
    <constructor address="0x1234567">
        <param name="vehicle" type="vehicle" />
        <param name="target" type="vector" />
        <param name="cruiseSpeed" type="float" />
        ...
    </constructor>
    <members>
        <variable name="target" type="vector" sync="true" />
        <variable name="mode" type="integer" />
        <padding length="4" />
        <variable name="hasAchievedTarget" type="bool" />
    </members>
    <functions>
        <function name="isTargetBlocked" address="0x12345678">
            <param name="ped" type="ped" />
        </function>
    </functions>
</task>

This file would generate some interface for lua to create these tasks, set the members and call their functions. It should also let these things be mapped to gta classes (using the addresses). The order of the members and constructor params matters. The members directly lay out the order of members in the class and hence has to match exactly.

Implementation is probably a 2-3 days work and if implemented well some aspects could be used to help export other game-level functions.