aliens

Author Topic: [Solved] Help with scripting...  (Read 7672 times)

wcho035

  • Guest
[Solved] Help with scripting...
« on: October 06, 2019, 10:09:19 pm »
Hi, I am attempting to modify Yankee script for Piratez for my mod.
After looking through it the coding is straight forward enough.

However, there are a few things in it are not properly define if anyone can help.

1) There are 0-19 resist type, can anyone tell me what each is and does stacking them on an item provide combine boosting/ buff effects?

2) I need to modify a section of the script for ITEM_STUN_PER_TURN; for Psi-defense.

What is the proper variable or declaration in lower or upper case format like is it Psi-Defense? psiDefense? for example.. I can declare without generating syntax errors?

Thank you all!
« Last Edit: February 12, 2023, 02:31:40 pm by Meridian »

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: Help with scripting...
« Reply #1 on: October 06, 2019, 10:23:32 pm »
The resist types you can look up in the language files to match the number to the type. The 'vanilla' ones, 0-9, have some hardcoded behavior such as high-explosive/concussive being AoE, 50%-150% roll by default. Those you can look up on ufopaedia.org. All the rest only do anything different if told to do so by an item's damageAlter.

You can get the documentation for all of the scripts by running the game after setting "debug: true" and "verboseLogging: true" and then checking the openxcom.log file. I also keep a version of this file on GitHub if you want to reference that.

wcho035

  • Guest
Re: Help with scripting...
« Reply #2 on: October 06, 2019, 10:54:27 pm »
Hi Ohartenstein23.

Thank you for your kindly for the reply.

I found the answer to my second question (I hope) in github.

For the resist 0-19 question, can’t find anything in the language files from OXCE.

Is there anywhere else I can find those references?

Thanks again!


Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Help with scripting...
« Reply #3 on: October 06, 2019, 11:53:04 pm »
I'm not sure if this is what you are looking for, but perhaps it will be useful if you are not already aware of it:
https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)#Item_Damage_Types

wcho035

  • Guest
Re: Help with scripting...
« Reply #4 on: October 07, 2019, 12:27:20 am »
Thanks Martian, it is what I am looking for, it make sense now. It is similar to damage type but resist damage. I just remember OXCE has up to 18 of these.

wcho035

  • Guest
Re: Help with scripting...
« Reply #5 on: October 07, 2019, 01:06:50 pm »
Okay, I have whip up a prototype Script. However, it doesn't work.

Can anyone help?

 

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9093
    • View Profile
Re: Help with scripting...
« Reply #6 on: October 07, 2019, 01:32:15 pm »
Do you even realize how ridiculous your request is?

You give us 2000+ lines of scripts and absolutely NO description what's wrong or how to reproduce it... I don't even have words for this.

wcho035

  • Guest
Re: Help with scripting...
« Reply #7 on: October 07, 2019, 01:59:35 pm »
Sorry Meridian. I was in a rush, not the time to post more details.

I am trying to create two items in my game. One is a personal energy shield similar to Piratez or Dioxine's mod. It can be prime and then generate a protection field. Instead of the shield as a melee weapon. I used the motion scanner and turn it into a device that can turn on or off energy shield protection.

However, the energy shield did not work, after it is prime. I tested it on the original version from Dioxine and now my motion scanner adaptation.  So, I am not 100% sure where is the problem.

In the script, everything after "extend" is a straight copy from Yankee's script in Dioxine's Piratez mod.

With the exception of.

          item.getRuleItem itemRuleset;
          itemRuleset.getTag changePerTurn Tag.ITEM_PSISTRENGTH_PER_TURN;
          unit.getPsiStrength currentValue;
          unit.getPsiStrengthMax maxValue;
          set changedValue currentValue;
          add changedValue changePerTurn;
          limit changedValue 0 maxValue;
          unit.setStun changedValue;

In line 1321.

The second device, the Psi-Shield, I was hoping to use ITEM_PSISTRENGTH_PER_TURN to boost the soldier's psi-defense stats.
This never seems to have any effect at all. Before, I uses Dioxine's original item script for STR_DRUG_DISPENSOR, now I modded it to my own version using a motion scanner to prime and turn on the Psi strength. It didn't work not surprisingly.

I was hopping someone experience modding with Yankee's scripts to help correct which ever it is not working in my script.

Sorry for the lack of details,


Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Help with scripting...
« Reply #8 on: October 07, 2019, 08:35:18 pm »
could you say precisely what effect you want have? And what exactly result you get? "do not work" is not answer. Do you get error or something in logs?



wcho035

  • Guest
Re: Help with scripting...
« Reply #9 on: October 07, 2019, 11:16:46 pm »
Okay, I have no error in running the above script. The two items are tested in battlescape, it just that their desire effects are not functioning.

E.g I tested the personal shield by priming it, the plasma shot from alien heavy plasma turn soldier into chowder meat.

Same with the psi strength boosting device, in battlescape, it doesn’t boost the soldier’s stats, passive or otherwise.

Before changing the code like it is now, using these device like motion sensors. I had used the same exact coding like it’s from Piratez. Same results and outcome, either I am missing something in my mod or the script need something extra.

Thanks you all kindly for helping

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Help with scripting...
« Reply #10 on: October 08, 2019, 12:12:27 am »
E.g I tested the personal shield by priming it, the plasma shot from alien heavy plasma turn soldier into chowder meat.
This mean script do not work (if you do not break completely original script behaviour). Do you checks logs for script errors?

btw what you wated using `unit.setStun changedValue;`? This change stun value in unit.

First for all if you start with script you should do small steps, like:
a) make script that run on unit creation and make solder psi immune.
b) test if he is psi immune
c) move this logic to other script
d) test if it still work
e) alter script to have more interesting behaviour (instead of total immune give some bigger resistances)
f) test it again
g) use `debug_log "some text" unit "variable" changePerTurn;` (need fresh version of OXCE) to log some script behavior

wcho035

  • Guest
Re: Help with scripting...
« Reply #11 on: October 08, 2019, 01:55:59 am »
Hi Yankes, I have updated the small error I have overlooked. No change in game or item behaviour. I will attempt to generate some error logs when I test it again
« Last Edit: October 08, 2019, 10:27:23 am by Precentor Apollyon »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9093
    • View Profile
Re: Help with scripting...
« Reply #12 on: October 08, 2019, 09:57:40 am »
The nickname is Yankes btw, not Yankee.

wcho035

  • Guest
Re: Help with scripting...
« Reply #13 on: October 08, 2019, 10:26:15 am »
Sorry, miss type, phone butter fingers. Will correct.

wcho035

  • Guest
Re: Help with scripting...
« Reply #14 on: October 08, 2019, 10:51:50 am »
Here is the logs from my test game run today.

I am not sure what I am looking for. However, within the logs, I chance upon these lines.

[08-10-2019_14-06-20]   [ERROR]   Unknown argument 'Tag.ITEM_PSISTRENGTH_PER_TURN'
[08-10-2019_14-06-20]   [ERROR]   Error in matching arguments for operator 'RuleItem.getTag'
[08-10-2019_14-06-20]   [ERROR]   Error in parsing script 'newTurnItem' for 'Global Event Script': invalid operation in line: 'itemRuleset.getTag changePerTurn Tag.ITEM_PSISTRENGTH_PER_TURN;'
[08-10-2019_14-06-20]   [ERROR]   Error in tags: 'ITEM_PSISTRENGTH_PER_TURN' unknown tag name not defined in current file

So, this mean the script is not communicating with the C++ codes?

Also to confirm I got the Energy shield working. The item's shield health was low.. that's why I didn't see any effects. PsiStrength is still not working however.

Hi Yankes,

For

a) make script that run on unit creation and make solder psi immune.

I would not know how to start on this.
« Last Edit: October 08, 2019, 01:25:28 pm by Precentor Apollyon »