Monday, April 16, 2012

[FA]Global Unit Upgrade System

Is this possible? I was thinking of perhaps using the existing upgrade system for commanders, except extended to all units. However, when one unit gets the enhancement, give all units of the same kind that same enhacement. Is this possible? I'll need details on how to insta-create the enhancement on all units once it's completed on one unit.|||WiseHero|||I think i thought about that but i thought it did something else. Lemme check it again.
Edit: Yeah that does something else. I want something that can upgrade all units including those already on the field, not just newly built units.|||Functionally, it's the same thing, you'd just need to get a list of the appropriate unit categories for that AIBrain and apply it to those units as well.
You could model it somewhat on the SC2 research system, except that you would still need to link it to a structure or unit somewhere to build enhancements, and then run an upgrade function on all affected units belonging to that AIBrain with the blueprint of the upgrade. This is the part that SC2 does in the engine, although it's also the simplest part to replicate in lua.

This shouldn't be terribly difficult, but the whole project will require some work, especially if you want an upgrade to apply different bonuses to different units (or to apply bonuses to only specific unit categories).|||Hi,
Dms could help with this..
first you would need to hook blueprints.lua to insert any new or all upgrades into every units blueprint, you would need some filters in place to add certain enhancements to certain units.. so pick the enhancements carefully.. and decide which unit gets what enhancements from your predefined list..
once the blueprints are sorted.. and units are getting there working blueprint enhancements table.. you can use DMS to replicate the enhancements and add them to the unit.. you can hook unit.lua and add the enh script table to this file in there you will have all the needed code to make each enhancement work correctly, within this code will be functions to add the toggles and all other code to make this enhacnement function.. you will also fire off a function when the enhancement is complete to loop aibrain units and filter out all the units of the same bpid that are still alive and instantly enable the enhancement on these units..

it sounds complicated, but i think once the logic is sorted it would quite easy to do..
start with one easy enahancement.. something like a speed increase try adding this to everyunit by hooking blueprints.lua (modblueprints) then hook unit.lua to create the enh table for the new enhancement.. use dms's enhancement template to add the enhancement to all units with bpid = unit you enhanced.. if your stuck on how to add enhancments using DMS look in the DMS thread at the enhance engi mod.. this mod adds a speed increase to the engi.. from there you should get the idea of how your mod is going to pan out.. bp and code wise.|||Er, if you want global upgrades, you wouldn't want to use the units' blueprints at all. Have the data in the upgrade itself, as with the SC2 research system. Maybe support an optional per-unit blueprint override or merge, or something like that, but that could just make it more confusing.|||Actually I think I'll need both. I will be looking for upgrades to all units of the same kind as well as upgrades to all units of the same category. As for the tech structures, that might be quite a good idea too, actually.

No comments:

Post a Comment