Adding arbitrary data (flags?) to units/unit blueprints and changing ownership?

Discussion in 'Mod Discussions' started by swizzlewizzle, October 30, 2014.

  1. swizzlewizzle

    swizzlewizzle Active Member

    Messages:
    216
    Likes Received:
    56
    So the idea is... add a flag to a unit (blueprint?) that could be on or off. I would have a looping (1-2 seconds) function that looks through all units checking to see if that flag is on. If it is on, then I would transfer control of the unit to an AI player.

    Is this sort of thing possible? I haven't really seen any way to add data to unit blueprints.. perhaps it is something I would need to add to units at runtime? How about changing ownership of units on the fly? Finally... is there indeed a way for us to hook onto the init process and create looping functions that would keep running the entire game to impliment things like this?

    Appreciate your comments! :)
  2. swizzlewizzle

    swizzlewizzle Active Member

    Messages:
    216
    Likes Received:
    56
    Do you guys know what I mean? Can we indeed add anything to unit blueprints that can be searched for/called later or are they set in stone?
  3. liquius

    liquius Well-Known Member

    Messages:
    731
    Likes Received:
    482
    Unfortunately it's just something that we can't do at the moment.
  4. swizzlewizzle

    swizzlewizzle Active Member

    Messages:
    216
    Likes Received:
    56
    Should be possible to do a search on the armor_type of a unit while ingame though right? We have the ability to set up a looping function though, right? Something that would start up at game init and handle some custom gameplay code that needs to run every few seconds...
  5. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    You can use the Blueprint Info Framework to get blueprint data: https://forums.uberent.com/threads/rel-blueprint-info-framework-v1-4-4.56213/
  6. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I don't think there is API for that kind of access to gameplay. Though I've not read that much through the server code yet. But I don't think you can even get a list of all units and definitely not influence gameplay in such a fine grained scale.
    You can dig around in what the server scripts do. I think they allow you do spawn a unit from the server script and observe if that unit dies or not. That's how the commander becomes the important unit it is.
    But rewriting unit definitions on the fly? I have huge doubts that is possible.
  7. swizzlewizzle

    swizzlewizzle Active Member

    Messages:
    216
    Likes Received:
    56
    Not neccessarily rewriting their definitions. Instead, things like modifying the ownership of units based on certain things happening (leech/vampire type attack that switches unit control).

    @cola_colin from your experience looking through code, have you seen any way to hook into the init method on game start to fork our own threads/looping functions? Perhaps something like a web helper if the code was being run in the browser? I've got a few ideas for gameplay but I need a "director" ai so to speak the loops (slowly) to react and create certain gameplay (goal areas, things like that).

    Edit: BTW raevn, your blueprint info framework is intense. :)
  8. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    The server script uses an embedded V8 JS engine I think. So javascript. The current scripts use setInterval(...) to execute code in regular intervals. Obviously you don't want to do anything expensive in there.
    The UI is just a browser, so the same happens there as well.
  9. swizzlewizzle

    swizzlewizzle Active Member

    Messages:
    216
    Likes Received:
    56
    Are you talking about the scripts in server-script?

    @cola_colin have you seen any mods up yet that add their own scripts onto the server side I might be able to use to get a handle on how this all works?
  10. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    The scripts in server-script are the only scripts for the server indeed.

    I don't know of any big server side mods yet, no. Server side scripting is:
    a) pretty new
    b) not officially supported for modability, meaning unlike the UI the server-scripts do not have any hooks to load mods yet..

Share This Page