Jump to content
Sign in to follow this  
Spokesperson

onMapSingleClick !

Recommended Posts

Why do people write _ infront of variables?

Whats the problem with this construction?

#Repeat

onMapSingleClick "_target=_pos;goto ""Code"";"

~2

goto "Repeat";

#Code

How do I create flying saucers? Like in the editor, with "flying" mode on from the start.

Share this post


Link to post
Share on other sites
Quote[/b] ]Why do people write _ infront of variables?

Variables with _ are local variables.

Share this post


Link to post
Share on other sites

Ok, I use separate files for the onmapsingleclick problem. So that's solved.

But why doesn't this work?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_t="AH6" createvehicle _pos;

"SoldierWPilot" createunit [_pos, myteam,"this moveindriver _t", 1.0, "COLONEL"];

_t SetPos [((_pos select 0)+5),(_pos select 1),(_pos select 2)];

_t setdir getdir player;

_t Lock FALSE;

The game freezes for 0.1 secs. Then a chopper is created, with the pilot outside. How can I make get in without ordering him to do it?

And I get some weird error when I do this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_i=0;

#Loop;

_i=_i+1;

"SoldierECrew" createunit [[((_pos select 0)+i),(_pos select 1), (_pos select 2)], myteam,"",1.0, "CAPTAIN"];

~0.1

?(_i<12): goto "Loop";

Supposed to create a group of tank crew.

Share this post


Link to post
Share on other sites

The init inside the soldier's createUnit doesn't work cause you have put a local variable in global space.

Make the chopper a global variable and it would work, but it's not nececairy.

Does the MyTeam variable exist?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_t="AH6" createvehicle _pos; // Create Vehicle

_d="SoldierWPilot" createunit [_pos, myteam,"", 1.0, "COLONEL"]; // Create pilot

_g="SoldierWPilot" createunit [_pos, myteam,"", 1.0, "COLONEL"]; // Create Gunner

_d moveInDriver _t; // Move driver in driverposition

_g moveinGunner _t; // Move gunner in driverposition

_t SetPos [((_pos select 0)+5),(_pos select 1),(_pos select 2)];

_t setdir getdir player;

_t Lock FALSE;

BTW If ur learning scripting ArmA for the first time, I would recommend starting in SQF and simply just skipping whole SQS.

Share this post


Link to post
Share on other sites

Try this:

Creating plane via Script

You can define the following things in the startarray:

- StartPos

- Airtyp

- Pilottyp

- Target

- Height

- Gunner (yes or no)

- Skill

- Behaviour

- Leader ( unit(enemy/friendly) on the map, a Logic, or Player)

- Count of vehicles

Mr-Murray´s Airvehicle Creator

Start the Script with your Mapclick.

Regards

Mr-Murray

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  

×