OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GW on 13 Jun 2010, 06:45:07

Title: Just small questions?
Post by: GW on 13 Jun 2010, 06:45:07
I make a mission,in which i want that a soldier enter into trigger,than it add as a new objective.before his entering into trigger objective  remains hide.
Title: Re: Just small questions?
Post by: Krieg on 13 Jun 2010, 07:01:50
Create a file called init.sqs and this in it:
Code: [Select]
"2" objStatus "HIDDEN"
Then go to your trigger, set up the "activated by" stuff and write following in "On Activation" field:
Code: [Select]
"2" objStatus "ACTIVE"; hint "You have a new objective"
That will make the status of the second objective (you can change 2 to 3 and make third objective hidden) to hidden at the start and when player enters the trigger it will make it visible and it'll hint that player has new objective.

Hope that helps,
Krieg
Title: Re: Just small questions?
Post by: bedges on 13 Jun 2010, 13:44:38
There's also a tutorial in the Editors Depot (http://www.ofpec.com/ed_depot/index.php?action=details&id=325).

Always worth searching first.  :good:
Title: Re: Just small questions?
Post by: GW on 07 Aug 2010, 06:01:15
i am busy in making my campaign,how can i stop AI units to go back again there first waypoint?
Title: Re: Just small questions?
Post by: RKurtzDmitriyev on 07 Aug 2010, 16:03:37
i am busy in making my campaign,how can i stop AI units to go back again there first waypoint?

Use a CYCLE waypoint. Place it close to the first waypoint. (The AIs will go back to whatever waypoint the CYCLE is closest to).

If you aren't sure when they will need to go back to the first waypoint, make a trigger and set its type to "Switch." Synchronize (F5) it to the waypoint BEFORE your cycle waypoint. Place the cycle waypoint close to the group's first waypoint, as before. Whenever the switch trigger is activated, the group will go back to the first waypoint.
Title: Re: Just small questions?
Post by: GW on 07 Aug 2010, 16:15:54
i mean they will leave from kolugjev one part to another end for a battle,but when there most squad died the rest will back to there first point/starting point,from where they start,
how can i make them that they will fight till the death in there last waypoint .
Title: Re: Just small questions?
Post by: Walter_E_Kurtz on 07 Aug 2010, 16:25:29
Use the allowFleeing (http://www.ofpec.com/COMREF/index.php?action=details&id=18&game=All) command to stop them from running away.

In the Init line of the group leader, write
"_x allowFleeing 0" forEach units this
Title: Re: Just small questions?
Post by: THobson on 09 Aug 2010, 08:41:19
Either:
1. Make their last waypoint a GUARD
or
2. Make the last two waypoints:  SEEK AND DESTROY followed by a CYCLE with these two waypoints next to each other.
Title: Re: Just small questions?
Post by: GW on 12 Aug 2010, 11:31:08
i making a mission,in which whenever guards of base see any resistance soldier than trigeered the alarm and everyone inside the base get in stealth approach,
Title: Re: Just small questions?
Post by: Walter_E_Kurtz on 12 Aug 2010, 14:18:24
Assuming that it is West guarding the base; simply change it to East if necessary.

1. Make a trigger covering just the base and its guards:
   West, Present, Once
      and give the trigger a name, in this example: base


2. Make a second trigger, centred on the base and large enough to cover the area where the Resistance might be spotted, this might be 1500 metres in diameter:
   Resistance, Detected by West, Once

write in the On Activation line:
   "_x setBehaviour {STEALTH}" forEach list base

then click on the 'Effects' box in the bottom lefthand corner. You're interested in sounding the alarm, so choose
   Sound - Anonymous - Play Alarm (scroll near to the bottom of the list)
Title: Re: Just small questions?
Post by: GW on 13 Aug 2010, 05:02:47
@Walter_E_Kurtz
THANKS for your answers,

how can i make friendly units to go , where i click on map and than know there status about remaining dead and alive
Title: Re: Just small questions?
Post by: RKurtzDmitriyev on 13 Aug 2010, 14:45:48
how can i make friendly units to go , where i click on map and than know there status about remaining dead and alive

LOL GW. Really, there's all kinds of ways you could do this, and it's been done many ways. There's even a whole demo mission (http://www.ofpec.com/ed_depot/index.php?action=details&id=290&game=OFP) from SelectThis available from the editor's depot. I don't really like how SelectThis wrote his script, but that's just me.

To make a unit go where you click on the map:

Code: [Select]
onMapSingleClick {unitname move _pos}

where unitName is the name of the unit to be moved. OnMapSingleClick (http://www.ofpec.com/ed_depot/index.php?action=details&id=48&game=ArmA) has a whole tutorial devoted to it, you should read it.

To make units report how many units in the group are alive,

Code: [Select]
unitName sideChat format ["%1 are alive", {alive _x} count units groupName]

Where unitName is the name of the unit you want to communicate, and groupName is the name of the group you want to know about.
Title: Re: Just small questions?
Post by: haroon1992 on 13 Aug 2010, 17:40:57
Quote Spinor
Quote
onMapSingleClick {[_pos, _units, _shift, _alt] exec "OnMapClick.sqs"}

i.e. whenever the player clicks on the map, a script "OnMapClick.sqs" is called with all the available parameters as arguments. This also answers your question about reading the status of the SHIFT and ALT keys. Their status is contained in the reserved boolean variables _shift and _alt (if true, key is pressed). _units is an array of the currently selected units.

Within "OnMapClick.sqs" you can do whatever you want with the info given

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
OnMapClick.sqs

_pos = _this select 0
_units = _this select 1
_shift = _this select 2
_alt = _this select 3

;block execution when player did select units
?Count _units != 0: Exit

;block execution when player is commander of a vehicle
_vehicle = Vehicle Player
?(_vehicle != Player) AND (Commander _vehicle == Player): Exit

.....

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

e.g. you can block execution of the script under some curcumstances or include a pause between click and movement.

Spinor

Thread Link : http://www.ofpec.com/forum/index.php?topic=2666.15 (http://www.ofpec.com/forum/index.php?topic=2666.15)


Regards,
Haroon1992
Title: Re: Just small questions?
Post by: GW on 14 Sep 2010, 10:22:28
how can i make units to visits some villages from moton to sain piere again and again,by getting out from there URAL.
Title: Re: Just small questions?
Post by: RKurtzDmitriyev on 14 Sep 2010, 14:26:24
Here's a demo mission that will show you how to do that. You'll have to modify the units and waypoint locations to fit with your mission, but the basic idea should be the same.
Title: Re: Just small questions?
Post by: GW on 20 Sep 2010, 05:21:22
I try this advice,but find one bug,if driver get killed of ural in way.than units will stay inside the truck and never come out.
Title: Re: Just small questions?
Post by: RKurtzDmitriyev on 20 Sep 2010, 14:25:15
Ah, yes. You might be able to solve that with scripting, but it depends on what you want the remaining men in the truck to do. Do you want them to disembark? Do you want them to continue the patrol somehow?
Title: Re: Just small questions?
Post by: GW on 21 Sep 2010, 14:28:29
i want that driver of cargo unit,not a single unit. :yes:
Title: Re: Just small questions?
Post by: RKurtzDmitriyev on 21 Sep 2010, 14:30:09
I can't understand what you just wrote. Are there words missing?
Title: Re: Just small questions?
Post by: GW on 30 Oct 2010, 10:43:00
is there a way to add soldiers  one by one  to side by radio anytime.
i mean when we call radio,soldier will get present there immediately wherever i was.
Title: Re: Just small questions?
Post by: RKurtzDmitriyev on 31 Oct 2010, 15:24:08
I can't quite understand. But to start with, make a radio trigger that will execute the following script:

Code: [Select]
soldier1 move getpos player
exit

soldier1 will be the name of the person you want to move.
Title: Re: Just small questions?
Post by: bedges on 31 Oct 2010, 15:55:36
Do a search for the createUnit (http://www.ofpec.com/COMREF/index.php?action=details&id=85&game=OFP) command, and maybe the keyword "spawn".
Title: Re: Just small questions?
Post by: GW on 31 Oct 2010, 20:32:16
i making a sp mission,
i played a mission some year ago.
where i can add 3 soldier to my side anytime anywhere near to my position.
its like a magic.
Title: Re: Just small questions?
Post by: Walter_E_Kurtz on 02 Nov 2010, 23:39:01
It depends how many times this is to be done. If it is to be many times then, as bedges says, you will have to "spawn" them.

To do it just once needs less scripting:
 1. Place a trigger: Radio Alpha, Repeatedly and On Activation: [] exec "help_me.sqs"

 2. Place the three extra soldiers somewhere far away in a separate group. Give them names: soldier1, soldier2 and soldier3.

 3. Create the script as a text file: help_me.sqs
Code: (help_me.sqs) [Select]
? (count units player) > 9 : exit

1 setRadioMsg "NULL"
[soldier1, soldier2, soldier3] join (GrpNull)
[soldier1, soldier2, soldier3] join player

soldier1 setPos getPos player
soldier2 setPos getPos player
soldier3 setPos getPos player

The script first checks if there are nine or fewer units in the players group, since 3 are to be added and the maximum in any group is 12.
It then hides the radio option, assuming that you used Radio Alpha. If you used something else, you will have to change the number in the setRadioMsg (http://www.ofpec.com/COMREF/index.php?action=details&id=314&game=All) line.
Finally the troops are teleported magically to the players location.
Title: Re: Just small questions?
Post by: GW on 20 Dec 2010, 03:23:44
Is there a easy way to assign night googles to whole group(12) of soilders.
Title: Re: Just small questions?
Post by: savedbygrace on 20 Dec 2010, 06:57:03
{_x addweapon "NVgoggles"} foreach units groupname



Title: Re: Just small questions?
Post by: GW on 17 Apr 2011, 09:37:42
i played a mission some year ago in which soldiers who died get extinguished,can anyone tell me script of this.
Title: Re: Just small questions?
Post by: Walter_E_Kurtz on 19 Apr 2011, 01:55:31
If you mean having dead bodies disappear, here's (http://www.ofpec.com/forum/index.php?topic=33131.msg228411#msg228411) one way.
Title: Re: Just small questions?
Post by: GW on 20 Apr 2011, 14:33:04
@Walter_E_Kurtz

its showing distance error of 300.
Title: Re: Just small questions?
Post by: Walter_E_Kurtz on 20 Apr 2011, 23:37:10
Make sure the notes are removed by deleting the "<---" and everything that comes after.
Title: Re: Just small questions?
Post by: GW on 21 Apr 2011, 21:44:06
@walter

i try this

make a sqs file of name  deaddude.sqs


than copy all this inside the fall

Quote
_corpse = _this select 0

~120    <--- time in seconds that corpses are set to remain

@player distance _corpse > 300   <--- distance in metres player has to be away for body to be removed

deleteVehicle _corpse

exit

as you said ,i put this script under officer

for a group:
morituri = group this; {_x addEventHandler ["killed", {_this exec "deaddude.sqs"}]} forEach units morituri



but its showing error still


i do remove all things you said

than its look like

Quote
Code:

_corpse = _this select 0

~120   

@player distance _corpse > 300   

deleteVehicle _corpse

exit
but its not working :no: