aliens

Author Topic: [Examples] More Y-Script examples  (Read 11163 times)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3347
    • View Profile
Re: More ModScript examples
« Reply #15 on: July 16, 2020, 02:29:58 am »
`battle_action` is value you seek for point 1)
Second point is on TODO list. Probably in this month I will have some things finished.

Offline KingMob4313

  • Commander
  • *****
  • Posts: 543
  • Never let me down again.
    • View Profile
    • Mod Hub for Equal Terms 2.0
Re: More ModScript examples
« Reply #16 on: July 17, 2020, 12:35:36 am »
`battle_action` is value you seek for point 1)
Second point is on TODO list. Probably in this month I will have some things finished.

Thank you, Yankes, but no need to hurry.

The scripting is pretty intuitive as long as the scope is limited.  Still figuring out how to go from mode to mode, but the examples provided help.

I've just been playing with different things.  Got it to stop happening for smoke pretty easily and have it re-rolling damage rolls if the damage is under orig_power so that it will give base damage to 150% on a crit.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3347
    • View Profile
Re: More ModScript examples
« Reply #17 on: August 02, 2020, 05:56:00 pm »
I now added support to query damage type of rule item, two new operations `getDamageType` and `getMeleeDamageType`, each one return object that can be check for exact bonuses or random logic its use.

Offline zee_ra

  • Colonel
  • ****
  • Posts: 213
    • View Profile
Re: More ModScript examples
« Reply #18 on: December 07, 2023, 01:12:58 pm »

Yes, this is one option, and then in script (`hitUnit`) manually subtract armor value using your own logic. Probaby better is alter effectiveness  as is not avaiable to scripts right now (unit armor is).

Loops are on my TODO, this is bit tricky because I need made some refactors to make them easy to use and safe (I would prefer that scripts can't hang whole game).

@Yankes,

How should I approach changing the damage type?  I know, I could read the damage type of a clip by checking the damaging_type variable.  However, I do not see a way to alter the damaging_type.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3347
    • View Profile
Re: [Examples] More Y-Script examples
« Reply #19 on: January 20, 2024, 08:46:46 pm »
Some random example of new custom vapor:
Code: [Select]

  - update: STR_BLASTER_BOMB
    power: 10
    blastRadius: 2
    vaporColorSurface: 6
    vaporDensitySurface: 10
    vaporProbabilitySurface: 100
    scripts:
      vaporParticleAmmo: |
        var int temp;
       
        set subvoxel_velocity subvoxel_trajectory_forward;
        muldiv subvoxel_velocity -3 2;
       
        random.randomRangeSymmetric temp 100;
        subvoxel_velocity.addX temp;
        random.randomRangeSymmetric temp 100;
        subvoxel_velocity.addY temp;
        random.randomRangeSymmetric temp 100;
        subvoxel_velocity.addZ temp;
       
        begin;
          var int last 6000;
          sub last subvoxel_trajectory_distance_max;
          add last subvoxel_trajectory_distance;
         
          if gt last 0;
            set temp 100;
            muldiv temp last 6000;
            random.randomChance temp;
            if gt temp 0;
              muldiv subvoxel_velocity last 6000;
            end;
          else lt subvoxel_trajectory_distance 6000;
            muldiv subvoxel_velocity subvoxel_trajectory_distance 6000;
          end;
        end;
        subvoxel_velocity.addZ 200;
        return;
  - update: STR_LASER_RIFLE
    vaporColorSurface: 5
    vaporDensitySurface: 1
    vaporProbabilitySurface: 100
    scripts:
      vaporParticleAmmo: |
        # noting
        return;
  - update: STR_RIFLE_CLIP
    vaporColorSurface: 2
    vaporDensitySurface: 17
    vaporProbabilitySurface: 100
    scripts:
      vaporParticleAmmo: |
        var int off;
        var int temp;
       
        if lt particle_number 3;
          var Position up subvoxel_trajectory_up;
          var Position right subvoxel_trajectory_right;
          var int sin;
          var int cos;
         
          set sin subvoxel_trajectory_distance;
          set cos subvoxel_trajectory_distance;
         
          wavegen_sin sin 10000 8;
          wavegen_cos cos 10000 8;
         
          mul up sin;
          mul right cos;
         
          set subvoxel_offset up;
          add subvoxel_offset right;
          set subvoxel_velocity 0 0 0;
          set subvoxel_acceleration 0 0 0;
          set subvoxel_drift 10;
         
          set subvoxel_velocity subvoxel_trajectory_forward;
          mul subvoxel_velocity -1;
         
        else lt particle_number 5;
       
          add vapor_color -2;
          set subvoxel_drift 50;
          set subvoxel_velocity subvoxel_trajectory_forward;
        else lt particle_number 12;
          # set off subvoxel_trajectory_distance;
          # wavegen_sin off 1200 5;
          set vapor_color -1;
          # add vapor_color +1;
          # set subvoxel_velocity 0 0 150;
          # set subvoxel_acceleration 0 0 off;
        else;
          var int sin;
          var int last 6400;
          sub last subvoxel_trajectory_distance_max;
          add last subvoxel_trajectory_distance;
          if gt last 0;
            #hit point
            add vapor_color -2;
            set subvoxel_offset subvoxel_trajectory_forward;
            muldiv subvoxel_offset last 256;
           
            random.randomRangeSymmetric temp 500;
            subvoxel_velocity.setX temp;
            random.randomRangeSymmetric temp 500;
            subvoxel_velocity.setY temp;
            random.randomRangeSymmetric temp 500;
            subvoxel_velocity.setZ temp;
           
            set subvoxel_acceleration subvoxel_velocity;
            muldiv subvoxel_acceleration -1 50;
          else lt subvoxel_trajectory_distance 6000;
            add vapor_color +1;
            #start trajectory
           
           
            set subvoxel_velocity subvoxel_trajectory_forward;
            mul subvoxel_velocity -4;
           
            random.randomRangeSymmetric temp 100;
            subvoxel_velocity.addX temp;
            random.randomRangeSymmetric temp 100;
            subvoxel_velocity.addY temp;
            random.randomRangeSymmetric temp 100;
            subvoxel_velocity.addZ temp;
           
            set subvoxel_acceleration 0 0 -10;
          else;
            # set sin subvoxel_trajectory_distance;
           
            # wavegen_sin sin 1000 -12;
            # add vapor_color -1;
            # set subvoxel_acceleration 0 0 sin;
            # set subvoxel_drift 1000;
           
            # set vapor_color -1;
          end;
        end;
       
        return;
In next week I prepare more concrete examples of some popular weapons trails.