OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: CharlieReddog on 30 Jun 2009, 22:47:11

Title: Adding a bit of Immersion help
Post by: CharlieReddog on 30 Jun 2009, 22:47:11
I'm creating an escape and evasion mission for a friend and I. I'd like to add a bit more immersion to the scenario by the following:

1) Removing the map for the players.

2) Removing any radio options.

The second I'm fairly comfortable doing, but what I'd like is when the players are near a static radio (say in an enemy camp) they should be able to use it so adding radio options when within say 2m of the radio. I'd also like them to have the option of returning to the crash site, and retrieving a radio. here's the problem, I can't seem to find a radio object which they could take possession of?

The Map based problem, again, i'd like them to be able to gain the map should they kill an enemy officer (which would have marked positions on of enemy) or from a dead crewman near the crash should they return. Again, I don't seem to be able to find a suitable object.

Additionally, showMap False doesn't seem to work at all.
Title: Re: Adding a bit of Immersion help
Post by: kju on 30 Jun 2009, 23:10:51
A2 has now inventory objects for both.
Title: Re: Adding a bit of Immersion help
Post by: CharlieReddog on 30 Jun 2009, 23:18:09
How can I find them, they don't appear to be listed here ->http://www.armatechsquad.com/ArmA2Class/ (http://www.armatechsquad.com/ArmA2Class/)
Title: Re: Adding a bit of Immersion help
Post by: Spooner on 30 Jun 2009, 23:53:01
The standard special items are itemMap, itemRadio, itemCompass and itemWatch, which are the objects that go into the lower region of the gear display. They are considered to be weapons, so use removeWeapon to take them away.
Title: Re: Adding a bit of Immersion help
Post by: CharlieReddog on 01 Jul 2009, 07:32:34
Many thanks. :clap:

Once this mission's complete I'll look to release it here.
Title: Re: Adding a bit of Immersion help
Post by: Inkompetent on 01 Jul 2009, 11:09:01
Also remember the itemGPS. I'm not sure how common it is as standard gear, but can be good to take note of :)
Title: Re: Adding a bit of Immersion help
Post by: JamesF1 on 01 Jul 2009, 11:17:59
If you just want to get rid of them all (Compass, GPS, Map, Radio), just use removeAllItems (http://community.bistudio.com/wiki/removeAllItems) on the unit.
Title: Re: Adding a bit of Immersion help
Post by: CharlieReddog on 03 Jul 2009, 22:38:03
I'm now coming to use these nuggets of info, and I want to know how to get the following to work, or along these lines.

Code: [Select]
{removeallitems _x} foreach units allgroups;
I then want to addweapon itemmap to each East/opfor group leader on say a 30% chance per leader, and the same with the radio. That way there should be some random dudes running round with a map, or a radio, or maybe both.
Title: Re: Adding a bit of Immersion help
Post by: Spooner on 04 Jul 2009, 02:25:34
You can't take a list of units from allgroups, since it is an array of groups, not groups.
Code: [Select]
{
    {
        removeAllItems _x;
        if (((side _x) == east) and (_x = (leader _x))) then
        {
              if ((random 1) < 0.3) then { _x addWeapon "itemMap"; };
              if ((random 1) < 0.3) then { _x addWeapon "itemRadio"; };
        };
    } forEach (units _x);
} forEach allGroups;
Title: Re: Adding a bit of Immersion help
Post by: CharlieReddog on 05 Jul 2009, 17:46:10
Thanks for that spooner. Unfortunately it doesn't work. :no:

By removing the if statements regarding the replacing of the map and radio items I can get it to work, but no joy otherwise.
Title: Re: Adding a bit of Immersion help
Post by: Spooner on 05 Jul 2009, 18:51:26
Sorry, mistyped == as =:
Code: [Select]
{
    {
        removeAllItems _x;
        if (((side _x) == east) and (_x == (leader _x))) then
        {
              if ((random 1) < 0.3) then { _x addWeapon "itemMap"; };
              if ((random 1) < 0.3) then { _x addWeapon "itemRadio"; };
        };
    } forEach (units _x);
} forEach allGroups;
Have tested it now and it seems fine. Sorry, I need to get back into the habit of testing all code I post here properly, since it always leads to tears (and many OFPEC members can't debug my code effectively).
Title: Re: Adding a bit of Immersion help
Post by: Rommel92 on 07 Jul 2009, 06:03:41
Code: [Select]
{
removeAllItems _x;
if (((side _x) == east) and (_x == (leader _x))) then
{
if ((random 1) < 0.3) then { _x addWeapon "itemMap"; };
if ((random 1) < 0.3) then { _x addWeapon "itemRadio"; };
};
} forEach allUnits;

No?
Title: Re: Adding a bit of Immersion help
Post by: Spooner on 07 Jul 2009, 12:42:39
Oops, yes. I was under a false impression that there was an allGroups but not an allUnits (allUnits is strictly unnecessary, since you can find all units from it).
Title: Re: Adding a bit of Immersion help
Post by: CharlieReddog on 07 Jul 2009, 19:40:31
But would leader _x work, since it's a unit not a group being passed?
Title: Re: Adding a bit of Immersion help
Post by: Spooner on 07 Jul 2009, 19:53:01
In both cases, the inner part of the loop is referring to a unit (and exactly the same units will be iterated through, although not necessarily in the same order).
Code: [Select]
{ ..._x is a unit... } forEach allUnits;
Code: [Select]
{ ...outer _x is a group...; { ...inner _x is a unit... } forEach units _x; }forEach allGroups;
Title: Re: Adding a bit of Immersion help
Post by: Rommel92 on 10 Jul 2009, 07:11:52
Code: [Select]
{
_leader = leader _x;
{removeAllItems _x} foreach _x;
if ( (not isnull _leader) and (side _leader == east) ) then {
if ((random 1) < 0.3) then { _x addWeapon "itemMap"; };
if ((random 1) < 0.3) then { _x addWeapon "itemRadio"; };
};
} forEach allGroups;

Maybe saves processing time? Dunno. Wouldn't change it that much, but hey, efficiency is gooooooood right?
Title: Re: Adding a bit of Immersion help
Post by: Spooner on 10 Jul 2009, 23:54:56
Good point, but the problem is then that each non-leader will still have the default equipment.