OpenXcom Forum

Modding => OXCE Support => OpenXcom Extended => OXCE Support Y-scripts => Topic started by: vadracas on May 15, 2020, 10:10:16 pm

Title: [Solved] New to scripting~~~Need help with project
Post by: vadracas on May 15, 2020, 10:10:16 pm
I'm attempting to write a script to create more varied enemies-
 First problem: I attempted to make it so that only enemies would get the tags but have no idea if that part of the script is functioning.

Second problem: tags aren't being applied to any enemy ever.


Attaching the mod-please provide any critical feedback you have.
Title: Re: New to scripting~~~Need help with project
Post by: Meridian on May 15, 2020, 10:19:48 pm
Sorry to say, but your script is 100% gibberish.

Can't really give any kind of feedback on that.
Title: Re: New to scripting~~~Need help with project
Post by: vadracas on May 15, 2020, 10:24:52 pm
ok... I was literally reading from the scripting page on UFOpaedia and the API, so idk.
Title: Re: New to scripting~~~Need help with project
Post by: Meridian on May 15, 2020, 10:32:36 pm
Here's a little something for inspiration: https://openxcom.org/forum/index.php/topic,7197.msg116928.html#msg116928
Title: Re: New to scripting~~~Need help with project
Post by: ohartenstein23 on May 15, 2020, 10:37:32 pm
In the 40k mod we use a script to set random appearances for a certain type of enemy unit - you can check in our script files for the createUnit scripts for inspiration.
Title: Re: New to scripting~~~Need help with project
Post by: vadracas on May 15, 2020, 11:11:12 pm
Thank you both!

So if I were to do what's outlined in your example, Meridian, would I have to copy/paste the script for every armor in every mod that I would want to use this with, or is there a way to make it apply automatically to all armors through a refnode or something?
Title: Re: New to scripting~~~Need help with project
Post by: ohartenstein23 on May 15, 2020, 11:13:56 pm
Check how scripts are used in 40k, XCF, or Piratez - you can define a new tag to put on armors or items you want to interact with scripts.
Title: Re: New to scripting~~~Need help with project
Post by: Meridian on May 15, 2020, 11:17:11 pm
So if I were to do what's outlined in your example, Meridian, would I have to copy/paste the script for every armor in every mod that I would want to use this with, or is there a way to make it apply automatically to all armors through a refnode or something?

My example was just a "local" script.

You can easily make a "global" script ... like you tried in your example... which applies to all (or tagged) armors.
Just study some existing scripts first, to get a feeling for it.