Problem (bug or voluntary situation ?) in unit scripts

Post bug reports and ask for help with other issues here.
Post Reply
User avatar
welk
Posts: 1333
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Problem (bug or voluntary situation ?) in unit scripts

Post by welk »

Working on a "unit script" in my modding work, I noticed that editor script does refuse absolutly the value 2 in this line:
#TYPE=
Each time I set 2, it reports an error
Each time I set 0,1 or 3 : no any problem

To be sure, I opened the vanilla campaign Storm Europe, I registered it under a new name, then I opened the unit script of the campaign and in the first script (reproduced below), and I changed 1 to 2 for #TYPE=

My unic modification was to change "1" in "2" for the line #TYPE= , I did not change anything else

Result was same like in my own campaign : Editor did report a script error and did not accept "2"

I noticed that in all vanilla units scripts, the line #TYPE= has never the value = 2

Is it a bug or a voluntary situation ? I don't know, I report it in case of utility
Perhaps, is it not a bug, but a voluntary decision to exclude 2 as value for unit scripts ? In this case, It should be good to inform users about this restriction

The actual documentation for unit scripts do not give any alert about that : the doc text is that (like all other scripts):
#TYPE= Values range [0, 3];
; With all other fields satisfied will this be:
; 0 = Single check regardless if #TRIGGER is satisfied
; 1 = Multiple check until #TRIGGER is satisfied
; 2 = Reoccuring check until end of game
; OR
; Once the #DATE field is satisfied:
; 3 = Event fires once if all other fields are satisfied, else it will not fire. Either way, event will be removed never to be looked at again




REPRODUCTION OF VANILLA UNIT SCRIPT (The first in UNITS SCRIPT)
This version has no any problem
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; UK Decision Events
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;REMOVE1941
{
#NAME= DE 100 - The Large Destroyer Triomphant Serves As A Light Cruiser In The UK
#POPUP= <<TAG_1>>
#IMAGE= triomphant.png
#SOUND=
#FLAG= 1
#TYPE= 1
#AI= 0
#LEVEL= 0
#GV= 1[1,100]
#LINK= 100[1]
#COUNTRY_ID= 112
#TRIGGER= 50
#PRIVATE= 0
#DISPLAY_TURN= 0
#FULL_RESEARCH= 0
#DATE= 1940/09/01
#FAILSAFE_DATE= 1948/01/01
#DESTINATION_RESOURCE= 136,69
#DESTINATION_RESOURCE= 137,80
; UK politically aligned with Allies and not surrendered
#VARIABLE_CONDITION= 112 [2] [100] [0]
; Dummy condition position (always satisfied)
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
#UNIT= 39 [5] [0] [FNFL Triomphant]
}

But if I just change 1 to set 2, I obtain a error report in editor, with this below version (that is exactly the same, except I set 2 in place of 1 in the concerned line #TYPE= )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; UK Decision Events
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;REMOVE1941
{
#NAME= DE 100 - The Large Destroyer Triomphant Serves As A Light Cruiser In The UK
#POPUP= <<TAG_1>>
#IMAGE= triomphant.png
#SOUND=
#FLAG= 1
#TYPE= 2
#AI= 0
#LEVEL= 0
#GV= 1[1,100]
#LINK= 100[1]
#COUNTRY_ID= 112
#TRIGGER= 50
#PRIVATE= 0
#DISPLAY_TURN= 0
#FULL_RESEARCH= 0
#DATE= 1940/09/01
#FAILSAFE_DATE= 1948/01/01
#DESTINATION_RESOURCE= 136,69
#DESTINATION_RESOURCE= 137,80
; UK politically aligned with Allies and not surrendered
#VARIABLE_CONDITION= 112 [2] [100] [0]
; Dummy condition position (always satisfied)
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
#UNIT= 39 [5] [0] [FNFL Triomphant]
}
User avatar
BillRunacre
Posts: 6921
Joined: Mon Jul 22, 2013 2:57 pm
Contact:

Re: Problem (bug or voluntary situation ?) in unit scripts

Post by BillRunacre »

It is news to me that this does not work, though on the other hand, it might be hardcoded to prevent the script from firing every turn, i.e. under what circumstances might a unit deploying every turn be desired?
Follow us on Twitter: https://twitter.com/FurySoftware

We're also on Facebook! https://www.facebook.com/FurySoftware/
User avatar
welk
Posts: 1333
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Problem (bug or voluntary situation ?) in unit scripts

Post by welk »

I wanted to use that because I will implement air drop of supply units in the game (for my ASL Tactical Command mod).

It would have been interesting to have some regular air drops on map without to have to create lot of scripts. But it's a minor detail, I just wanted to know if it was a bug or a voluntary situation, I will use specific scripts to avoid the problem
User avatar
Hubert Cater
Posts: 6123
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: Problem (bug or voluntary situation ?) in unit scripts

Post by Hubert Cater »

Thanks for the report and you are correct, UNIT scripts support #TYPE values 0, 1, and 3 only.

Type 2 is deliberately disabled because unit events consume their unit list when deploying units, making repeated execution unsafe, e.g. can lead to crashes.

The header section for UNIT events just needs to be updated on our end to reflect this.
User avatar
welk
Posts: 1333
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Problem (bug or voluntary situation ?) in unit scripts

Post by welk »

Ok, thanks Hubert.

As paranoïac, I have now the definitive proof that you are a Vietminh agent, because you have made all in SC to block air drop reinforcement units in Dien Bien phu and Koera : Everything was premeditated since 1939 :roll: :mrgreen:
User avatar
Hubert Cater
Posts: 6123
Joined: Mon Jul 22, 2013 11:42 am
Contact:

Re: Problem (bug or voluntary situation ?) in unit scripts

Post by Hubert Cater »

I have to admit, that actually made me laugh, well done :)
Post Reply

Return to “Tech Support”