Home   Help Search Login Register  

Author Topic: Advanced marker usage.  (Read 1922 times)

0 Members and 1 Guest are viewing this topic.

Offline D007

  • Members
  • *
Advanced marker usage.
« on: 24 Jul 2008, 07:40:01 »
What I'm trying to do is have a series of markers set to an individual or group, that changes when the status of that person or group changes.
for example when that person runs out of ammo his marker changes, like in quarantine on the M2's.
but not for M2's..

I am trying to use this script for 3 snipers on towers so it's lets me know when they run out of ammo and when they die.
My bro and I have been trying to get this working all day again..><
would really appreciate some help.
thanks all..

Code: [Select]
_m2=_this select 0
_m2marker=_this select 1
#checknotammo
if (not("10rnd_127x99_m107" in magazines _m2)) then{_m2Marker setMarkerColor "colorred";goto "checkammo"}
if (alive _m2)then {_m2Marker setMarkerColor "colorred";_m2marker setmarkertype "Marker";goto "checkgunner"}
~5

#checkgunner
if not(alive _m2)then {_m2Marker setMarkerColor "colorgreen";_m2marker setmarkertype "dot";goto "checknotammo"}
~5
goto "checkgunner"

#checkammo
if("10rnd_127x99_m107" in magazines _m2)then {_m2Marker setMarkerColor "colorgreen";goto "checknotammo"}
~5
goto "checkammo"

edit: If a more simple script can be made, please feel free to let me know.
Like maybe 3 triggers each with their own sqs file..
a trigger to turn the marker into a red dot if the AI unit named "sniper" is out of ammo
a trigger to turn the marker red and change the type to an X if he is dead.
and a trigger to turn the marker green and back to a dot if ammo is full and the sniper is alive.

I try not to ask for help if I don't have to, but the Deeper i get into this stuff. the more it seems I need to..lol..
I'd really appreciate some help with this.. Spent 2 days now day and night trying to make this work and I know there has to be an easier way XD..
guess I just figure if i can spend 2 days on each worth while command stressing over it, I won't ever forget that command again..lol.
but I'd really like to stop stressing now.. I'm like about to give up. :confused:

I guess a more basic version of what I'm trying to do is this..
Code: [Select]
if not("10rnd_127x99_M107") in magazines sniper)then {marker = createMarker ["sniperammo", position sniper]};
"sniperammo" setMarkerShape "ICON";
"sniperammo" setMarkerType "DOT";
"sniperammo" setMarkerColor "Colorred";
exit;
« Last Edit: 27 Jul 2008, 23:56:34 by D007 »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: desperately need advanced marker help.. please.
« Reply #1 on: 25 Jul 2008, 11:35:26 »
Code: [Select]
/* check_snipers.sqf

   Example:
   res = [[snip1, snip2, snip3]]execVM"check_snipers.sqf";
*/
private["_snipers", "_i"];
_snipers = _this select 0;
{
   _marker = createMarkerLocal [format[""mk_sniper_%1", _i], getPos _x];
   format["mk_sniper_%1", _i] setMarkerTypeLocal "Dot";
   format["mk_sniper_%1", _i] setMarkerColorLocal "ColorWhite";
   format["mk_sniper_%1", _i] setMarkerSizeLocal [0.25, 0.25];
   format["mk_sniper_%1", _i] setMarkerTextLocal (name _x);
   _i = _i + 1;
} forEach _snipers;

while {true} do
{
   _i = 0;
   {
      format["mk_sniper_%1", _i] setMarkerPosLocal (getPos vehicle _x);
      if (!alive _x) then
      {
         // Red if dead
         format["mk_sniper_%1", _i] setMarkerColorLocal "ColorRed";
      }
      else
      {
         if (!("10rnd_127x99_m107" in magazines _x)) then
         {
            // Blue if alive but no ammo
            format["mk_sniper_%1", _i] setMarkerColorLocal "ColorBlue";
         }
         else
         {
            // Green if alive and ammo
            format["mk_sniper_%1", _i] setMarkerColorLocal "ColorGreen";
         };
      };
      _i = _i + 1;
   } forEach _snipers;
   Sleep 1;
};

Offline D007

  • Members
  • *
Re: desperately need advanced marker help.. please.
« Reply #2 on: 26 Jul 2008, 11:11:07 »
Ahh man.. you rock..
Very much appreciated, this had been giving us a bit of a headache.
Not such a big one for u I'm sure :P.
but thanks a bunch. It will be in a revised version of quarantine once I talk to the original maker about it.
I think you guys will enjoy it a lot.. So much has been fixed and added..
also been moved to south sahrani aka "sahrani lite" to cut lag.
all kinds of good stuff.
Thanks again Mandoable.. cheers m8

edit: I celebrated to fast lol.. I've been trying to figure out what goes where in the script for about 6 hours now..lol.. Time to go to sleep XD.
I just coulnd't figure out like where the names of the markers went for the variables, or the snipers names for the variables, or what to name the markers and snipers lol.

do I need to have my own markers in the game 1st with names on them?
do the snipers positions allow for the creation of icons in mid game?
I didn't even know that was possible..lol

I was confused about which was which and when i tried to implement it I just got tons of errors.
when i did get it to the point i had no errors nothing would happen lol..

I'm pretty decent at working out scripts in general and persistent as hell.
But I am stumped ><..

like whats the mk_sniper_%1  %1?  is that a variable for anything as long as it's named something like Mk_sniper_?
is that what things need to be named like for them to be read correctly and the script to work?

I'm just an ok script editor and mission maker/sound editor/cutscene editor/creator.
This stuff is just a bit out of my league. I mean I understand a lot of what i'm looking at, but the subtle things get me mostly.
The ;'s and the"",'s.. etc etc.

Idk.. could someone explain to me what goes where a bit more please?
I'd really appreciate it.. thank you :)
« Last Edit: 29 Jul 2008, 21:27:17 by bedges »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Advanced marker usage. ty Mando
« Reply #3 on: 26 Jul 2008, 15:51:25 »
Code: [Select]
format["mk_sniper_%1", _i] returns a string compose by mk_sniper_(value of _i)
for example, for _i = 0, that would return "mk_sniper_0", this way you may create the names of the markers dinamically and you dont need to pre-create any markers in the editor, the script creates the markers too.

Offline D007

  • Members
  • *
Re: Advanced marker usage. ty Mando
« Reply #4 on: 26 Jul 2008, 22:11:15 »
wow... thats great.
I'll give it another shot when I get home tonight from work.


I'm assuming the lines for [snip,snip1,snip2] execvm "sniper_check.sqf" are supposed to go into the init line of each sniper.
that or I make a trigger and set it to once, none present and 0 in size, and have it execute the script as "exec sniper_check.sqf" at the beginning of the mission.
snip,snip1,snip2 now im pretty sure are the names of the snipers. so im going to name my snipers those names.
Man.. I've learned so much stuff in the past couple months..lol..

Thanks again Man ^^.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Advanced marker usage. ty Mando
« Reply #5 on: 26 Jul 2008, 22:31:12 »
Not intended to be ran from the init of each sniper, but from the init.sqf script so that you pass all the snipers into a single array. Each marker is created with a name that depends on the position of the sniper inside the array (0,1,2,3,4 ...) so, if you run the script for each sniper individualy with a single sniper inside the array, then all the markers will have the same name "_0" and all the scripts will interferre with each other.

Offline D007

  • Members
  • *
Re: Advanced marker usage. ty Mando
« Reply #6 on: 27 Jul 2008, 04:09:47 »
Lol that would explain the massive errors XD...

I'm tryin..lol.. one day I promise I'll be competent lol..
Arma is just to good for me to ignore the possibilities..

If ever I can be of assistance please do let me know..
I'm pretty good with sound files.
basic scripting and mission making I don't have issues with..
but this stuff.. eesh  :dunno:
thank god people like you are around to help people like me..lol..

thanks again Mando.


EDIT:

ok this is what im trying to do..

I'm putting the line.    res = [[sniper1, sniper2, sniper3]]execVM"check_snipers.sqf";   in the init file..

I have 3 snipers named sniper1 sniper2 and sniper3

I can't make this work and it is driving me nutz...
I even tried making an entirely new mission with nothing in it but the 3 snipers and the init with the exec in it.
the script still errors out massively and even crashes my pc, which is no light feat..lol..

My bro and I have spent literally 4 days now trying to make this marker thing work and I can't do it..
My brain is so fried at this point I'm just done..lol..
I can't make this work.. I'm not a good enough scripter and I don't understand the variables enough or where they go.
could someone please just fill in the blanks for me so i have a working script i can simply copy and paste from here pertaining to my 3 snipers names? please?
It's not that I'm lazy or unwilling to work for a mission..
I just can't figure it out..
I spent another 5 and a half hours working on this again, trying desperately to make it work and I just can't..
please tell me what im doing wrong.. and show me if you will.
I'd really appreciate it..
thank you.


Code: [Select]
/* check_snipers.sqf

   Example:
   res = [[sniper1, sniper2, sniper3]]execVM"check_snipers.sqf";
*/
private["_snipers,sniper1,sniper2,sniper3,_i"];
_snipers = _this select 0;
{
   _marker = createMarkerLocal [format["1,2,3"mk_sniper_%1", _i], getPos _x];
   format["mk_sniper_%1", _i] setMarkerTypeLocal "Dot";
   format["mk_sniper_%1", _i] setMarkerColorLocal "ColorWhite";
   format["mk_sniper_%1", _i] setMarkerSizeLocal [0.25, 0.25];
   format["mk_sniper_%1", _i] setMarkerTextLocal (name _x);
   _i = _i + 1;
} forEach _snipers;

while {true} do
{
   _i = 1,2,3;
   {
      format["mk_sniper_%1", _i] setMarkerPosLocal (getPos vehicle _x);
      if (!alive _x) then
      {
         // Red if dead
         format["mk_sniper_%1", _i] setMarkerColorLocal "ColorRed";
      }
      else
      {
         if (!("10rnd_127x99_m107" in magazines _x)) then
         {
            // Blue if alive but no ammo
            format["mk_sniper_%1", _i] setMarkerColorLocal "ColorBlue";
         }
         else
         {
            // Green if alive and ammo
            format["mk_sniper_%1", _i] setMarkerColorLocal "ColorGreen";
         };
      };
      _i = _i + 1;
   } forEach _snipers;

};

Code inside code tags please.   Planck
Also no need for emboldened paragraphs - we can see you just fine.   Bedges
« Last Edit: 27 Jul 2008, 12:38:50 by bedges »

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Advanced marker usage. ty Mando
« Reply #7 on: 27 Jul 2008, 12:13:20 »
Two lines look suspect to me:

   _marker = createMarkerLocal [format["1,2,3"mk_sniper_%1", _i], getPos _x];

and

   _i = 1,2,3;


Should probably be:

   _marker = createMarkerLocal [format["mk_sniper_%1", _i], getPos _x];

and

  _i = 0;


Planck
I know a little about a lot, and a lot about a little.

Offline D007

  • Members
  • *
Re: Advanced marker usage. ty Mando
« Reply #8 on: 27 Jul 2008, 21:38:41 »
yea, thats what the original script looked like.. but that didn't work for me.
I just do not know where to put the names of my snipers in the code.
I tried to use my limited knowledge of scripting to form an educated guess.. problem is..
I'm not all that arma educated..lol..

Maybe I shouldn't of posted what I did to the script at all and just asked this simple question..
 
can someone please copy the original code posted by Mando and enter the names of sniper1, sniper2 and sniper3, where they are supposed to go please?
If I can get an understanding of how the script works once, I should be able to grasp whats going on for future reference.

I hate asking for help like this. Believe me.
most of you guys have your own things going on and I'm sure you don't feel like giving tutorials..
But man I promise you.. I tried my best to make this work with due diligence and days of staring at the same script over and over.
changing everything from top to bottom in a systematic effort to find what I am doing wrong.  :blink:

I bet it's something so ridiculously simple too..

Like maybe I'm not suposed to edit the script at all and just put the names of the snipers in the
line for the init exec.
res = [[snip1, snip2, snip3]]execVM"check_snipers.sqf"; 
and nowhere else..

hmmm.. I think I'll try that now that I mentioned it..lol..

sorry about the bold text thingy btw.. thing is. I can't see it XD..lol..
50" tv and my fonts are so ridiculously small I can barely read them..
playing eve online is a migraine lol.

I didn't want to post another reply to my own subject "as there is generally a rule about double posting"  and I didn't want people to not notice the edit to the original post.
Is there some kind of rule about not bolding text? lol..
I mean there is an option in here for bolding text...
why is it there if it's not allowed to be used? lol..
If ever bolding text was to be used I would think that would be the time to use it.
is there some forum rule about it? and if so please point me to it..

not trying to be a pain in the butt lol.. but when can I use bold text then?  :P
« Last Edit: 27 Jul 2008, 21:43:49 by D007 »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Advanced marker usage. ty Mando
« Reply #9 on: 27 Jul 2008, 23:18:32 »
Sorry, cannot help anymore at the moment, ArmA PC Vcard said bye, bye  :weeping:

Offline D007

  • Members
  • *
Re: Advanced marker usage.
« Reply #10 on: 27 Jul 2008, 23:43:24 »
can type.. but can't respond? lol..
4 days of stress.. I don't think this works..
I give up..

but ouch sorry to hear that ><..
newegg has some great deals out there.
and  tigerdirtect. gl ^^..
« Last Edit: 27 Jul 2008, 23:57:46 by D007 »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Advanced marker usage.
« Reply #11 on: 28 Jul 2008, 00:36:59 »
Can type from my laptop, but cannot test it with ArmA as ArmA desktop is not working anymore.

Offline D007

  • Members
  • *
Re: Advanced marker usage.
« Reply #12 on: 29 Jul 2008, 02:15:33 »
ooh, I was figuring you just knew..lol..
all the addons you make.
I just kind of assumed this stuff was second nature to you. :P.
all good.

If anyone does know, please do let me know..
I'm kind of waiting on this before I release the mission.
we got very carried away with addons last night lol..
we added virtually everything cool we could find to the purchase list, except the nimitz..lol.
couldn't add the minitz because it doesn't move yet.
was going to have it patrolling the outer perimiter.
looks cool though. :)