Jump to content
Sign in to follow this  
jeppelykke

Onmapsingleclick

Recommended Posts

Hey Hey smile_o.gif

I like to make a "chopper" taxi thingy where you jump in a chopper and click on the map where you want to go and the choppers goes there.

BUT....... (Gotta love But's)

Where do i write that code, and how do i prevent it from flying places if i click on the map for driffent reasons, or that i want more Click on the maps scripts.

Where do i write this: onMapSingleClick "blah blah" so the script knows am refuring to chopper1 and not chopper2 or chopper3, if i wanted to make 3 driffent transport choppers ?:I

Help / sugguestions more then welcome smile_o.gif

Best Regards,

Jeppe Lykke, Denmark

Share this post


Link to post
Share on other sites

Hey,

I'm thinking about it, I'll edit this post when I'm home from work (around 18-19 our time).

Share this post


Link to post
Share on other sites

1. Make an init.sqs with:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">onMapSingleClick {[_shift,_pos] exec "clicked.sqs"}

2. Add a getin eventhandler to the player, this will be able to detect which chopper the player has entered. And add an eventhandler to check if the player has got out of a vehicle.

Do this with:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player addEventHandler ["getin",{playerin = _this select 1}]; player addEventHandler ["getout",{playerin = 0}];

3. clicked.sqs should be something like:

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

? ! (_this select 0) : exit

? playerin == 0:exit

_pos = _this select 1

playerin domove _pos

4. A crude way of checking to see if the player has selected an area would be to check if the _pos variable is a certain distance from a gamelogic.

That is a very quick explanation that you should be able to work out what to do from.

RED

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  

×