Jump to content

Recommended Posts

alright , I'm so close to having my mission working 100% including ai commanders ..

but my lack of real scripting/coding has put a big hold on me finishing this mission as sqs ,

to later then start porting it from sqs to sqf ..

issues are variables and defines in two different scripts ... 

not a lot of errors but ive tried everything I know from _myvar = objnull, _myvar = [], _myvar = true, faults ,this select... it goes on and on...

and is why I'm asking anyone that know how this stuff is done .. I NEED HELP.

and before I hear again "just rewite it in sqf", this is not the point, I need it working as it was made fully before I cant start to do any sqf to the existing sqs scripts... ive been partly down this road and things get worse..

 

thank you if anyone is up to it.. might only take a good scripter/coder 10 min?

for me its all guessing ...

 

pm me here of steam Dr Death JM

 

Share this post


Link to post
Share on other sites

Honestly, you don't need to re-write all the scripts in sqs. It's been long-obsolete. It will probably be better and a shorter development time in the long run if you just write everything in sqf. If you have the same goal in mind, the scripts are functionally identical. Hell, you might even write it more efficiently.

Share this post


Link to post
Share on other sites

@dr death jm - to be fair mate, it does say "always looking for help sqs to sqf" in your sig  ;)

 

I would say, post up the 2 broken sqs scripts and we can have a look here.

Share this post


Link to post
Share on other sites

@dr death jm - to be fair mate, it does say "always looking for help sqs to sqf" in your sig   ;)

 

I would say, post up the 2 broken sqs scripts and we can have a look here.

_baseUnit = _this Select 0
_groupCreate = _this Select 1
_side = _this Select 2
_group = []

_West = FALSE;
_East = FALSE;
?_side == West : _West = TRUE; _crewType = WestCrewType; _tankType1 = WestTankType1; _tankType2 = WestTankType2; _tankType3 = WestTankType3; _tankType4 = WestTankType4
?_side == East : _East = TRUE; _crewType = EastCrewType; _tankType1 = EastTankType1; _tankType2 = EastTankType2; _tankType3 = EastTankType3; _tankType4 = EastTankType4

#Init

_targetDistance = 50
_vcldead = FALSE
_pos = Getpos _baseUnit
_dir = GetDir _baseUnit - 180
_dist = 150

_posX = (_pos select 0) + _dist * sin _dir
_posY = (_pos select 1) + _dist * cos _dir

#Offense
~5
?!(getdammage _baseUnit < 0.95) || CreatingSquad : Goto "Offense"


CreatingSquad = TRUE


?_West : _init = "AIoffenselandcrewW = this"
?_East : _init = "AIoffenselandcrewE = this"

_skill = 1
_rank = "CORPORAL"

_c = 0

#OffenseLoop
~5
_crewType CreateUnit [[_posX,_posY],_groupCreate,_init,_skill,_rank]

;;_crew = (Units _groupCreate Select 1)

?_West : _crew = AIoffenselandcrewW
?_East : _crew = AIoffenselandcrewE

_newSquad = _newSquad + [_crew]

[_crew] Join GrpNull

?(_c == 0) : _crew1 = _crew
?(_c == 1) : _crew2 = _crew
?(_c == 2) : _crew3 = _crew
?(_c == 3) : _crew4 = _crew
?(_c == 4) : _crew5 = _crew
?(_c == 5) : _crew6 = _crew
?(_c == 6) : _crew7 = _crew
?(_c == 7) : _crew8 = _crew



_c = _c + 1

?_c < 8 : Goto "OffenseLoop"

CreatingSquad = FALSE


#Tanks
_group = Group _crew1
[_crew2,_crew3,_crew4,_crew5,_crew6,_crew7,_crew8] JOIN Group _crew1

_tank1 = _tankType1 CreateVehicle [_posX,_posY]

NewVcl = _tank1

_crew1 AssignAsDriver _tank1
_crew2 AssignAsGunner _tank1

[_crew1,_crew2] OrderGetIn TRUE

~5
_tank2 = _tankType2 CreateVehicle [_posX,_posY]

NewVcl = _tank2

_crew3 AssignAsDriver _tank2
_crew4 AssignAsGunner _tank2

[_crew3,_crew4] OrderGetIn TRUE


~5

_tank3 = _tankType3 CreateVehicle [_posX,_posY]

NewVcl = _tank3

_crew5 AssignAsDriver _tank3
_crew6 AssignAsGunner _tank3

[_crew5,_crew6] OrderGetIn TRUE

~5

_tank4 = _tankType4 CreateVehicle [_posX,_posY]

NewVcl = _tank4

_crew7 AssignAsDriver _tank4
_crew8 AssignAsGunner _tank4

[_crew7,_crew8] OrderGetIn TRUE


#SetBehaviour
_group SetCombatMode "RED"
_group SetBehaviour "COMBAT"

?(_initDone) : Goto "FindTarget"


?(_West) : Goto "WInit"
?(_East) : Goto "EInit"


#WInit
~5
TanksWO = _tank1
PublicVariable "TanksWO"

?IsNull ECommandHQ : Goto "WInit"

_enemyMCU = EMCU
_enemyCHQ = ECommandHQ
_enemyBarracks = EBarracks
_enemyTF = ETankFactory
_enemyAF = EAirCraftFactory
_enemyRadar = ERadar
_enemyRec = ERecycler

_initDone = TRUE

Goto "FindTarget"


#EInit
~5
TanksEO = _tank1
PublicVariable "TanksEO"

?IsNull WCommandHQ : Goto "EInit"


_enemyMCU = WMCU
_enemyCHQ = WCommandHQ
_enemyBarracks = WBarracks
_enemyTF = WTankFactory
_enemyAF = WAirCraftFactory
_enemyRadar = WRadar
_enemyRec = WRecycler

_initDone = TRUE

#FindTarget

_target = _enemyCHQ

#EnemyBase

_pos = Getpos _target
_group MOVE _pos

_group SetSpeedMode "FULL"

#EnemyBaseLoop
~.01
?(!CanMove _tank1) AND (!Canmove _tank2) ANd (!CanMove _tank3) : Goto "Finish"

?(Leader _group Distance _target < 200) : Goto "TargetDestroy"

?(_West) AND (!CanMove _tank1) : TanksWO = _tank2; PublicVariable "TanksWO"
?(_East) AND (!CanMove _tank1) : TanksEO = _tank2; PublicVariable "TanksEO"

?(_West) AND (!CanMove _tank1) AND (!CanMove _tank2) : TanksWO = _tank3; PublicVariable "TanksWO"
?(_East) AND (!CanMove _tank1) AND (!CanMove _tank2) : TanksEO = _tank3; PublicVariable "TanksEO"

Goto "EnemyBaseLoop"

#TargetDestroy
_group MOVE _pos

#TargetLoop
~.01

?(!CanMove _tank1) AND (!Canmove _tank2) ANd (!CanMove _tank3) : Goto "Finish"
?(Count Units _group < 2) : Goto "Finish"

?(_West) AND (!CanMove _tank1) : TanksWO = _tank2; PublicVariable "TanksWO"
?(_East) AND (!CanMove _tank1) : TanksEO = _tank2; PublicVariable "TanksEO"

?(_West) AND (!CanMove _tank1) AND (!CanMove _tank2) : TanksWO = _tank3; PublicVariable "TanksWO"
?(_East) AND (!CanMove _tank1) AND (!CanMove _tank2) : TanksEO = _tank3; PublicVariable "TanksEO"

Goto "TargetLoop"


#Finish

{_x SetDammage 1} foreach (Units _group)

~30

Goto "Init"

#End
Exit

Share this post


Link to post
Share on other sites

ok, so how are you starting script (params/args etc) and what is/are the error(s) it throws?

Share this post


Link to post
Share on other sites

Error in expression < CreateUnit [[_posX,_posY],_groupCreate,_init,_skill,_rank]>
 Error position: <_init,_skill,_rank]>
Error Undefined variable in expression: _init
Error in expression <_newSquad = _newSquad + [_crew]>
Error position: <_newSquad + [_crew]>
Error Undefined variable in expression: _newsquad
Error in expression <[_crew] Join GrpNull>
Error position: <_crew] Join GrpNull>
Error Undefined variable in expression: _crew
Error in expression <_crew1 = _crew>
Error position: <_crew>
Error Undefined variable in expression: _crew

 

Error in expression <(Leader _group Distance _target < 200) >
Error position: <_group Distance _target < 200) >
Error Undefined variable in expression: _group

Share this post


Link to post
Share on other sites

ok, so how are you starting script (params/args etc) and what is/are the error(s) it throws?

these errors come up when ai commander is building vehicles and putting ai in them and also ai at tank factory building there vehicles and squads the ai building there sqauds errors but does work, but ai commanders vehicle spawn but no ai .. when commander build his it supposed to show land marker on map (there end destination)

Share this post


Link to post
Share on other sites


_West = FALSE;
_East = FALSE;
?_West : _init = "AIoffenselandcrewW = this"
?_East : _init = "AIoffenselandcrewE = this"


 

Those lines look dodgy to me.

 

You define _west and _east as false and then only define the _init variable if either _west or _east is true (which neither of them are as they have both been defined as false).

  • Like 1

Share this post


Link to post
Share on other sites

ok fixed this on

line 29 and 30

 

_West = FALSE;

_East = FALSE;

 

to

 

;;West = FALSE;

;;_East = FALSE;

Share this post


Link to post
Share on other sites

 

_West = FALSE;
_East = FALSE;
?_West : _init = "AIoffenselandcrewW = this"
?_East : _init = "AIoffenselandcrewE = this"
 
Those lines look dodgy to me.
 
You define _west and _east as false and then only define the _init variable if either _west or _east is true (which neither of them are as they have both been defined as false).

 

ok so , this is were I get screwed up.. what do I d from here ? I thught taking out the false was the trick.. is there more?

Share this post


Link to post
Share on other sites

Honestly, you don't need to re-write all the scripts in sqs. It's been long-obsolete. It will probably be better and a shorter development time in the long run if you just write everything in sqf. If you have the same goal in mind, the scripts are functionally identical. Hell, you might even write it more efficiently.

if I had the skills , .. this mission will be very hard to simply rewrite, ive been slowly proving in my small world of listener's  that there are things in sqs you can not do in sqf.. why? I don't know, but at least 4 or so people have tried to rewrite some of the  important  scripts from rts3 to sqf and it either works (sotra) or works harsh but dosnt work mp.. KaRRiLLioN  wrote a very complex mission for its time,  and I have to say its smaller in size to cti but offers more.. I know some things have to be ported to sqf , I have a few sqf's in there now .. theres a lot fixed in the mission ..

what is not working; ai spawning in capped territories for defense, radar shooting down enemy air and missle prevention from air to ground.

what works with bugs but no errors

reaserching vtol/stol for air, assigning ai as commander or player (in menu), commanders control of playable ai , (all menu button get in ,get out, driver ,gunner..) and last waypoints to send playable ai...

So , me being at this point of mission, I have to keep doing it, I played this mission for years (there is no other like it) ..

welp sorry for babbling on it 3am here I need to got to bed.. you should "when I upload the update" play the mission just once, and you will be hooked. ;)

Share this post


Link to post
Share on other sites

ok so , this is were I get screwed up.. what do I d from here ? I thught taking out the false was the trick.. is there more?

 

 

Probably.  I normally just make a change, check the error log, make another change and so on.  Eventually, you'll nail them all.

 

What errors does it come up with now?

 

I would have to agree with DE that you are better off doing a rewrite.  It's totally possible to do anything in sqf that you could do in sqs (and more besides).  I was going to try and rewrite it for you yesterday but without all the supporting files (which explains some of the global variables and context), it would have been a shot in the dark.

 

I think I get the general idea of it though (recurring tank platoons assaulting pre-determined targets) but as I say, some of it doesn't make sense (for example: 

_enemyMCU = EMCU

It's defined, but never referred to again in the script.  There's a few other variables like that so there's dead ends with no apparent explanation.

Share this post


Link to post
Share on other sites

Probably.  I normally just make a change, check the error log, make another change and so on.  Eventually, you'll nail them all.

 

What errors does it come up with now?

 

I would have to agree with DE that you are better off doing a rewrite.  It's totally possible to do anything in sqf that you could do in sqs (and more besides).  I was going to try and rewrite it for you yesterday but without all the supporting files (which explains some of the global variables and context), it would have been a shot in the dark.

 

I think I get the general idea of it though (recurring tank platoons assaulting pre-determined targets) but as I say, some of it doesn't make sense (for example: 

_enemyMCU = EMCU

It's defined, but never referred to again in the script.  There's a few other variables like that so there's dead ends with no apparent explanatio

just what you said explains how much I don't know about coding.. EMCU is the east MCU it is refed to thru the files,

the mission worked with out ai commanders but it was requested .. I really need help... the script above works as in they do drive to destination but as I watched in cam they don't shoot at targets said.

Share this post


Link to post
Share on other sites

Well you only learn by practice, so it's all good.  I wouldn't worry too much about the missions etc, focus on fixing script errors and then move onto stuff like that.

 

What errors are happening now on the script?

 

Also, it might be worth you uploading the mission to github or somewhere like here, so if anyone is inclined then they can help easier without asking you a million questions.

Share this post


Link to post
Share on other sites

the mission is uploaded in mission section , but not with ai commanders.

lat time I tried git I was screwed up ... my new error in  Error in expression <(_initDone) line 163

Share this post


Link to post
Share on other sites

 

_baseUnit = _this Select 0
_groupCreate = _this Select 1
_side = _this Select 2
_group = []
_newSquad = []

 

_West = FALSE;
_East = FALSE;
?_side == West : _West = TRUE; _crewType = WestCrewType; _tankType1 = WestTankType1; _tankType2 = WestTankType2; _tankType3 = WestTankType3; _tankType4 = WestTankType4
?_side == East : _East = TRUE; _crewType = EastCrewType; _tankType1 = EastTankType1; _tankType2 = EastTankType2; _tankType3 = EastTankType3; _tankType4 = EastTankType4

 

#Init

_targetDistance = 50
_vcldead = FALSE
_pos = Getpos _baseUnit
_dir = GetDir _baseUnit - 180
_dist = 150

_posX = (_pos select 0) + _dist * sin _dir
_posY = (_pos select 1) + _dist * cos _dir

#Offense
~5

?!(getdammage _baseUnit < 0.95) OR CreatingSquad : Goto "Offense"

 

CreatingSquad = TRUE

?_West : _init = "AIoffenselandcrewW = this"
?_East : _init = "AIoffenselandcrewE = this"

_skill = 1
_rank = "CORPORAL"

_c = 0

 

 

 

#OffenseLoop
~5
_crewType CreateUnit [[_posX,_posY],_groupCreate,_init,_skill,_rank]

;;_crew = (Units _groupCreate Select 1)

?_West : _crew = AIoffenselandcrewW
?_East : _crew = AIoffenselandcrewE

 

_newSquad = _newSquad + [_crew]

[_crew] Join GrpNull

?(_c == 0) : _crew1 = _crew
?(_c == 1) : _crew2 = _crew
?(_c == 2) : _crew3 = _crew
?(_c == 3) : _crew4 = _crew
?(_c == 4) : _crew5 = _crew
?(_c == 5) : _crew6 = _crew
?(_c == 6) : _crew7 = _crew
?(_c == 7) : _crew8 = _crew

 

_c = _c + 1

?_c < 8 : Goto "OffenseLoop"

CreatingSquad = FALSE

 

 

#Tanks
_group = Group _crew1
[_crew2,_crew3,_crew4,_crew5,_crew6,_crew7,_crew8] JOIN Group _crew1

_tank1 = _tankType1 CreateVehicle [_posX,_posY]

NewVcl = _tank1

_crew1 AssignAsDriver _tank1
_crew2 AssignAsGunner _tank1

[_crew1,_crew2] OrderGetIn TRUE

~5
_tank2 = _tankType2 CreateVehicle [_posX,_posY]

NewVcl = _tank2

 

_crew3 AssignAsDriver _tank2
_crew4 AssignAsGunner _tank2

 

[_crew3,_crew4] OrderGetIn TRUE

 

 

~5

_tank3 = _tankType3 CreateVehicle [_posX,_posY]

 

NewVcl = _tank3

_crew5 AssignAsDriver _tank3
_crew6 AssignAsGunner _tank3

 

 

[_crew5,_crew6] OrderGetIn TRUE

 

~5

_tank4 = _tankType4 CreateVehicle [_posX,_posY]

 

NewVcl = _tank4

 

_crew7 AssignAsDriver _tank4
_crew8 AssignAsGunner _tank4

 

[_crew7,_crew8] OrderGetIn TRUE

 

 

#SetBehaviour
_group SetCombatMode "RED"
_group SetBehaviour "COMBAT"

 

?(_initDone) : Goto "FindTarget"

?(_West) : Goto "WInit"
?(_East) : Goto "EInit"

#WInit
~5
TanksWO = _tank1

PublicVariable "TanksWO"

?IsNull ECommandHQ : Goto "WInit"

_enemyMCU = EMCU
_enemyCHQ = ECommandHQ
_enemyBarracks = EBarracks
_enemyTF = ETankFactory
_enemyAF = EAirCraftFactory
_enemyRadar = ERadar
_enemyRec = ERecycler

_initDone = TRUE

Goto "FindTarget"

#EInit
~5
TanksEO = _tank1

PublicVariable "TanksEO"

?IsNull WCommandHQ : Goto "EInit"

_enemyMCU = WMCU
_enemyCHQ = WCommandHQ
_enemyBarracks = WBarracks
_enemyTF = WTankFactory
_enemyAF = WAirCraftFactory
_enemyRadar = WRadar
_enemyRec = WRecycler

_initDone = TRUE

 

#FindTarget

_target = _enemyCHQ

 

#EnemyBase

_pos = Getpos _target
_group MOVE _pos

_group SetSpeedMode "FULL"

 

#EnemyBaseLoop
~.01
?(!CanMove _tank1) AND (!Canmove _tank2) AND (!CanMove _tank3) : Goto "Finish"

?(Leader _group Distance _target < 200) : Goto "TargetDestroy"

?(_West) AND (!CanMove _tank1) : TanksWO = _tank2; PublicVariable "TanksWO"
?(_East) AND (!CanMove _tank1) : TanksEO = _tank2; PublicVariable "TanksEO"

?(_West) AND (!CanMove _tank1) AND (!CanMove _tank2) : TanksWO = _tank3; PublicVariable "TanksWO"
?(_East) AND (!CanMove _tank1) AND (!CanMove _tank2) : TanksEO = _tank3; PublicVariable "TanksEO"

 

Goto "EnemyBaseLoop"

#TargetDestroy
_group MOVE _pos

 

 

 

#TargetLoop
~.01

 

?(!CanMove _tank1) AND (!Canmove _tank2) ANd (!CanMove _tank3) : Goto "Finish"
?(Count Units _group < 2) : Goto "Finish"

?(_West) AND (!CanMove _tank1) : TanksWO = _tank2; PublicVariable "TanksWO"
?(_East) AND (!CanMove _tank1) : TanksEO = _tank2; PublicVariable "TanksEO"

 

?(_West) AND (!CanMove _tank1) AND (!CanMove _tank2) : TanksWO = _tank3; PublicVariable "TanksWO"

?(_East) AND (!CanMove _tank1) AND (!CanMove _tank2) : TanksEO = _tank3; PublicVariable "TanksEO"

 

Goto "TargetLoop"

#Finish

{_x SetDammage 1} foreach (Units _group)

~30

 

 

 

Goto "Init"

 

 

 

#End
Exit

Share this post


Link to post
Share on other sites

last error

 

Error in expression <(_initDone) >
Error position: <_initDone) >
Error Undefined variable in expression: _initdone

 

in above code

Share this post


Link to post
Share on other sites

If you have a look through the code with CTRL + F, you can see that _initDone is only ever set to TRUE, but it is queried in this line:

 

?(_initDone) : Goto "FindTarget"

 

I'm not sure where it's supposed to be defined (maybe somewhere in #Init perhaps)...

 

As a test, you could place _initDone = true immediately before that ?(_initDone):GOTO "FindTarget" line, it will most likely not function as intended but should get rid of the error so at least you can see what's happening without script errors.

 

It might be worth putting some hints/sidechat/diag_log in there, so you can have a display of how the script is running during your tests.

 

The more I look at this script, the more it hurts my head.  How did you find these?  They look like someone's had a play about and butchered them up.  It's a really harsh introduction to scripting for sure.

Share this post


Link to post
Share on other sites

If you have a look through the code with CTRL + F, you can see that _initDone is only ever set to TRUE, but it is queried in this line:

 

?(_initDone) : Goto "FindTarget"

 

I'm not sure where it's supposed to be defined (maybe somewhere in #Init perhaps)...

 

As a test, you could place _initDone = true immediately before that ?(_initDone):GOTO "FindTarget" line, it will most likely not function as intended but should get rid of the error so at least you can see what's happening without script errors.

 

It might be worth putting some hints/sidechat/diag_log in there, so you can have a display of how the script is running during your tests.

 

The more I look at this script, the more it hurts my head.  How did you find these?  They look like someone's had a play about and butchered them up.  It's a really harsh introduction to scripting for sure.

das, that isn't nice to say about the scripts  that invented cti/warfare .. the scripts are from 2002 and still working says a lot.. but I get what your saying do to sqf and basic scripting looks so much cleaner than sqs from that time.. but KaRRiLLioN had done things in sqs never done before .. (think about it) 2002 .. and the script work after for the most part fixing defines...

ill try your fix and use a hint and  copytoclipboard str

when its done id love you to play the mission and see why I wanted to fix it.. and soon will optimize and switch some things to fnc and sqf , maybe even fsm .. but I'm such a noob it will be a day by day fix .. and the scripts hurt my head too , (very confusing) but for what it was nothing touches it in game play and fun .. ang thanks very much for helping me ...

Share this post


Link to post
Share on other sites

Cool cool - I wasn't berating them, but this one looks like there's stuff missing or at the very least something's not right about it.  Anyway, would love to have a go when it's all fixed up  :)

 

btw, it wasn't a fix as such, more a workaround to get it running without erroring out 

Share this post


Link to post
Share on other sites

Cool cool - I wasn't berating them, but this one looks like there's stuff missing or at the very least something's not right about it.  Anyway, would love to have a go when it's all fixed up   :)

 

btw, it wasn't a fix as such, more a workaround to get it running without erroring out 

yeah , I think its missing something, maybe stuff I deleted off map edit , I'm getting errors then no errors .. good grief ...

Share this post


Link to post
Share on other sites

"EOps","TanksEO","AirEO","AirRaiderE1","AirRaiderE2"

"WOps","TanksWO","AirWO","AirRaiderW1","AirRaiderW2

 

found I'm missing the target markers , I went from sqs to sqf markers but didn't add these in ..

I'm again getting the _target < 200) error..

I may need to go back to sqs squadmarkers

Share this post


Link to post
Share on other sites

I set you a pm Das, its the mission thats up to date as of yesterday. If you have time that would be cool. Dont pay any mine to aicontrol errors its a mod thing i added but needs to be exe'd diffrent. Thanks never the less.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×