Jump to content
Sign in to follow this  
kyfohatl

Click on any AI unit on the map and take control of him!! Is it Possible???

Recommended Posts

In my mission, I want to allow the player, once he dies, to click on any AI unit on the map and take contorl of that unit (the units are generated by DAC). Does anyone know how to do this? is it possilbe?

When the player dies, the trigger DAC_Marker = 3 is enabled to display units on the map for the player to chose from, but how to make it so that once the player clicks on a unit, he takes control of that unit???

Please Help. Thanks :)

Share this post


Link to post
Share on other sites

The insurgency mission includes a "click on a player marker to display his name" feature which could probably be extended to include "click on a player marker to become the player".

Share this post


Link to post
Share on other sites

I just had a look, there are quite a few missions with "Insurgency" in their name. Could you possible give me a link to it please?

Anyway, yeah, I think what I need is some sort of a "take control" command, which I could then combine with the Insurgencie's "click on the unit on the map to do..." script to allow the player to take control of the AI.

The scenario is that after a reletively long singleplayer mission, the player gets to a town and kills the enemy commanding officer. This triggers a war between east and west created by DAC over a very large section of the map (includes tanks and helicopters and etc.). All units respawn in their camps and both sides have something like 800 respawns and the goal is to destroy the other side's camps to defeat that side (because they can't respawn anymore). Of course the player squad is the only group that does not respawn, and I thought this feuture would not only allow the player a limited number of respawns, but also allows him to either choose to be a squad leader or a squad member (by clicking on a DAC squad memeber rather than the squad leader). Anyway thanks for your help.

Share this post


Link to post
Share on other sites

Theres basic team switch in the game already, pretty simple if your making our own missions,

just make them playable.

Share this post


Link to post
Share on other sites

@UNN: Thanks alot, it seems your selectplayer command is just what I need. The only problem is that the unit that is being selected is DAC generated (dynamic AI Creator) and it is not named hence not allowing me to use select player unit Name command). Is there a way around this? I have to somehow activativate this command when the player clicks on the unit on his map. I can do a bit of scripting, but I'm a bit of a noob, so I'm going to learn a bit more scripting to see if I could make this happen. I think it would be a cool feuture.

---------- Post added at 12:00 AM ---------- Previous post was Yesterday at 11:58 PM ----------

Theres basic team switch in the game already, pretty simple if your making our own missions,

just make them playable.

Yeah, but as I said in my previous post, the units are generated by DAC at the start of each mission (which means that they do not have a name and cannot be set to "playable" before the mission starts in the editor).

Share this post


Link to post
Share on other sites

you'll need to register an event handler for your map click (onSingleMapClick), which passes a position as _this. From there you may find the closest unit in range with the nearestX commands (for example nearestObjects, searching for class "man"). That should get you started.

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  

×