Jump to content
Sign in to follow this  
pang

Onmapsingleclick move a unit

Recommended Posts

hi folks smile_o.gif

i don´t really get into that onmapsingleclick thingy...

what i basically want to do is:

add a unit a local action that sets a specific object to the "onmapclicked" position.

how would such a script would have to look like?

sry, i know it´s a real basic question, but the search could help me

Share this post


Link to post
Share on other sites

So are you saying that you want to add an entry to a players action menu, that when selected moves some object to the place on the map that they clicked?

Share this post


Link to post
Share on other sites

Pang, try this:

To add the teleport action to a player unit

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">actionid = player addAction ["Teleport", "teleport.sqs"]

To later remove it

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

The script teleport.sqs

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

hint "Click on map to teleport"

onMapSingleClick { teleportee setPos _pos; onMapSingleClick {}}

To move something else than yourself, you can use something like this:

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

hint "Click on map to teleport"

onMapSingleClick { someobject setPos _pos; onMapSingleClick {}}

That would move the object called "someobject" to the map location you click.

Share this post


Link to post
Share on other sites

thanks alot killswitch!

i used a set of two scripts, but your suggestion tied it up to one.

if anyone´s curious:

i needed this script to modifiy vektorboson´s satellite script. you can now set the satellite´s cameratarget via the mapclick.

the useraction entry should make sure it runs only local on the observer´s machine im mp.

works great in contribution with the coc arty smile_o.gif

Share this post


Link to post
Share on other sites

I´d like to do the same but:

To a MP mission where the action should only be able to the team leader (wich are with his group on board of a chopper) to execute a Fast rope insertion on the desired location (using snipyr Suport pack files)

I have pretty good ideas to story lines and missions but I´m a complete moron on editing scripts.

Thnx in advance

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  

×