Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Finnik

Pages: 1 ... 31 32 [33]
481
With help of gurus of C++ (thanks again Meridian, SupSuper, Yankes and Otto for explanations and support) ive add new property into starting conditions block, called needItem. this works very similar to allowedCraft, but it checks, if sending craft contains listed items, and if not, its not allowed to launch (and also land). Here is video demo:

If that feature is wanted for modders, may be it would be possible to add it to OXCE? I can commit it to github. Also im very noob for OOP and C++, so any comments and tips are wellcome.

482
Help / Re: Noob Mod creator
« on: November 27, 2018, 09:15:11 am »
i really suggest Visual Studio Code, as it has OpenXcom Ruleset Tools, that correct spell errors https://marketplace.visualstudio.com/items?itemName=openxcom.ruleset-tools. I had a lot of very annoying tabbing errors before I started using it. It is a pity that it does not understand the syntax of OXCE, but still

483
OXCE Support Y-scripts / Re: Buffing Script
« on: November 26, 2018, 10:54:42 am »
TY! problem is im using hitUnit hook in Yankes script to set up debuff(buff) effect from item, so you actually need to hit with that item. it can be done with firing, melee, grenede or thing like my flashbang above, but you need a hit. as far as i know, medkit is not a hit event.

484
Work In Progress / Re: Beginner Modding Help?
« on: November 26, 2018, 01:15:41 am »

EDIT*
also is there a way to have held items add Front Armor (for Shields) or is that a proper coding thing I'd have to do for OpenxcomExtended (i think that's what its called anyway)

yes, but you need to use Yankes Script for it. there is a proper script, made, i think, by ohartenstein23 (sorry, if im wrong)

its decent level of modding, and if you want to modify existing mecanic of it, you need to learn Yankes scripting. i take a fast look, if there is something about it, i guess, you just need to add this to your item (ive not tried it myself, so need to test)
Code: [Select]
    tags:
      PHYSICAL_SHIELD_ARMOR: 10 #dont belove my numbers, they are random
      ITEM_SHIELD_BLOCK_MELEE_COEFFICIENT: 3
      ITEM_SHIELD_BLOCK_REACTIONS_COEFFICIENT: 3
      ITEM_IS_MELEE: 3

use this as refer
Code: [Select]
# Item Physical Shield - damage reduction on handheld items, chance to block
# hitUnit - offset: 3
#
#   Hits on units are reduced according to the tag PHYSICAL_SHIELD_ARMOR, if an
#   item with that tag is in the unit's hand. Melee attacks have a chance to be
#   completely negated, according to the unit stats and the tags
#   ITEM_SHIELD_BLOCK_MELEE_COEFFICIENT and ITEM_SHIELD_BLOCK_REACTIONS_COEFFICIENT.
#   Melee attacks are considered hits with battle action type 10, BA_HIT or hits
#   from ranged weapons with the tag ITEM_IS_MELEE set not equal to 0.
#
#   When hit, a unit's hands are checked for an item with the PHYSICAL_SHIELD_ARMOR
#   tag, first the left and then the right. The dodge coefficients are taken
#   from the first item found with the armor tag set. Next, the type of damage
#   is compared to a list of damage types that should bypass physical shields -
#   if it is one of those types, the script returns at this point without
#   modifying damage. Next, melee hits take into account the dodge coefficients.
#   The unit's melee stat is multiplied by ITEM_SHIELD_BLOCK_MELEE_COEFFICIENT as
#   a percentage, and the same is done for reactions and its coefficient, then
#   both are added together. A 0-100 dice roll is made, and if the roll is less
#   than this sum, then the power of the hit is set to 0 and the script returns.
#
#   Finally, the armor value of the physical shield item is modified by a set of
#   standard resistances (lower numbers mean the shield is more effective
#   against that damage type) and by a multiplier for the side of the unit that
#   was hit. This armor value is then subtracted from the power of the hit and
#   the script returns.

485
OXCE Support Y-scripts / Re: Buffing Script
« on: November 26, 2018, 12:28:53 am »
In my particular opinion, it would be good if you gave modders flexibility to adapt this new temporary script, even if it did not have the different animation.

In case you decide that this temporary buff will be fixed, I present what I have in mind with your script:

Medikit: heals wounds and contains analgesics and stimulants (the same as the vanilla medikit)

Campaign surgery kit: the same as the Medikit, but much better. (Extra +5 Health, +2 Stamina)

we cant set Yankes script for medcit use.

Trench Whistle: encourages the troops, raises the reactions and courage. (+7 TU, +10 Bravery, +5 reactions)

Combat Bagpipe: increases bravery, slightly strength, melee damage and stamina (+3 TU, +15 Bravery, +3 Strength, +4 Melee, +4 Stamina)
can be done with first script

Bandages: for bleeding and recover a little health. (Stops bleeding, +3 health)

can be done without scripting with OXCE

Flamethrower: well... is a flamethrower, but reduces enemy reactions and bravery to emule the fear of being roared alive (-10 Reactions, -5 Bravery)
there are mecanics for it already

Most of them for three turns, except the medikits and surgery lit, these are more like vanilla medikit.

can be done without scripting with OXCE

you know, tracking debuff end restore stut to its original value is pretty comlycated thing, so if you can satisfy with permanent buff from first script - just mod and item like i describe above
if you want to make trackable debuff - ill better teach you how to script it =) i dont think trackable debuff made verstile with tags will be unreosanable comlicated both to wright and use for modders

--- posts merged ---

what do you think, guys? this script makes daze on a target, hitted with proper item and fade out in set ammount of turns
Code: [Select]
extended:
  tags:
    RuleItem:
      FTAG_DAZE_VALUE: int
      FTAG_DAZE_TIME: int
    BattleUnit:
      FTAG_ISDAZED: int #not shure about it
      FTAG_DAZE_ENDTURN: int
      FTAG_DAZE_ORIGINAL_TIMEUNITS: int
      FTAG_DAZE_ORIGINAL_REACTIONS: int
      FTAG_DAZE_ORIGINAL_FIRING: int
      FTAG_DAZE_ORIGINAL_THROWING: int
      FTAG_DAZE_ORIGINAL_MELEE: int
  scripts:
    hitUnit:
      - offset: 1
        code: |
          var ptr RuleItem itemRuleset;
          var int dazeTag;
          var int dazeValue;
          var int statValue;
          var int debuffValue;
          var int dazeTime;
          var int endTurn;
   
          unit.getTag dazeTag Tag.FTAG_ISDAZED;
          if eq dazeTag 69; # Make sure unit already have daze debuff
            return power part side;
          end;

          set dazeTag 69; #set dazed tag
          unit.setTag Tag.FTAG_ISDAZED dazeTag;

          damaging_item.getRuleItem itemRuleset; #get debuff stats from item
          itemRuleset.getTag dazeValue Tag.FTAG_DAZE_VALUE;
          itemRuleset.getTag dazeTime Tag.FTAG_DAZE_TIME;

          if neq dazeValue 0;
            unit.Stats.getTimeUnits statValue; #remember original TimeUnits stat
            unit.setTag Tag.FTAG_DAZE_ORIGINAL_TIMEUNITS statValue;
         
            div statValue 2; #calculate TimeUnits debuff, deviding it by 2
            unit.Stats.setTimeUnits statValue; #apply debuff
            clear statValue;

            unit.Stats.getReactions statValue; #remember original Reactions stat
            unit.setTag Tag.FTAG_DAZE_ORIGINAL_REACTIONS statValue;
            battle_game.randomRange debuffValue 25 35; #calculate random, 25-35 for Reactions
            mul debuffValue dazeValue; #calculate debuff
            sub statValue debuffValue;
            unit.Stats.setReactions statValue; #apply Reactions  debuff
            clear statValue;
            clear debuffValue;

            unit.Stats.getFiring statValue; #remember original Firing stat
            unit.setTag Tag.FTAG_DAZE_ORIGINAL_FIRING statValue;
            battle_game.randomRange debuffValue 20 30; #calculate random, 20-30 for Firing
            mul debuffValue dazeValue; #calculate debuff
            sub statValue debuffValue;
            unit.Stats.setFiring statValue; #apply debuff
            clear statValue;
            clear debuffValue;

            unit.Stats.getThrowing statValue; #remember original Throwing stat
            unit.setTag Tag.FTAG_DAZE_ORIGINAL_THROWING statValue;
            battle_game.randomRange debuffValue 20 30; #calculate random, 20-30 for Throwing
            mul debuffValue dazeValue; #calculate debuff
            sub statValue debuffValue;
            unit.Stats.setThrowing statValue; #apply debuff
            clear statValue;
            clear debuffValue;

            unit.Stats.getMelee statValue; #remember original Melee stat
            unit.setTag Tag.FTAG_DAZE_ORIGINAL_MELEE statValue;
            battle_game.randomRange debuffValue 10 20; #calculate random, 10-20 for Melee
            mul debuffValue dazeValue; #calculate debuff
            sub statValue debuffValue;
            unit.Stats.setMelee statValue; #apply debuff
            clear statValue;
            clear debuffValue;

            battle_game.getTurn endTurn;
            add endTurn dazeTime; #define end turn for debuff
            unit.setTag Tag.FTAG_DAZE_ENDTURN endTurn;
          end;

          return power part side;

    newTurnUnit:
      - offset: 2
        code: |
          var int currTurn;
          var int endTurn;
          var int dazeTag;
          var int originalTimeUnits;
          var int originalReactions;
          var int originalFiring;
          var int originalThrowing;
          var int originalMelee;

          # Make sure this doesn't run an extra time when civilians have a turn
          if eq side 2;
            return;
          end;

          unit.getTag dazeTag Tag.FTAG_ISDAZED;
          unit.getTag endTurn Tag.FTAG_DAZE_ENDTURN;
          unit.getTag originalTimeUnits Tag.FTAG_DAZE_ORIGINAL_TIMEUNITS;
          unit.getTag originalReactions Tag.FTAG_DAZE_ORIGINAL_REACTIONS;
          unit.getTag originalFiring Tag.FTAG_DAZE_ORIGINAL_FIRING;
          unit.getTag originalThrowing Tag.FTAG_DAZE_ORIGINAL_THROWING;
          unit.getTag originalMelee Tag.FTAG_DAZE_ORIGINAL_MELEE;

          battle_game.getTurn currTurn;

          if eq dazeTag 69;
            if eq currTurn endTurn;
              unit.Stats.setTimeUnits originalTimeUnits; #revent debuff
              unit.Stats.setReactions originalReactions;
              unit.Stats.setFiring originalFiring;
              unit.Stats.setThrowing originalThrowing;
              unit.Stats.setMelee originalMelee;
              unit.setTag Tag.FTAG_ISDAZED 0; #cancel tag
            end;
          end;

          return;

im hardcoded parameters of daze debuff, it halfs TUs, decrease reactions by 25-35, firing and throwing by 20-30, and melee by 10-20. numbers are subject of balance talking.

you still can adjust values. place this in your item.rul

Code: [Select]
    tags:
      FTAG_DAZE_VALUE: 1 #this is multiplyer to numbers above. if lower than 1, debuff will be weaker, if higher - stronger
      FTAG_DAZE_TIME: 2 #number of turns before fading

here is example mod. note, its is submod for XCF, which, btw, i strongly recommend to check out https://openxcom.mod.io/the-x-com-files

486
OXCE Support Y-scripts / Re: Buffing Script
« on: November 25, 2018, 08:23:37 pm »
not yet, as it will be different script. the one above is specially designed to work with any stat, and now im working on specific daze buff. fading mecanic is much more complicated, so i will be desigh buffs/debuffs separetly if desired, and buff mecanic will be hardcoded. so for now Daze debuff work lowering reactions, but now im setting it to lowering TU by half of original, Reactions buy -30, Firing and trowing -25 and Melee by -15. this is subject of balance talking, but im not feeling ill let modders to change values via tag sets with numbers.

but the code for effect, that was in video is attached here (note, that mod itself is not standalone, its submod for XCF, but i can use script from it in way you like)

487
OXCE Support Y-scripts / Re: Buffing Script
« on: November 25, 2018, 06:11:36 pm »
also ive made script for temporal buff/debuff (it will be off in a set ammount of turns)  :D  so i can design any buff effect if needed. some example:

i wonder, if i can set any visual effect to a unit with my debuff tag? without making something really huge for recolorUnitSprite

488
OXCE Support Y-scripts / Re: Buffing Script
« on: November 23, 2018, 02:14:53 pm »
I have not faced any problems with it yet. I tried on testing with TUs to be set above 200, everything was fine. also, stats cant be lower 1, so if calculations leads to it, 1 is set instead. But more expirience opinion required for full overview

489
OXCE Support Y-scripts / [Example] Buffing Script
« on: November 23, 2018, 01:00:49 pm »
I decided to try to learn how to write Yankes scripts, at least at basic level, so here is my trial release (many thanks to ohartenstein23 for his invaluable help in understanding). This script allows you to set the weapon property (tag) to change the characteristics of the target, which hit the weapon. Stats will be changed to the end of the battle. For example, you can make a blinding gun, lowering Firing, or stim enjector, increasing TUs and, say, Bravery =)

all you need is to define tags in your item, like that:
Code: [Select]
items:
  - type: STR_BUFFER
    #categories: [STR_EQUIPMENT]
    size: 0.2
    costBuy: 10
    costSell: 8925
    weight: 9
    bigSprite: 8585
    floorSprite: 8586
    bulletSprite: 31
    fireSound: 15
    power: 5 #there must be a hit event to act the script
    damageType: 3
    damageAlter:
      ToHealth: 0.0   
    clipSize: -1
    accuracyAimed: 110
    tuAimed: 15
    battleType: 1
    twoHanded: false
    invWidth: 1
    invHeight: 2
    recoveryPoints: 2
    armor: 10
    attraction: 4
    listOrder: 39101
    tags: #here buff values can be set
      FTAG_BUFF_VALUE_TIMEUNITS: 20 #remember add renewable resources to damage alter if positive. this will only affect maximum value, not current
      FTAG_BUFF_VALUE_STAMINA: 20
      FTAG_BUFF_VALUE_HEALTH: 0
      FTAG_BUFF_VALUE_BRAVERY: -20 #negative means debuff
      FTAG_BUFF_VALUE_REACTIONS: 20
      FTAG_BUFF_VALUE_FIRING: 20
      FTAG_BUFF_VALUE_THROWING: 20
      FTAG_BUFF_VALUE_MELEE: 20
      FTAG_BUFF_VALUE_STRENGTH: 20
      FTAG_BUFF_VALUE_PSISTRENGTH: 20
      FTAG_BUFF_VALUE_PSISKILL: 20


I will be glad to know what do you think about it. Also any advice is very welcome  :D

490
The X-Com Files / Re: The X-Com Files - 0.9.5: Burn The Village Down
« on: October 04, 2018, 09:00:04 pm »
the first question that comes to mind is how to change/define terrain for the base defense mission. but idk, maybe it's possible right now.
it should be static (can stop thinking about freigter, it gives so much inspiration)

the second question is how does the base move? I mean, do you order it to move (and that means new UI) or it just follows a predefined orbit (then how and when the orbit gets defined?)
just predefined orbit (by mod creator) should be fine.

the actual movement of the base isn't anywhere near hard to do. Deciding where it should move that is.

thats how clocks work, i think, and funds show option also... it updates every hour, lets say, kinda loop that adds to number to base coordination. i dont think its impossible to do, but will requer help of coders for sure. also it should me defined as another object ofc. and any way, some gui changes, to add some button for its ctreation. i also dont think it should have module structure with buildings

from the coding POV let's start with orbital missions that are actually orbital, that is following an orbit with an appropriate orbital speed (15000 knots give or take) and not sitting at poles like it currently is in piratez for example.
but the principles of orbital mechanics just say that in-orbit skirmishes will occur in a very suitable way for xcom. In order to get closer in orbit for, for example, docking, you need to
align the speeds of two objects. Therefore, space boarding in reality will look very similar to what we see in the Pirates. Even the blackness of the map seems to me very realistic due to the way the camera shoots at such great contrasts of illumination

491
The X-Com Files / Re: The X-Com Files - 0.9.5: Burn The Village Down
« on: October 04, 2018, 03:33:58 pm »
I saw that tread about lua scripts. At given time it could be the key for that. I think Whispers himself can do such thing and its not that hard for him. But I dont used lua yet, and im waiting for his wiki to expand more... seems right now his API has enough tools for it

492
The X-Com Files / Re: The X-Com Files - 0.9.5: Burn The Village Down
« on: October 04, 2018, 11:52:26 am »
Ah okay :)
There are already AWACS-like craft which do that, so I think we have it covered.

think about orbital base for late game. i think it can be done using scripts, that changes position all the time with cicle. most of it will requre lots of script coding tho, as you have to put another background to it and may be another modules. but i fall in love with space maps like freighter)

Pages: 1 ... 31 32 [33]