Jump to content
Sign in to follow this  
dimdic

A piece of code that doesn't work!

Recommended Posts

I have written a piece of code, but it doesn't work. Here i am explaining what i want it to do: The player has 5 subordinate units. I want a hint to appear when the player selects a specific subordinate unit (soldier 3 with name "name_of_soldier3").

What's wrong with it ??

_myfun=
{
     private ["_cond"];
     _cond=_this select 0;
     waitUntil
     {
           hint "Waiting to select soldier 3 (press button F3)";
           call _cond
     };
     sleep 2;
     hint "You have selected soldier 3";
};

_cond= { (((groupSelectedUnits player) select 0)==name_of_soldier3) };

_z=[_cond] spawn _myfun;

Unfortunately, when i am the player and select soldiers 3 nothing happens :d:

Any ideas??

Thank you.

---------- Post added at 11:27 AM ---------- Previous post was at 10:44 AM ----------

FINALLY IT WORKS FINE !!!!! sorry about this post, erase it please !! :/

I have written a piece of code, but it doesn't work. Here i am explaining what i want it to do: The player has 5 subordinate units. I want a hint to appear when the player selects a specific subordinate unit (soldier 3 with name "name_of_soldier3").

What's wrong with it ??

_myfun=
{
     private ["_cond"];
     _cond=_this select 0;
     waitUntil
     {
           hint "Waiting to select soldier 3 (press button F3)";
           call _cond
     };
     sleep 2;
     hint "You have selected soldier 3";
};

_cond= { (((groupSelectedUnits player) select 0)==name_of_soldier3) };

_z=[_cond] spawn _myfun;

Unfortunately, when i am the player and select soldiers 3 nothing happens :d:

Any ideas??

Thank you.

Edited by dimdic
Problem Solved !!!

Share this post


Link to post
Share on other sites

I think it's common courtesy to at least inform how you solved it.

Share this post


Link to post
Share on other sites

You are right my friend, but it works fine AS IT IS :) !!!! That's why i didn't add any solution!! In my original code i had the fourth line ( fourth line: _cond=_this select 0; ) with comments. I was sooo dizzy that i could't see that i have comments in this line :/ !! It was stupid post!

I think it's common courtesy to at least inform how you solved it.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×