OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Rytuklis on 12 Sep 2011, 19:39:41

Title: Question about Condition of presence
Post by: Rytuklis on 12 Sep 2011, 19:39:41
Alright so i have one question. I have put East Guards around the Montignac, and i make a couple of cutscenes, then in cutscene script i type in "sovSold1 (soviet soldier) setDamage"

After that, i put some resistance and in their conditon of presence i put NOT ALIVE sovSold1

They do not appear after SovSold1 takes damage . Can you help me?
Title: Re: Question about Condition of presence
Post by: Gruntage on 12 Sep 2011, 20:40:41
I think the best way to have some resistance soldiers appear as a result of sovSold1 dying is to use the getdammage command in conjunction with the createunit command. For example:

Create a script which loops from the beginning:

Code: [Select]

#LOOP

? (getdammage sovSold1) > 0.9: goto "SUB"

goto "LOOP"

#SUB

"soldierGB" createUnit [getMarkerPos "spawnmarker", guergrp1,"", 1, "corporal"]
"soldierGB" createUnit [getMarkerPos "spawnmarker", guergrp1,"", 1, "corporal"]
"soldierGB" createUnit [getMarkerPos "spawnmarker", guergrp1,"", 1, "corporal"]
"soldierGB" createUnit [getMarkerPos "spawnmarker", guergrp1,"", 1, "corporal"]

exit


You could replace sovSold1 in this script with _soldier, so that the script can be used with more than one soldier.

The 'spawnmarker' can be placed wherever you want the guerillas to appear, and 'guergrp1' is the pre-defined group name.

The script can be run from the init.sqs

Hope this helps

Gruntage
Title: Re: Question about Condition of presence
Post by: Walter_E_Kurtz on 13 Sep 2011, 00:16:40
An exploratory search for "Condition of Presence" would give you some hints:

Quote from: http://www.ofpec.com/forum/index.php?topic=23182.msg155907#msg155907
The condition of presence is a boolean.  What I have found about that field is:

- the OFP engine resolves that value before running init.sqs so putting a variable in there does not help control which units are created.
- the not condition needs to be used with care (eg not (alive unit1) will always resolve as false and the unit will never appear)
         in other words

Quote from: http://www.ofpec.com/forum/index.php?topic=17919.msg117992#msg117992
condition of presence has to be something that is true or false at mission load. It can NOT be something that happens later in the mission

Use a variable rather than setDammage-ing a unit, eg. NowSpawn = true.

Then you can EITHER spawn them as described by Gruntage (though the loop ought to have a delay in it) OR have them present from the start of the mission and setPos them into position.