OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: BHD Mod on 16 Jun 2004, 03:53:06

Title: Activating script on condition and hiding markers
Post by: BHD Mod on 16 Jun 2004, 03:53:06
Is there a way to activate a script only if another specified script is activated? "scriptname.sqs" true in condition field??? Also, does anyone know how to hide and unhide markers?
Thanks in advance
Title: Re:Activating A Script on a condition
Post by: Mr.BoDean on 16 Jun 2004, 06:59:48
In short, yes.  :) Me explaining it correctly ...  :-X  but I'll try.

By using a global variable you can pass it to another script.

I use the following for a mission to get a chopper to cycle on a route, drop troops, go to a holding area and wait to move and drop more troops.

In the Heli move script:

Code: [Select]
Hold = false
In the troop dropping script:
Heli drops troops .... then

Code: [Select]
#wait1
Hold = true
?("alive _x" count units paragroup0 == 0) || ("alive _x" count units paragroup1 == 0): goto "waitcount"
~3
goto "wait1"


#waitcount
Hold = false

This works great for me, so you might use the same idea.  ;)
Title: Re:Activating A Script on a condition
Post by: BHD Mod on 16 Jun 2004, 07:01:24
thanks i'll try that
Title: Re:Activating script on condition and hiding markers
Post by: ponq on 16 Jun 2004, 09:31:37
You can set an markter hidden like this:

-create a marker in the editor, name it marker1

-in the init.sqs set
Code: [Select]
"marker1" SetMarkerType "Empty"
-then in a script once you need the marker to be visible:
Code: [Select]
"marker1" setMarkterType "Destroy" or to a type that you need

gl
(search this site for some more info, there's a nice tute on this)
Title: Re:Activating script on condition and hiding markers
Post by: macguba on 16 Jun 2004, 11:36:55
You can also call a script from another script.

Alternatively, you can use variables in triggers to ensure that the second script can only be called if the first one already has been.

Title: Re:Activating script on condition and hiding markers
Post by: BHD Mod on 16 Jun 2004, 19:40:03
thanks all, but how can i use variables to make is so that a script can only be activated if another one can like what Macguba said? thanks again
Title: Re:Activating script on condition and hiding markers
Post by: Mr.BoDean on 16 Jun 2004, 21:59:17
Well, decide what you want to activate that second script.  The first script? Why not just run the second script from a line in the first script?

Example 1

Script1.sqs
papabear sidechat "Reinforcements are on the way!"
group1 move getpos maingroup

[] exec "Script2.sqs"

Example 2 is like my example above:

In INIT.sqs:
Script2 = false

In a trigger's On Activation line:
Script 2 = true

OR

In Script1.sqs:
papabear sidechat "Reinforcements are on the way!"
group1 move getpos maingroup

Script2 = true

Script2.sqs:
#Wait
?Script2 : goto "start"
~1
goto "wait"

#start
.....rest of script....

 
Title: Re:Activating script on condition and hiding markers
Post by: BHD Mod on 18 Jun 2004, 02:50:51
thanks all