Home   Help Search Login Register  

Author Topic: Vartan Learning Corner  (Read 1257 times)

0 Members and 2 Guests are viewing this topic.

Offline Vartan

  • Members
  • *
  • I'm a llama!
Vartan Learning Corner
« on: 06 Apr 2009, 16:09:22 »
I know it might not be the right name for the topic, but i'm going to post some of questions and figured to give it all one name instead of creating a new thread every time.

Please take into account that my scripting knowledge is very minimal and i am just starting to learn.

What i wish to to do is create a script that will check the players equipment, if he has a radio then add a marker that can only be seen by other players that have a radio.

I can guess that things like this have been done before and more then once  :) but i'm hoping to make this a learning exp. for me.

i decided to start simple.
playerlist is a trigger
Code: [Select]
radio_units = [];

{
_x_weapons_arry = weapons _x;
if ("ACE_ANPRC77_Alice" in _x_weapons_arry) then {radio_units  =  radio_units + _x};
} foreach playerlist



i get an error saying that "Error then: type string, expected array,code"

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Vartan Learning Corner
« Reply #1 on: 06 Apr 2009, 16:23:24 »
Code: [Select]
radio_units  =  radio_units + [_x]

Offline Vartan

  • Members
  • *
  • I'm a llama!
Re: Vartan Learning Corner
« Reply #2 on: 06 Apr 2009, 16:32:23 »
ok that was simple enough, thank you.

Now that i got the the list of all the units with radios, i need to add markers that are only visible to them, i am guessing that i would use the createMarkerLocal for that, the question is where would i execute this, or is there a way to only execute this when the player opens a map?
« Last Edit: 06 Apr 2009, 17:01:07 by Vartan »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Vartan Learning Corner
« Reply #3 on: 06 Apr 2009, 20:41:38 »
I'd use,
Code: [Select]
_radio_units = [];

{
if (_x hasWeapon "ACE_ANPRC77_Alice") then { radio_units set [count radio_units, _x] };
} foreach playerlist;
But really, you need to

As far as I'm aware, there is no way to tell for certain if the map display is open (even using addons it would be imperfect detection). The problem is that it always exists while you are playing, just not always shown to the player. Player-created dialogs and overlays are created and destroyed when shown and hidden, so it is much easier to track them.

However, regardless of whether the map is shown or hidden, if you track unit positions about once every 0.5s (or more) there will not be a measurable slowdown caused by this. You will need to use all local marker commands to ensure that the local player is the only one that sees the markers.

You might like to look at my SPON_sensor script which shows and hides marker blips based on range from a detector radar. You need to do something similar so that other people's markers show and hide based on whether they have a radio instead (and they all show and hide based on whether the player has a radio).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline savedbygrace

  • Intel Depot
  • Administrator
  • *****
  • Be swift to hear...slow to speak...slow to wrath.
Re: Vartan Learning Corner
« Reply #4 on: 08 Apr 2009, 02:58:33 »
Please don't post questions together but rather insert keywords that summarize your question in the title so that it will benefit other members who may have the same question while they themselves are conducting their own search. And as always, Please do a search for your topic before posting another thread on the subject. Thank you for your cooperation in this matter.