Author Topic: Alien side  (Read 3365 times)

Offline Yankes

  • Commander
  • *****
  • Posts: 3213
    • View Profile
Re: Alien side
« Reply #15 on: March 30, 2023, 10:40:46 pm »
Code: [Select]
extended:
  scripts:     
    damageSpecialUnit:
      - offset: 13
        code: |
          if gt health_damage 0;
            var ptr RuleUnit zombie;
            var int faction;
           
            attacker.getFaction faction;
           
            rules.getRuleUnit zombie "STR_ZOMBIE";
            unit.setSpawnUnit zombie;
            unit.setSpawnUnitInstantRespawn 1;
            unit.setSpawnUnitFaction faction;
           
            # disable defualt transforamtion
            set transform_chance 0;
          end;
         
          return;
This is example of script that will make ALL attacks to turn victim to friendly zombie. This is effective game of tag :)

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #16 on: March 31, 2023, 12:54:17 am »
Code: [Select]
extended:
    scripts:
      createUnit:
        - offset: 1
          code: |
            var ptr RuleArmor armorRuleSet;
            var int faction;
            var text armor_type;
            var int fulltu;
 
            unit.getRuleArmor armorRuleSet;
            armorRuleSet.getType armor_type;
            unit.getFaction faction;
 
            if eq faction 0;
              if eq armor_type "ZOMBIE_ARMOR";
                debug_log "Turn " turn ", setting Friendly spawnunit for new faction " faction " unit, Armor type " armor_type;
                unit.setSpawnUnitFaction 0;
                debug_log "Turn " turn ", Giving new friendly Zombie full TUs";
                unit.getTimeUnitsMax fulltu;
                unit.setTimeUnits fulltu;
                end;
              if eq armor_type "STR_CHRYSSALID_ARMOR_B_UC";
                debug_log "Turn " turn ", Giving new friendly Chryssalid full TUs";
                unit.getTimeUnitsMax fulltu;
                unit.setTimeUnits fulltu;
                end;
              end;
     
            return;

Thanks. I have copied the scripted one, but I don't know how to combine it with the one from Skyhawk to make it work. These two together might solve my problem. But if I put it together wrong, the mode won't work either.

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #17 on: March 31, 2023, 12:58:49 am »
For example https://openxcom.mod.io/hatching-chryssalids-and-tentaculats of functionality I had in mind.
In this mode not see how help for me. But I'll try latter.

Offline Yankes

  • Commander
  • *****
  • Posts: 3213
    • View Profile
Re: Alien side
« Reply #18 on: March 31, 2023, 01:11:43 am »
You do not combine them as each is called in different moment, `createUnit` is called when game create any unit, and my `damageSpecialUnit` is called when any unit get hit.
If you mean to simply have both in one file, then you need follow standard yaml rules, effect would look like:

Code: [Select]
extended:
  scripts:
    createUnit:
        - offset: 1
          code: |
            var ptr RuleArmor armorRuleSet;
            var int faction;
            var text armor_type;
            var int fulltu;
 
            unit.getRuleArmor armorRuleSet;
            armorRuleSet.getType armor_type;
            unit.getFaction faction;
 
            if eq faction 0;
              if eq armor_type "ZOMBIE_ARMOR";
                debug_log "Turn " turn ", setting Friendly spawnunit for new faction " faction " unit, Armor type " armor_type;
                unit.setSpawnUnitFaction 0;
                debug_log "Turn " turn ", Giving new friendly Zombie full TUs";
                unit.getTimeUnitsMax fulltu;
                unit.setTimeUnits fulltu;
                end;
              if eq armor_type "STR_CHRYSSALID_ARMOR_B_UC";
                debug_log "Turn " turn ", Giving new friendly Chryssalid full TUs";
                unit.getTimeUnitsMax fulltu;
                unit.setTimeUnits fulltu;
                end;
              end;
     
            return; 
    damageSpecialUnit:
      - offset: 13
        code: |
          if gt health_damage 0;
            var ptr RuleUnit zombie;
            var int faction;
           
            attacker.getFaction faction;
           
            rules.getRuleUnit zombie "STR_ZOMBIE";
            unit.setSpawnUnit zombie;
            unit.setSpawnUnitInstantRespawn 1;
            unit.setSpawnUnitFaction faction;
           
            # disable defualt transforamtion
            set transform_chance 0;
          end;
         
          return;

Another thing is that both scripts like this is called for every unit, some times you want only one to have special behavior.
This can be archived by local scripts like:
Code: [Select]
armor:
  - type: STR_FOOO
    scripts:
      damageSpecialUnit: |
          if gt health_damage 0;
            var ptr RuleUnit zombie;
            var int faction;
           
            attacker.getFaction faction;
           
            rules.getRuleUnit zombie "STR_ZOMBIE";
            unit.setSpawnUnit zombie;
            unit.setSpawnUnitInstantRespawn 1;
            unit.setSpawnUnitFaction faction;
           
            # disable defualt transforamtion
            set transform_chance 0;
          end;
         
          return;
This will make only unit with armor `STR_FOOO` change any thing into zombie.

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #19 on: March 31, 2023, 01:20:13 am »
I main using both two in one file. Actually in end of armors.rul file. And trying with zombieUnit. I am curious to see what effect it will have.

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #20 on: March 31, 2023, 02:21:32 am »
You do not combine them as each is called in different moment, `createUnit` is called when game create any unit, and my `damageSpecialUnit` is called when any unit get hit.
If you mean to simply have both in one file, then you need follow standard yaml rules, effect would look like:

Code: [Select]
extended:
  scripts:
    createUnit:
        - offset: 1
          code: |
            var ptr RuleArmor armorRuleSet;
            var int faction;
            var text armor_type;
            var int fulltu;
 
            unit.getRuleArmor armorRuleSet;
            armorRuleSet.getType armor_type;
            unit.getFaction faction;
 
            if eq faction 0;
              if eq armor_type "ZOMBIE_ARMOR";
                debug_log "Turn " turn ", setting Friendly spawnunit for new faction " faction " unit, Armor type " armor_type;
                unit.setSpawnUnitFaction 0;
                debug_log "Turn " turn ", Giving new friendly Zombie full TUs";
                unit.getTimeUnitsMax fulltu;
                unit.setTimeUnits fulltu;
                end;
              if eq armor_type "STR_CHRYSSALID_ARMOR_B_UC";
                debug_log "Turn " turn ", Giving new friendly Chryssalid full TUs";
                unit.getTimeUnitsMax fulltu;
                unit.setTimeUnits fulltu;
                end;
              end;
     
            return; 
    damageSpecialUnit:
      - offset: 13
        code: |
          if gt health_damage 0;
            var ptr RuleUnit zombie;
            var int faction;
           
            attacker.getFaction faction;
           
            rules.getRuleUnit zombie "STR_ZOMBIE";
            unit.setSpawnUnit zombie;
            unit.setSpawnUnitInstantRespawn 1;
            unit.setSpawnUnitFaction faction;
           
            # disable defualt transforamtion
            set transform_chance 0;
          end;
         
          return;

It works, but again something is wrong. Regardless of what the murder weapon was, the dead unit turns into a zombie. Who's in control? The one who created it. :D If a civilian kills an X-com agent, the X-com agent becomes a zombie, even though the murder weapon was a plasma. Zombies are controlled by civilians. If the X-com agent kills a civilian with any weapon, the civilian turns into a Zombie and is ruled by the X-com. If the player's agent kills an X-com agent, or a civilian, or kills his own unit with whatever weapon, it also becomes a Zombie and is still controlled by the player, If the Zombie is killed nothing happens, only the side that killed it takes control of it, but if you stun the Zombie, it will release a Chryss, but who will control it is not clear even to me. Now understand stunning. If stun zombie, the new Chryss controlled who controlled stunned Zombie. :D Not understand why become zombie all dead units.
« Last Edit: March 31, 2023, 02:56:59 am by Grober Nitho »

Offline Yankes

  • Commander
  • *****
  • Posts: 3213
    • View Profile
Re: Alien side
« Reply #21 on: March 31, 2023, 02:45:22 am »
I did say this is it will behave this way :>

Quote
This is example of script that will make ALL attacks to turn victim to friendly zombie. This is effective game of tag

We can limit scope of this "insanity" be checking who hit who, one way is to add tags to items to allow script to filter when should be do transformation.

I check source code and see that `damageSpecialUnit` do not have sibling hook that is linked to item, and we can't put this script easily on it.
I think I will add in next release of OXCE new hook `damageSpecialUnitAmmo` that will be called when given "bullet" hit unit.

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #22 on: March 31, 2023, 03:12:08 am »
I did say this is it will behave this way :>

We can limit scope of this "insanity" be checking who hit who, one way is to add tags to items to allow script to filter when should be do transformation.

I check source code and see that `damageSpecialUnit` do not have sibling hook that is linked to item, and we can't put this script easily on it.
I think I will add in next release of OXCE new hook `damageSpecialUnitAmmo` that will be called when given "bullet" hit unit.

Interesting like vanilla game, the mind controlled Chryss can't making zombi, just kill the victim. And mind controlled Zombie take undercontroll another zombie with kill, or other unit making zombie under player controll. So this is good working, just not working how I want. The Chryssalids can't making zombie.
« Last Edit: April 01, 2023, 01:07:29 pm by Grober Nitho »

Offline Yankes

  • Commander
  • *****
  • Posts: 3213
    • View Profile
Re: Alien side
« Reply #23 on: April 10, 2023, 12:19:07 am »
btw I added some options for recent nightly OXCE, you can now override default faction of zombifications (similar to spawn unit).
As bonus I added chance to spawn units and items from attacks itself.
Code: [Select]
zombieUnitFaction #default `1`, set to `-1` to allow faction based on current faction of attacker
zombieUnitChance #override `specialChance` to allow not making every "item roll" to be same precent chance
spawnUnitChance #same as `zombieUnitChance`  allow override `specialChance` for spawn of new unit per attack
spawnItemChance #same as `zombieUnitChance`  allow override `specialChance` for spawn of new item per attack

Offline Grober Nitho

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Alien side
« Reply #24 on: November 08, 2023, 11:01:58 pm »
Problem with underwater animation and sound still not solved, have some unfinished section, What not completted section simply phisical work and not a real problem, just need time, but right now there are things that are more important to me to be resolved. After slved all problems will working further the stopped sections. Have a chance still contain some tresh, becouse not cleaned up yet totally, but not causing problem in funcianaliity. No more fatal errors in mod, and game not colapse, but few action become extra long time action, one terror site become nearly 4 hours in real life's time. I think this make too much hostil units. Have 25 if I good recall. Iím bad recalled. Have 50 hostile units. 10 tanks and 40 soldiers in terror, but few civilians which represent agent hwo need your help, realli not want them your help, they helping for you. :D IÍm lookin again, searching which files not want, but not found, so have only few comments in  rul files, before publishing will deletting coments from files which not need.
« Last Edit: November 12, 2023, 11:09:48 pm by Grober Nitho »