aliens

Author Topic: [Solved] Boosting stats for a turn  (Read 4264 times)

Offline SuperCaffeineDude

  • Colonel
  • ****
  • Posts: 108
    • View Profile
    • supercaffeinedude
[Solved] Boosting stats for a turn
« on: November 28, 2019, 06:35:29 pm »
Is there a way to have the effects of a stat like shooting/melee temporarily boosted/negated for 1 turn by another unit? (not permanently boosted?)

Example; Officer has a radio that he uses on a rookie to tell him to remember his training
Psi-Unit uses an attack to warp an enemy's perception, that reduces their chance to hit that turn
« Last Edit: February 12, 2023, 02:35:05 pm by Meridian »

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Boosting stats for a turn
« Reply #1 on: November 28, 2019, 07:57:43 pm »
Psi-amp USE attack work similar to normal weapon, and normal weapon can alter unit state (not stats!) in any way you want on hit.
AFIK piratez do this with banner that boost morale. Overall you need lean how to write small scripts that you add to ruleset to fully implement this.

btw this is in OXCE, OXC do not have any way do this.

Offline SuperCaffeineDude

  • Colonel
  • ****
  • Posts: 108
    • View Profile
    • supercaffeinedude
Re: Boosting stats for a turn
« Reply #2 on: November 28, 2019, 08:13:50 pm »
Huh, the psi-amp sounds like a good tip  :D

I've had a look at your  [Documentation] post, it's been most of my insight lol.

Perhaps I could do something similar to your "poison bullets"

So it inflicts an increase in the desired stat (i.e. +1), then negates it entirely the next turn (i.e. -1) I'll give it a go

Question: "offset: 1" does that mean carry out effect next turn or??  :P

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Boosting stats for a turn
« Reply #3 on: November 28, 2019, 10:29:55 pm »
This is need for multiple mods to have defined order of execution of same script. Give some random number from 0 to 100 and it will be great :)
Using any other number would be needed if you want be run before or after another specific mod script.

Offline memmaker

  • Captain
  • ***
  • Posts: 96
    • View Profile
Re: Boosting stats for a turn
« Reply #4 on: December 21, 2019, 05:14:24 am »
Psi-amp USE attack work similar to normal weapon, and normal weapon can alter unit state (not stats!) in any way you want on hit.
AFIK piratez do this with banner that boost morale. Overall you need lean how to write small scripts that you add to ruleset to fully implement this.

btw this is in OXCE, OXC do not have any way do this.

So, I am trying to get this to work. Namely having a a script executed by the Psi-Amp Use Action. I tried the damageUnit and hitUnit hooks but neither seems to trigger when activating the Use action. Any ideas on how this could be accomplished?

Code: [Select]
items:
  - type: STR_SKILL_AMP
    size: 0.1
    costSell: 194700
    weight: 10
    bigSprite: 33
    floorSprite: 32
    handSprite: 88
    hitSound: 36
    battleType: 9
    twoHanded: false
    invWidth: 1
    invHeight: 3
    tuUse: 1
    costUse:
      time: 1
    accuracyUse: 100
    accuracyMindControl: 100
    accuracyPanic: 100
    flatRate: true
    psiAttackName: STR_USE_SKILL
    scripts:
      hitUnit:
        - offset: 35
          code: |
            debug_log "Skill Amp Was Used!"
            return;

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9092
    • View Profile
Re: Boosting stats for a turn
« Reply #5 on: December 21, 2019, 06:20:26 pm »
1/ first, your psi amp is not hitting anything... you need to give it at last dmage type and some power

Code: [Select]
items:
  - type: STR_SKILL_AMP
    damageType: 1
    power: 80

2/ second, the hitUnit script hook is defined on the victim's armor... not on the attacker's weapon

3/ third, local script and global script syntax is different... you tried using global syntax, which doesn't work... for local script, you don't need `offset` and `code` attributes

4/ fourth, you forgot semicolon after your debug command

5/ fifth, this script needs 3 return arguments (power, bodyPart and bodySide), you have no return parameters

Code: [Select]
armors:
  - type: FLOATER_ARMOR0
    scripts:
      hitUnit: |
        debug_log "Floater was hit!";
        return 50 1 1;

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Boosting stats for a turn
« Reply #6 on: December 21, 2019, 10:56:58 pm »
Lol, I probably had hard day, because I miss 90% errors in code that you find Meridian :>

Offline memmaker

  • Captain
  • ***
  • Posts: 96
    • View Profile
Re: Boosting stats for a turn
« Reply #7 on: December 22, 2019, 02:22:23 am »
Thanks for the reply. It really helped. I added the setters myself in a fork. Learned a lot today.  8)
« Last Edit: December 23, 2019, 12:24:21 pm by memmaker »