OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Messiah on 09 Jan 2003, 00:26:47

Title: whats wrong with this script?
Post by: Messiah on 09 Jan 2003, 00:26:47
ok, the following script is executed using this line:

[group1, marker1] exec "marker.sqs"

and there is a marker called marker1 and a west squad, with the leaders init field reading:

group1 = group this

and heres the script:

Code: [Select]
_group = _this select 0
_marker = _this select 1

#loop1

"_marker" setMarkerColor "Green"

"_marker" setmarkerpos (getpos (leader _group))

? west countside units _group < 7 : goto "loop2"

~0.5

goto "loop1"


#loop2

"_marker" setMarkerColor "Yellow"

"_marker" setmarkerpos (getpos (leader _group))

? west countside units _group < 1 : goto "loop3"

~0.5

goto "loop2"


#loop3

"_marker" setMarkerColor "Red"

exit

ok, so what should happen is that the placed marker follows the leader of the group - it will then change colour depending on the state of the squad (how many men are left alive)

the problem is, that it doesnt even move to the leader to start with - it just stays in posistion.
Title: Re:whats wrong with this script?
Post by: LCD on 09 Jan 2003, 00:29:50
da marker should b string :P

u have 2 flip everything like dat

[group1, "marker1"] exec "marker.sqs"

and everywere else use

_marker

should work  ;)

LCD OUT
Title: Re:whats wrong with this script?
Post by: Messiah on 09 Jan 2003, 00:41:46
aaah, works fine...

one more question - i have like 6 squads which i want to use this script with -and of course it only works with one at a time - now, can i make this script into a sqf file and have several groups use the same one?
Title: Re:whats wrong with this script?
Post by: Tomb on 09 Jan 2003, 00:43:53
well, at least I know that several units CAN use the same scroll, mezzy, so why not yers?!  :)
Title: Re:whats wrong with this script?
Post by: Messiah on 09 Jan 2003, 00:51:05
i dunno - what happends is that the second placed marker just sits there, tomby... the scroll doesnt handle 2 markers...

maybe its because im using the same init line to execute them?

i dunno, ya think u cud work summy out?

:thumbsup:
Title: Re:whats wrong with this script?
Post by: LCD on 09 Jan 2003, 01:13:12
as much as i c - da script should work right :P

just

[group this,"markername"] exec "scriptname.sqs"

in da init of 1 of da soldiers shold do da trick

LCD OUT
Title: Re:whats wrong with this script?
Post by: mcnorth on 11 Jan 2003, 23:56:27
Looks to me like you should be able to use the same script more than once at the same time. My guess is that it boils down to local variables and yours look to be all local. Initiating it the second time would have to be be with something like [group2, marker2] exec "whatever.sqs"