Jump to content

Xcomhadrian

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by Xcomhadrian

  1. Right so I *think* even I understand this a bit, which is pretty good going considering. In the code where your stating the solder edit, whats the command for specific items? I actually think I get how to edit the rest of it to suit, but that last bit has be a bit perplexed since I dont know what to add. I mean this bit; { Settings.SetDifficulty(DifficultyIndex); `log("Difficulty:"@string(class'XComGameState_CampaignSettings'.static.GetDifficultyFromSettings())); soldier = Characters.FindCharacterTemplate('Soldier'); soldier.CharacterBaseStats[eStat_HP] = 10 + DifficultyIndex; }
  2. So I think I finally figured out what was the problem stopping the script working. It has to be run twice. Once for the weapon template and again for the weapons schematics. The schematics specifically list the object to update and what its going to be when doing so. So I reckon its a case of altering both the "AssaultRifle_CV" and the "AssaultRifle_MG_Schematic" files.
  3. Anyone? Im really stuck here. Either my template bugs out and spits out the wrong weapon with the standard "upgradeitem" function. Or I cant get it to spawn an item if I remove upgradeitem. Please help, this is the linchpin of my mod. Without a working template I cant get my research to run properly, or update the armory.
  4. Yeah sorry that mod doesn't help. I already have it here and its not much of a help tbh. The finite armory mod has been more helpful but Im still stuck. Finite armory has this code which I think might be applicable; function Kv_OnSchematicBuiltFn(XComGameState NewGameState, XComGameState_Item ItemState) { local XComGameStateHistory History; local XComGameState_HeadquartersXCom XComHQ; local X2ItemTemplateManager ItemTemplateManager; local X2ItemTemplate ItemTemplate; local X2SchematicTemplate SchematicTemplate; local XComGameState_Item NewItemState; local int numExistingItems; History = `XCOMHISTORY; ItemTemplateManager = class'X2ItemTemplateManager'.static.GetItemTemplateManager(); // Set up HQ gamestate to work with foreach NewGameState.IterateByClassType(class'XComGameState_HeadquartersXCom', XComHQ) { break; } if (XComHQ == none) { XComHQ = XComGameState_HeadquartersXCom(History.GetSingleGameStateObjectForClass(class'XComGameState_HeadquartersXCom')); XComHQ = XComGameState_HeadquartersXCom(NewGameState.CreateStateObject(class'XComGameState_HeadquartersXCom', XComHQ.ObjectID)); NewGameState.AddStateObject(XComHQ); } // Get the template data of the schematic that was just built. SchematicTemplate = X2SchematicTemplate(ItemState.GetMyTemplate()); // Get the template of the schematic's reference item. This is the actual equippable item that the schematic template refers to. ItemTemplate = ItemTemplateManager.FindItemTemplate(SchematicTemplate.ReferenceItemTemplate); if (ItemTemplate == none) { `KvCLog("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ No item template named" @ SchematicTemplate.ReferenceItemTemplate @ "was found."); return; } numExistingItems = XComHQ.GetNumItemInInventory(ItemTemplate.DataName); if(numExistingItems > 0) { NewItemState = XComHQ.GetItemByName(ItemTemplate.DataName); } else { NewItemState = ItemTemplate.CreateInstanceFromTemplate(NewGameState); XComHQ.PutItemInInventory(NewGameState, NewItemState); } // Add 1 of the item (not the schematic) to the HQ inventory NewItemState.Quantity = numExistingItems + 1; NewGameState.AddStateObject(NewItemState); } But I dont what to cut out and/or change to make it work properly. :/
  5. No the example mod doesn't use a schematic, just a weapon template.
  6. Hello peeps, me again. After some stellar advice and fiddling a bit with my code, I almost have my project up to a level I am happy with. The thing I have to do now is apparently add a custom function to my weapon schematic to make it add the item to the inventory instead of updating an existing item (updating items is causing a bug atm). Now I know a lot of you peeps are far more skilled than I at coding, and I would assume that someone else has already figured this out. So can someone show me some code I can add to my schematic that will, when its built, add my weapon to the inventory for usage? Much obliged.
  7. Thanks for spotting that, I started the code as "modweapon_cv" and then changed to "AAR_cv" to ensure there was no conflicts with any other modweapons causing the problem for me. After doing some more reading it appears as if there may be an UpgradeTemplate. If that is the case then Its no wonder my code didnt work as it wasnt even looking for that. Now I need to find that and alter it. Sheesh. For a supposedly "simple" mod this is turning in to one helluva effort :/
  8. So if I use your method would this work? // XcomAAR_CV.ini ChangeSets=(Type="Weapon", Target[0]="AssaultRifle_CV", \\ Mods[0]=(Type="UpgradeItem", Value="AAR_CV"), \\ )
  9. As a complete tard at coding this is the kind of thing I would need. A simple script I can add to alter default data without resorting to massive amounts of code. However as a coding tard I would also need an explanation and example of how to use it.
  10. My intention is to have a weapon tier in between ballistic and magnetic for my own mod weapon. The weapon works absolutely fine with a simple template as a single purchase item. But I cannot get the game to recognize it as an infinite item with just a weapon template . So I rewrote it as two scripts; One a schematic, the other a standard weapon template. It shows up fine in the menu to build, and once built it does indeed get removed from the build screen. But it then gives me the wrong weapon. Here is my schematic; class X2Item_AARSchematics extends X2Item; static function array<X2DataTemplate> CreateTemplates() { local array<X2DataTemplate> Schematics; // Weapon Schematics Schematics.AddItem(CreateTemplate_AAR_Conventional_Schematic()); return Schematics; } static function X2DataTemplate CreateTemplate_AAR_Conventional_Schematic() { local X2SchematicTemplate Template; local ArtifactCost Resources; `CREATE_X2TEMPLATE(class'X2SchematicTemplate', Template, 'AAR_CV_Schematic'); Template.ItemCat = 'weapon'; Template.strImage = "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_Base"; Template.CanBeBuilt = true; Template.bOneTimeBuild = true; Template.bInfiniteItem = true; Template.HideInInventory = false; Template.PointsToComplete = 0; Template.Tier = 1; Template.OnBuiltFn = class'X2Item_DefaultSchematics'.static.UpgradeItems; // Items to upgrade Template.ItemsToUpgrade.AddItem('AssaultRifle_CV'); // Items being created Template.ReferenceItemTemplate = 'AAR_CV'; // Requirements - Temporary Template.Requirements.RequiredTechs.AddItem('ProvingGrounds'); Template.Requirements.RequiredEngineeringScore = 2; Template.Requirements.bVisibleIfPersonnelGatesNotMet = true; // Cost - Temporary Resources.ItemTemplateName = 'Supplies'; Resources.Quantity = 25; Template.Cost.ResourceCosts.AddItem(Resources); Resources.ItemTemplateName = 'AlienAlloy'; Resources.Quantity = 10; Template.Cost.ResourceCosts.AddItem(Resources); return Template; } And this is my weapon template; class X2Item_AdvancedAssaultRifle_Weapon extends X2Item; static function array<X2DataTemplate> CreateTemplates() { local array<X2DataTemplate> Weapons; local X2ItemTemplateManager ItemTemplateManager; Weapons.AddItem(CreateTemplate_AAR_Conventional()); ItemTemplateManager = class'X2ItemTemplateManager'.static.GetItemTemplateManager(); AddCritUpgrade(ItemTemplateManager, 'CritUpgrade_Bsc'); AddCritUpgrade(ItemTemplateManager, 'CritUpgrade_Adv'); AddCritUpgrade(ItemTemplateManager, 'CritUpgrade_Sup'); AddAimBonusUpgrade(ItemTemplateManager, 'AimUpgrade_Bsc'); AddAimBonusUpgrade(ItemTemplateManager, 'AimUpgrade_Adv'); AddAimBonusUpgrade(ItemTemplateManager, 'AimUpgrade_Sup'); AddClipSizeBonusUpgrade(ItemTemplateManager, 'ClipSizeUpgrade_Bsc'); AddClipSizeBonusUpgrade(ItemTemplateManager, 'ClipSizeUpgrade_Adv'); AddClipSizeBonusUpgrade(ItemTemplateManager, 'ClipSizeUpgrade_Sup'); AddFreeFireBonusUpgrade(ItemTemplateManager, 'FreeFireUpgrade_Bsc'); AddFreeFireBonusUpgrade(ItemTemplateManager, 'FreeFireUpgrade_Adv'); AddFreeFireBonusUpgrade(ItemTemplateManager, 'FreeFireUpgrade_Sup'); AddReloadUpgrade(ItemTemplateManager, 'ReloadUpgrade_Bsc'); AddReloadUpgrade(ItemTemplateManager, 'ReloadUpgrade_Adv'); AddReloadUpgrade(ItemTemplateManager, 'ReloadUpgrade_Sup'); AddMissDamageUpgrade(ItemTemplateManager, 'MissDamageUpgrade_Bsc'); AddMissDamageUpgrade(ItemTemplateManager, 'MissDamageUpgrade_Adv'); AddMissDamageUpgrade(ItemTemplateManager, 'MissDamageUpgrade_Sup'); AddFreeKillUpgrade(ItemTemplateManager, 'FreeKillUpgrade_Bsc'); AddFreeKillUpgrade(ItemTemplateManager, 'FreeKillUpgrade_Adv'); AddFreeKillUpgrade(ItemTemplateManager, 'FreeKillUpgrade_Sup'); return Weapons; } static function X2DataTemplate CreateTemplate_AAR_Conventional() { local X2WeaponTemplate Template; // Basic properties copied from the conventional assault rifle //===================================================================== `CREATE_X2TEMPLATE(class'X2WeaponTemplate', Template, 'AAR_CV'); Template.WeaponPanelImage = "_ConventionalRifle"; Template.EquipSound = "Conventional_Weapon_Equip"; Template.ItemCat = 'weapon'; Template.WeaponCat = 'rifle'; Template.WeaponTech = 'conventional'; Template.strImage = "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_Base"; Template.Tier = 1; Template.RangeAccuracy = class'X2Item_DefaultWeapons'.default.MEDIUM_CONVENTIONAL_RANGE; Template.BaseDamage = class'X2Item_DefaultWeapons'.default.ASSAULTRIFLE_CONVENTIONAL_BASEDAMAGE; Template.Aim = class'X2Item_DefaultWeapons'.default.ASSAULTRIFLE_CONVENTIONAL_AIM; Template.CritChance = class'X2Item_DefaultWeapons'.default.ASSAULTRIFLE_CONVENTIONAL_CRITCHANCE; Template.iClipSize = class'X2Item_DefaultWeapons'.default.ASSAULTRIFLE_CONVENTIONAL_ICLIPSIZE; Template.iSoundRange = class'X2Item_DefaultWeapons'.default.ASSAULTRIFLE_CONVENTIONAL_ISOUNDRANGE; Template.iEnvironmentDamage = class'X2Item_DefaultWeapons'.default.ASSAULTRIFLE_CONVENTIONAL_IENVIRONMENTDAMAGE; Template.NumUpgradeSlots = 1; Template.InventorySlot = eInvSlot_PrimaryWeapon; Template.Abilities.AddItem('StandardShot'); Template.Abilities.AddItem('Overwatch'); Template.Abilities.AddItem('OverwatchShot'); Template.Abilities.AddItem('Reload'); Template.Abilities.AddItem('HotLoadAmmo'); Template.UIArmoryCameraPointTag = 'UIPawnLocation_WeaponUpgrade_AssaultRifle'; Template.AddDefaultAttachment('Mag', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_MagA", , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_MagA"); Template.AddDefaultAttachment('Optic', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_OpticA", , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_OpticA"); Template.AddDefaultAttachment('Reargrip', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_ReargripA", , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_ReargripA"); Template.AddDefaultAttachment('Stock', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_StockA", , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_StockA"); Template.AddDefaultAttachment('Trigger', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_TriggerA", , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_TriggerA"); Template.AddDefaultAttachment('Light', "ConvAttachments.Meshes.SM_ConvFlashLight", , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_LightA"); Template.iPhysicsImpulse = 5; Template.CanBeBuilt = True; Template.bInfiniteItem = true; Template.UpgradeItem = ''; Template.fKnockbackDamageAmount = 5.0f; Template.fKnockbackDamageRadius = 0.0f; // Requirements Template.Requirements.RequiredTechs.AddItem('ProvingGrounds'); Template.Requirements.RequiredEngineeringScore = 2; Template.Requirements.bVisibleIfPersonnelGatesNotMet = true; //===================================================================== // Enhancements we're making to base //===================================================================== Template.BaseDamage.Damage += 1; //Boosts base damage Template.CritChance += 5; //Boost critical chance Template.Abilities.AddItem('ChainShot'); //Confers chain shot to the bearer Template.GameArchetype = "WP_HK416_CV.WP_HK416_CV"; //Uses a custom archetype //===================================================================== return Template; } // ************ Add mappings for upgrades to attachment models/icons static function AddCritUpgrade(X2ItemTemplateManager ItemTemplateManager, Name TemplateName) { local X2WeaponUpgradeTemplate Template; Template = X2WeaponUpgradeTemplate(ItemTemplateManager.FindItemTemplate(TemplateName)); //Parameters are : AttachSocket, UIArmoryCameraPointTag, MeshName, ProjectileName, MatchWeaponTemplate, AttachToPawn, IconName, InventoryIconName, InventoryCategoryIcon, ValidateAttachmentFn Template.AddUpgradeAttachment('Optic', 'UIPawnLocation_WeaponUpgrade_AssaultRifle_Optic', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_OpticB", "", 'AAR_CV', , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_OpticB", "img:///UILibrary_StrategyImages.X2InventoryIcons.ConvAssault_OpticB_inv", "img:///UILibrary_StrategyImages.X2InventoryIcons.Inv_weaponIcon_scope"); } static function AddAimBonusUpgrade(X2ItemTemplateManager ItemTemplateManager, Name TemplateName) { local X2WeaponUpgradeTemplate Template; Template = X2WeaponUpgradeTemplate(ItemTemplateManager.FindItemTemplate(TemplateName)); //Parameters are : AttachSocket, UIArmoryCameraPointTag, MeshName, ProjectileName, MatchWeaponTemplate, AttachToPawn, IconName, InventoryIconName, InventoryCategoryIcon, ValidateAttachmentFn Template.AddUpgradeAttachment('Optic', 'UIPawnLocation_WeaponUpgrade_AssaultRifle_Optic', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_OpticC", "", 'AAR_CV', , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_OpticC", "img:///UILibrary_StrategyImages.X2InventoryIcons.ConvAssault_OpticC_inv", "img:///UILibrary_StrategyImages.X2InventoryIcons.Inv_weaponIcon_scope"); } static function AddClipSizeBonusUpgrade(X2ItemTemplateManager ItemTemplateManager, Name TemplateName) { local X2WeaponUpgradeTemplate Template; Template = X2WeaponUpgradeTemplate(ItemTemplateManager.FindItemTemplate(TemplateName)); Template.AddUpgradeAttachment('Mag', 'UIPawnLocation_WeaponUpgrade_AssaultRifle_Mag', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_MagB", "", 'AAR_CV', , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_MagB", "img:///UILibrary_StrategyImages.X2InventoryIcons.ConvAssault_MagB_inv", "img:///UILibrary_StrategyImages.X2InventoryIcons.Inv_weaponIcon_clip", class'X2Item_DefaultUpgrades'.static.NoReloadUpgradePresent); } static function AddFreeFireBonusUpgrade(X2ItemTemplateManager ItemTemplateManager, Name TemplateName) { local X2WeaponUpgradeTemplate Template; Template = X2WeaponUpgradeTemplate(ItemTemplateManager.FindItemTemplate(TemplateName)); //Parameters are : AttachSocket, UIArmoryCameraPointTag, MeshName, ProjectileName, MatchWeaponTemplate, AttachToPawn, IconName, InventoryIconName, InventoryCategoryIcon, ValidateAttachmentFn Template.AddUpgradeAttachment('Reargrip', 'UIPawnLocation_WeaponUpgrade_AssaultRifle_Mag', "ConvAttachments.Meshes.SM_ConvReargripB", "", 'AAR_CV', , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_ReargripA", "img:///UILibrary_StrategyImages.X2InventoryIcons.ConvAssault_ReargripB_inv", "img:///UILibrary_StrategyImages.X2InventoryIcons.Inv_weaponIcon_trigger"); Template.AddUpgradeAttachment('Trigger', '', "ConvAttachments.Meshes.SM_ConvTriggerB", "", 'AAR_CV'); } static function AddReloadUpgrade(X2ItemTemplateManager ItemTemplateManager, Name TemplateName) { local X2WeaponUpgradeTemplate Template; Template = X2WeaponUpgradeTemplate(ItemTemplateManager.FindItemTemplate(TemplateName)); //Parameters are : AttachSocket, UIArmoryCameraPointTag, MeshName, ProjectileName, MatchWeaponTemplate, AttachToPawn, IconName, InventoryIconName, InventoryCategoryIcon, ValidateAttachmentFn Template.AddUpgradeAttachment('Mag', 'UIPawnLocation_WeaponUpgrade_AssaultRifle_Mag', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_MagC", "", 'AAR_CV', , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_MagC", "img:///UILibrary_StrategyImages.X2InventoryIcons.ConvAssault_MagC_inv", "img:///UILibrary_StrategyImages.X2InventoryIcons.Inv_weaponIcon_clip", class'X2Item_DefaultUpgrades'.static.NoClipSizeUpgradePresent); Template.AddUpgradeAttachment('Mag', 'UIPawnLocation_WeaponUpgrade_AssaultRifle_Mag', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_MagD", "", 'AAR_CV', , "img:///UILibrary_Common.UI_MagAssaultRifle.MagAssaultRifle_MagD", "img:///UILibrary_StrategyImages.X2InventoryIcons.MagAssaultRifle_MagD_inv", "img:///UILibrary_StrategyImages.X2InventoryIcons.Inv_weaponIcon_clip", class'X2Item_DefaultUpgrades'.static.ClipSizeUpgradePresent); } static function AddMissDamageUpgrade(X2ItemTemplateManager ItemTemplateManager, Name TemplateName) { local X2WeaponUpgradeTemplate Template; Template = X2WeaponUpgradeTemplate(ItemTemplateManager.FindItemTemplate(TemplateName)); //Parameters are : AttachSocket, UIArmoryCameraPointTag, MeshName, ProjectileName, MatchWeaponTemplate, AttachToPawn, IconName, InventoryIconName, InventoryCategoryIcon, ValidateAttachmentFn Template.AddUpgradeAttachment('Stock', 'UIPawnLocation_WeaponUpgrade_AssaultRifle_Stock', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_StockB", "", 'ModWeapon_CV', , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_StockB", "img:///UILibrary_StrategyImages.X2InventoryIcons.ConvAssault_StockB_inv", "img:///UILibrary_StrategyImages.X2InventoryIcons.Inv_weaponIcon_stock"); } static function AddFreeKillUpgrade(X2ItemTemplateManager ItemTemplateManager, Name TemplateName) { local X2WeaponUpgradeTemplate Template; Template = X2WeaponUpgradeTemplate(ItemTemplateManager.FindItemTemplate(TemplateName)); //Parameters are : AttachSocket, UIArmoryCameraPointTag, MeshName, ProjectileName, MatchWeaponTemplate, AttachToPawn, IconName, InventoryIconName, InventoryCategoryIcon, ValidateAttachmentFn Template.AddUpgradeAttachment('Suppressor', 'UIPawnLocation_WeaponUpgrade_AssaultRifle_Suppressor', "ConvAssaultRifle.Meshes.SM_ConvAssaultRifle_SuppressorB", "", 'ModWeapon_CV', , "img:///UILibrary_Common.ConvAssaultRifle.ConvAssault_SuppressorB", "img:///UILibrary_StrategyImages.X2InventoryIcons.ConvAssault_SuppressorB_inv", "img:///UILibrary_StrategyImages.X2InventoryIcons.Inv_weaponIcon_barrel"); } defaultproperties { bShouldCreateDifficultyVariants = true } When I build it I get the magnetic rifle :/ So I used the script from the general discussion section here by the longwar dev for altering default weapon templates to update the starting rifles to my weapon mod as its upgradeitem. This is the script I used;
  11. I tried to doing that with a Screenlistener script but either the weapons are not affected by it or I need a different kind of command. I was thinking its because i need to use a state command but as a novice its a nightmare.
  12. Hi folks. Im currently working on a fairly simple mod to add a custom ballistic weapon to Xcom 2 as a "natural" upgrade between ballistics and magnetics. I am having one helluva time trying to get the silly thing to work properly though. As a "modweapon" template I can get it to work but I cant seem to make it an "infinite" weapon (ie buy once) for universal usage. So I rewrote the entire thing using a schematic. Now every time I build the weapon in the armory it gives me the Magnetic rifle instead. I am pretty sure its because the default assault rifle states its "upgrade item" is the magnetic rifle. So I need to over-ride that to ensure when you buy my weapon you get your default weapon updated to the new model. And when you buy a magnetic weapon my gun gets updated to it instead. How the hell do I tell the game I want to over-write the vanilla assault rifles upgrade path?
×
×
  • Create New...