skills
10th Apr 07, 12:52 PM
Edit: This is sasquatch method, its alot easier, only look at the other method if you want to elarn about the spawn_after_death extension.
The proper way to do this:
- create one ability that disables all your weapon hardpoints (enable_hardpoint_modifier_X)
- create abilities for each weapon you want to lose.
Those abilities have a modifier which enables a certain hardpoint (enable_hardpoint_modifier_X) and have the required_health requirement
- open the object editor and add clauses for each weapon. The variable should be damage. Then create the appropriate conditions and change the motions of the vis so it displays the right weapons at the right time.
VoilĂ your weapon losing vehicle is done.
Spawn_after_death example below:
In TT vehicles have weapons that can get disabled and destroyed, this is alittle lua code work around that lets you get the effect of a vehicle losing weapons as it loses health.
Overview: This involves several different ebps files and models for the same unit and knowledge about coding units and vehicles etc is required if you want to use this tutorial.
Implementation:
1) First create the ebps files for you unit, you should have one file in which the unit is coded to have all its weapons and sustiqent files in which it has one less wepaon each time until it reach the point it has 1 or no wepoans left. Split the health of the unit across these file. E.G. For a predator I had the one with full weapons simulating the gunner at 200hp, the left and then right sponsors at 1000 each, the main turret at 2000hp and the empty chassis at 400hp. Now using the 'spawn_on_death_ext' code link all the files together, starting with the file with all weapons down to the one with 1 or no weapons. As shown below:
----------------------------------------
-- File: 'ebps\races\black_templars\troops\black_templars_predator_main_gunner.lua'
-- Created by: AttributeEditor v2.0
-- Note: Do NOT edit by hand!
-- (c) 2001 Relic Entertainment Inc.
GameData = Inherit([[ebps\races\black_templars\troops\black_templars_predator_main_rsponsor.lua]])
MetaData = InheritMeta([[ebps\races\black_templars\troops\black_templars_predator_main_rsponsor.lua]])
GameData["combat_ext"]["hardpoints"]["hardpoint_04"]["weapon_table"]["weapon_01"]["name_for_this_weapon_choice"] = "black_templars_storm_bolter"
GameData["combat_ext"]["hardpoints"]["hardpoint_04"]["weapon_table"]["weapon_01"]["weapon"] = "weapon\\black_templars_storm_bolter.lua"
GameData["health_ext"]["hitpoints"] = 800.00000
GameData["health_ext"]["spawn_on_death"] = "ebps\\races\\black_templars\\troops\\black_templars_predator_main_rsponsor.lua"
GameData["ui_ext"]["ui_info"]["help_text_id"] = "$15014078"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_01"] = "$15014073"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_02"] = "$15014074"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_03"] = "$15014075"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_04"] = "$15014076"
GameData["ui_ext"]["ui_info"]["screen_name_id"] = "$15014078"
MetaData["$METADATATAG"] = {desc = [[]], type = 7, category = [[]], dispval = [[]], isLocked = false, }
MetaData["$METACOLOURTAG"] =
{
This is linked to this file and so on, so forth:
----------------------------------------
-- File: 'ebps\races\black_templars\troops\black_templars_predator_main_rsponsor.lua'
-- Created by: AttributeEditor v2.0
-- Note: Do NOT edit by hand!
-- (c) 2001 Relic Entertainment Inc.
GameData = Inherit([[ebps\races\black_templars\troops\black_templars_predator_main_lsponsor.lua]])
MetaData = InheritMeta([[ebps\races\black_templars\troops\black_templars_predator_main_lsponsor.lua]])
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["muzzle"]["x"] = 2.10000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["muzzle"]["y"] = 1.19000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["muzzle"]["z"] = 0.79000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["name_for_this_weapon_choice"] = "space_marines_lascannon"
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["origin"]["x"] = 1.98000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["origin"]["y"] = 1.19000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["origin"]["z"] = 0.02000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["weapon"] = "weapon\\black_templars_lascannon_tank_right.lua"
GameData["health_ext"]["spawn_on_death"] = "ebps\\races\\black_templars\\troops\\black_templars_predator_main_lsponsor.lua"
GameData["ui_ext"]["ui_info"]["help_text_id"] = "$15014079"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_01"] = "$15014073"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_02"] = "$15014074"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_03"] = "$15014075"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_04"] = "$15014076"
GameData["ui_ext"]["ui_info"]["screen_name_id"] = "$15014079"
2) Now you need to create a model of the unit at each stage, so you would make a model with all guns, one with the gunner dead, one with the right sponsors disabled etc. Make sure the death animations for each stage apart fromthe last stage to be 1 frames long to reduce the time between the new version spawning. Add link the models to the corresponding ebps files.
3) Create the sbps for the unit and set the 'squad_loadout_ext' to start with the unit with all its weapons, set it to a building to be available from and voila. However makes sure you make different ui texts for each stage and add them to the ebps' 'ui_ext' and an overall unit overview in the sbps' 'squad_ui_ext'.
This method has a few limitations, firstly the new stage wont spawn until the old stages death anim has finished, thus why i said make the death anims 1 frame long. Secondly becasue the stage has died in the eyes of the game you will lose selection of the unit, how ever you can pass this off as being because the unit is stunned. Also the spawn on death code spawns the ebps files so I guess any attributes in the sbps code might be lost, the units I used this on didn't have any extra sbps coding apart from the cost time and entity blueprint so I don't know what might happen. Finally this is jsut an example of what you could do with the 'spawn_on_death_ext' code, you could have anyhitng, for instance smaller tyranid creatures spawning from a big one as it dies etc.
The proper way to do this:
- create one ability that disables all your weapon hardpoints (enable_hardpoint_modifier_X)
- create abilities for each weapon you want to lose.
Those abilities have a modifier which enables a certain hardpoint (enable_hardpoint_modifier_X) and have the required_health requirement
- open the object editor and add clauses for each weapon. The variable should be damage. Then create the appropriate conditions and change the motions of the vis so it displays the right weapons at the right time.
VoilĂ your weapon losing vehicle is done.
Spawn_after_death example below:
In TT vehicles have weapons that can get disabled and destroyed, this is alittle lua code work around that lets you get the effect of a vehicle losing weapons as it loses health.
Overview: This involves several different ebps files and models for the same unit and knowledge about coding units and vehicles etc is required if you want to use this tutorial.
Implementation:
1) First create the ebps files for you unit, you should have one file in which the unit is coded to have all its weapons and sustiqent files in which it has one less wepaon each time until it reach the point it has 1 or no wepoans left. Split the health of the unit across these file. E.G. For a predator I had the one with full weapons simulating the gunner at 200hp, the left and then right sponsors at 1000 each, the main turret at 2000hp and the empty chassis at 400hp. Now using the 'spawn_on_death_ext' code link all the files together, starting with the file with all weapons down to the one with 1 or no weapons. As shown below:
----------------------------------------
-- File: 'ebps\races\black_templars\troops\black_templars_predator_main_gunner.lua'
-- Created by: AttributeEditor v2.0
-- Note: Do NOT edit by hand!
-- (c) 2001 Relic Entertainment Inc.
GameData = Inherit([[ebps\races\black_templars\troops\black_templars_predator_main_rsponsor.lua]])
MetaData = InheritMeta([[ebps\races\black_templars\troops\black_templars_predator_main_rsponsor.lua]])
GameData["combat_ext"]["hardpoints"]["hardpoint_04"]["weapon_table"]["weapon_01"]["name_for_this_weapon_choice"] = "black_templars_storm_bolter"
GameData["combat_ext"]["hardpoints"]["hardpoint_04"]["weapon_table"]["weapon_01"]["weapon"] = "weapon\\black_templars_storm_bolter.lua"
GameData["health_ext"]["hitpoints"] = 800.00000
GameData["health_ext"]["spawn_on_death"] = "ebps\\races\\black_templars\\troops\\black_templars_predator_main_rsponsor.lua"
GameData["ui_ext"]["ui_info"]["help_text_id"] = "$15014078"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_01"] = "$15014073"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_02"] = "$15014074"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_03"] = "$15014075"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_04"] = "$15014076"
GameData["ui_ext"]["ui_info"]["screen_name_id"] = "$15014078"
MetaData["$METADATATAG"] = {desc = [[]], type = 7, category = [[]], dispval = [[]], isLocked = false, }
MetaData["$METACOLOURTAG"] =
{
This is linked to this file and so on, so forth:
----------------------------------------
-- File: 'ebps\races\black_templars\troops\black_templars_predator_main_rsponsor.lua'
-- Created by: AttributeEditor v2.0
-- Note: Do NOT edit by hand!
-- (c) 2001 Relic Entertainment Inc.
GameData = Inherit([[ebps\races\black_templars\troops\black_templars_predator_main_lsponsor.lua]])
MetaData = InheritMeta([[ebps\races\black_templars\troops\black_templars_predator_main_lsponsor.lua]])
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["muzzle"]["x"] = 2.10000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["muzzle"]["y"] = 1.19000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["muzzle"]["z"] = 0.79000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["name_for_this_weapon_choice"] = "space_marines_lascannon"
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["origin"]["x"] = 1.98000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["origin"]["y"] = 1.19000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["origin"]["z"] = 0.02000
GameData["combat_ext"]["hardpoints"]["hardpoint_03"]["weapon_table"]["weapon_01"]["weapon"] = "weapon\\black_templars_lascannon_tank_right.lua"
GameData["health_ext"]["spawn_on_death"] = "ebps\\races\\black_templars\\troops\\black_templars_predator_main_lsponsor.lua"
GameData["ui_ext"]["ui_info"]["help_text_id"] = "$15014079"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_01"] = "$15014073"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_02"] = "$15014074"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_03"] = "$15014075"
GameData["ui_ext"]["ui_info"]["help_text_list"]["text_04"] = "$15014076"
GameData["ui_ext"]["ui_info"]["screen_name_id"] = "$15014079"
2) Now you need to create a model of the unit at each stage, so you would make a model with all guns, one with the gunner dead, one with the right sponsors disabled etc. Make sure the death animations for each stage apart fromthe last stage to be 1 frames long to reduce the time between the new version spawning. Add link the models to the corresponding ebps files.
3) Create the sbps for the unit and set the 'squad_loadout_ext' to start with the unit with all its weapons, set it to a building to be available from and voila. However makes sure you make different ui texts for each stage and add them to the ebps' 'ui_ext' and an overall unit overview in the sbps' 'squad_ui_ext'.
This method has a few limitations, firstly the new stage wont spawn until the old stages death anim has finished, thus why i said make the death anims 1 frame long. Secondly becasue the stage has died in the eyes of the game you will lose selection of the unit, how ever you can pass this off as being because the unit is stunned. Also the spawn on death code spawns the ebps files so I guess any attributes in the sbps code might be lost, the units I used this on didn't have any extra sbps coding apart from the cost time and entity blueprint so I don't know what might happen. Finally this is jsut an example of what you could do with the 'spawn_on_death_ext' code, you could have anyhitng, for instance smaller tyranid creatures spawning from a big one as it dies etc.