OpenXcom Forum
Modding => OXCE Support => OpenXcom Extended => OXCE Support Y-scripts => Topic started by: Nord on July 14, 2021, 06:21:39 am
-
Hi. I am stuck with a question.
I have psi-amp for skills:
- type: STR_WEAPON_2
battleType: 9
...
tags:
IS_SKILL: 1 #mental
and soldier skill, based on that item:
- type: STR_STOP_SKILL
tags:
SKILL_ID: 17
costUse:
time: 5
targetMode: 14
compatibleWeapons: [STR_WEAPON_2]
checkHandsOnly: false
When i use
tryPsiAttackUnit:
- offset: 15 #Always success for inspiration etc.
code: |
...
skill.getTag skill_id Tag.SKILL_ID;
...
i get skill_id=17.
But later, when i use:
hitUnit:
- offset: 7 # for scripted items(Fright, Inspiration)
code: |
...
skill.getTag skill_id Tag.SKILL_ID;
...
i get skill_id=0
Question: WHY?
-
This could be bug, skill is not propagated to damage function and because of this, to script
-
Addition:
Same script hook with shooting or melee weapon works fine. Only psi-amp affected.
-
I will look on this today, clearly bug in logic
-
Another question:
BattleGame.randomChance
always returns 0.
(I see it in the physical shield script)
Is something wrong or i should turn something on to power up randomizer?
Thanks.
-
it's battle_game, not BattleGame
-
Yes, thanks. It is my mistake when writing this topic.
Found it. There must be a limits defined.
not
battle_game.randomChance temp;
but
battle_game.randomChance temp 1 100;
Upd.
not randomChance
but randomRange
.
Still dont understand how to use randomChance.
-
`randomChance` expect value in range of 0 to 100 and return 0 or 1
`randomRange` you give some range and you get some random value from this range e.g. 50-100 -> 57
-
@Nord I looked on code of `hitUnit`and I do not see any thing that could affect it. could you show me working example that have this error?
-
@Nord I looked on code of `hitUnit`and I do not see any thing that could affect it. could you show me working example that have this error?
I'll try to. But you need a whole working mod, i assume. And my internet is... well, i will try.
Here is Skills and Items rules, we are interested in "STR_MENTAL_WEAPON_2" item and "STR_STOP_SKILL" skill.
Later i'll try to upload entire mod.
Upd.
Uploaded mod: https://openxcom.org/forum/index.php/topic,6792.msg140197.html#msg140197 (https://openxcom.org/forum/index.php/topic,6792.msg140197.html#msg140197)
-
After returning to this bug, I find that PSI attacks to not use correctly propagate skill, now it should work correctly (OXCE 7.0.19).
-
After returning to this bug, I find that PSI attacks to not use correctly propagate skill, now it should work correctly (OXCE 7.0.19).
Great, thanks!