Jump to content
Sign in to follow this  
Kerry

Script for POW's to follow you?

Recommended Posts

Hi,

I am just wondering there is a way to make an AI captive follow you.

Its for my mission I am making atm. The US need to head into and insurgent filled town and rescue one of their own.

I just need it so that when you press "Enter" or an action button on the AI, then he will follow you.

Please let me know, thanks for your time!

-Kerry

Share this post


Link to post
Share on other sites

thePOWUnit doFollow theHRTUnit;

or

thePOWUnit joinSilent( group theHRTUnit );

Share this post


Link to post
Share on other sites

alright.

Thanks a ton.

And that will make to so that a player needs to press enter on the unit?

And also, is tehre a way to set it to only a certain team???

Share this post


Link to post
Share on other sites

you dont need script for that..

at least im not using and soldier follows your, joining the team.

but if you want to use scripts i cant help you.

Share this post


Link to post
Share on other sites

oh>

bravo, please explain.

Exactly what I put into the Init field so that when a person approachs the POW, there is an option to make him follow you.

And if theres not a oslution to the one above, is there a way to make it so that the person only joins a certain team... Blufor persay .

Share this post


Link to post
Share on other sites

Does it really have to be the "Enter"-Key you want to be pressed or can it just be a normal Action you select? First one needs a bit of scripting while the second one can easily be done:

Create a trigger (flagged for repeat). In the condition-line you write

( { ( _x distance thePOWUnit )<5 }count( units group player ) )>0

in the onActivation-line it goes:

rescueAction = thePOWUnit addAction[ "Rescue POW","rescue.sqf" ];

in the on deactivation-line:

if( rescueAction != -1 )then{thePOWUnit removeAction rescueAction; }

then, in your missions-folder you create a file called "rescue.sqf" in which you write:

thePOWUnit removeAction rescueAction;

rescueAction = -1;

thePOWUnit joinSilent player;

=================

if you want it to be "Enter":

thePOWUnit.Init:

notYetRescued = true;

Trigger.Condition:

( player distance thePOWUnit )<2 && notYetRescued

Trigger.onActivation:

( findDisplay 46 )displaySetEventHandler[ "KeyDown",{ if( ( _this select 1 )==28 )then{ ( findDisplay 46 )displaySetEventHandler[ "KeyDown",{ } ]; thePOWUnit joinSilent player; notYetRescued = false; }; } ];

Trigger.onDeactivation:

( findDisplay 46 )displaySetEventHandler[ "KeyDown",{ } ];

Share this post


Link to post
Share on other sites

The doFollow command has no effect on units of different groups. DoFollow only changes the units formation status within his group, it does not force a unit to follow another unit.

Share this post


Link to post
Share on other sites

Man-Day!

you rock my soxxxxx!!

=P

thanks a ton man.

Share this post


Link to post
Share on other sites

For Some reason this isn't working for me, I get to action to "Rescue Pow" but when I activate it nothing happens, is there a way to get him to join my squad when I activate the action?

Share this post


Link to post
Share on other sites

example with no extra scripts so prisionar follow your team:

<ul>[*]put 3 men, name each with: p1, p2, p3

add a civil or any, name it: pow1

<ul>[*]in your init.sqs file put

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

team1 = group p1

team1 = group p2

team1 = group p3

<ul>[*]creat a trigger no radius needed

condition put the code

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(p1 distance pow1<=3) or (p2 distance pow1<=3) or (p3 distance pow1<=3)

Inicialization put the code

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

hope this helps huh.gif

Share this post


Link to post
Share on other sites

I would just use waypoints. Make a JOIN AND LEAD waypoint for a capturing unit. Make a JOIN waypoint for a prisoner. Syncronize both waypoints. Just don't forget to setcaptive the prisoner, or your teammates would shoot him.

Share this post


Link to post
Share on other sites
I would just use waypoints. Make a JOIN AND LEAD waypoint for a capturing unit. Make a JOIN waypoint for a prisoner. Syncronize both waypoints. Just don't forget to setcaptive the prisoner, or your teammates would shoot him.

that wouldnt be very good to use. Imagine that if the soldier runs away scared of something.. and he doesnt stand on that radius of the WayPoint.. you will not be able to make it join.

Share this post


Link to post
Share on other sites

.COMmunist: Bravo's right, and it wouldn't work if you're using respawn...

Share this post


Link to post
Share on other sites
.COMmunist: Bravo's right, and it wouldn't work if you're using respawn...

hum.. that made me think (not much)

What about revive?! (i know revive is a respawn) tounge2.gif

I ask this because im using similar (what i posted) in my missions..

Would it work, i still need to test confused_o.gif

Share this post


Link to post
Share on other sites
.COMmunist: Bravo's right, and it wouldn't work if you're using respawn...

hum.. that made me think (not much)

What about revive?! (i know revive is a respawn) tounge2.gif

I ask this because im using similar (what i posted) in my missions..

Would it work, i still need to test confused_o.gif

ok, i just tested what we presumed and talked in the last posts.

When you die, respawn and try to join the POW to our group it does NOT work.

i mean when using the "join group" or "joinsilent" when already respawned, or to be more specific used the revive script, i can Not make the POW to join my team.

When we die in a mission and we get respawned or get revived, when we get close to the pow i don't get the addaction menu to rescue pow so hes Not able to join our team and we can not save him.

We need help here please! help.gif

EDIT: as if the player loses hes id or name when he respawn or get revived.

like i said before i use this command

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(p1 distance pow1<=3) or (p2 distance pow1<=3) or (p3 distance pow1<=3)

and once p1, p2, p3 respawns or get revived they will nolonger be able to make the pows to join

Share this post


Link to post
Share on other sites

Bravo I thought I'd post this here in an attempt to keep the threads on topic, but I've now made a simple mission using the add_action script I was telling you about and as far as I can tell once the enemy player is captured and joins your group it doesn't matter if you are killed and respawn the captured unit remains a member of your group.  This works both on a local and dedicated server.

You can get the script from  here

The script is designed so that any player can capture the unit and the Capture POW action only appears when you are 3 metres away from the unit.  If you move away from the enemy with out capturing the enemy the action disappears but if you move back within range the action reappears.  Also once the unit is captured the script ends and the capture action for all players is lost.  

In the simple test mission in the zip just run up to the OPFOR unit and capture him then respawn. See how you go and let me know what happens.  If you find that the captured unit still leaves your group after respawning or reviving then its a fairly simple matter for me to rewrite the script so that you get the option to capture the unit again.

Good luck,

norrin smile_o.gif

EDIT: I've placed "this setCaptive true" in the OPFOR unit's init line, I'm not sure whether this is why it seems to be working now.

Share this post


Link to post
Share on other sites

I am doing something similar in my coop mission, when the opfor officer joins my group, USSF, i have to have hime get in vehicle last, or i cant get in, same when we get to the boat.

Also something i have noticed, is my group count trigs dont seem to work at the end of the mission when i have him on my group, its as if it counts the no of ppl in group (4 us, 1 opfor) and then compares it with just the no of us in grp. It works fine if i try trig when sla off not there.

I think i may just make him independant, and set independant friends to both sides?

Cheers

GC

Share this post


Link to post
Share on other sites

One more thing what happened to "waypoint" version of joining. Waypoints work on hosted PC, but dedicated crashes the ArmA of the leader guy.

Example:

6 civilians with Captain civilian man leader waiting on Join waypoint.

Alpha leader (corporal) with his team of 5 comes to "join and lead" waypoint and arma crashes everytime on leader's PC. When he comes back the civilian leader man starts yelling "where are you?" and he's the leader.

He doesn't stop yelling even after you kill him..... any clues? smile_o.gif

Share this post


Link to post
Share on other sites

Using both a join waypoint and join and lead waypoint is redundant, you only need one, the other should just be a move waypoint.

Share this post


Link to post
Share on other sites

Bravo 6 asked me to make some changes to my original capture script, so I thought I'd post it here just in case some one else wants to do the same sort of thing.

You can get the revised script from here (POW2.intro.zip), it contains a very simple example mission.

In the revised script only the group leader will get the capture action if an AI unit or another player from his group is within 3 metres of the POW. Other than that it operates like the original script.

Share this post


Link to post
Share on other sites
Bravo 6 asked me to make some changes to my original capture script, so I thought I'd post it here just in case some one else wants to do the same sort of thing.

You can get the revised script from here (POW2.intro.zip), it contains a very simple example mission.

In the revised script only the group leader will get the capture action if an AI unit or another player from his group is within 3 metres of the POW. Other than that it operates like the original script.

i tested that POW2 demo and it still see experienced some issues.

1º - if pow gets killed, and we get close to hes dead body we still can see the menu..also if the AI gets near hes dead body (if pow1 not alive, the menu should not appear)

2º - i sent my AI to the pow and i got the "Capture POW" option in my leader menu, when i seletct the action "Capture POW" the ai instead of capture the pow1, my ai comes running to me and the pow doesn't join my group. Ie, the ai are not able to capture the pow.

i know its hard to do it, i coudln't do it myself but is there a way to fix these issues?

Share this post


Link to post
Share on other sites
i tested that POW2 demo and it still see experienced some issues.

1º - if pow gets killed, and we get close to hes dead body we still can see the menu..also if the AI gets near hes dead body (if pow1 not alive, the menu should not appear)

2º - i sent my AI to the pow and i got the "Capture POW" option in my leader menu, when i seletct the action "Capture POW" the ai instead of capture the pow1, my ai comes running to me and the pow doesn't join my group. Ie, the ai are not able to capture the pow.

i know its hard to do it, i coudln't do it myself but is there a way to fix these issues?

Bravo the first part, the dead POW bit, is easy to fix and the second thing sounds almost like the units have been given the wrong names. Does it work properly in my test mission? If you can, please send me your mission and links to any addons to norrin@iprimus.com.au and I'll take a look into whats going wrong a bit later today.

EDIT: Bravo, don't bother sending me your mission as I think I've found the cause of the second bug (some left over code from the first version that needs changing to work with the new version). I'll test out a fix a bit later and send you and post something if its OK.

Share this post


Link to post
Share on other sites

POW capture/Joins Group script

I am not sure whether anybody else is following this thread but there's a good chance I'm losing my mind (it was never going to take long anyway smile_o.gif)

I need some one to check to see if this script is working as on my laptop and desktop and on a dedicated and local server it works well but I've been told it doesn't and I'm going crazy trying to figure out why. So I just need a helpful person with 5 minutes to spare to give it a go.

You can get the script and very basic test mission from here (POW4)

Here's what its meant to do:

The script adds an action to the group leader's action menu only when the group leader, a player within the group or an AI unit in the group is within 3 metres of a capturable/POW AI unit. If the group leader then uses the action the AI unit joins his group and can be ordered around by the leader.

If the unit from your group moves away from the POW then the action will disappear but will reappear if the unit moves back to the POW. If the group leader is killed and respawns then he will still get the action if a member of his group is within 3 metres of the POW. Also if the POW dies or the POW joins your group or another friendly group the script exits and the action will not appear.

In the test mission there are two POWs a BLUFOR pilot and OPFOR unit. Make sure you choose the team leader role and then just send an AI unit from your group to either POW. The capture action should appear then activate and the POW should join your group, an icon for the POW appears in the group list in the bottom left-hand corner of the screen, it run towards you and take its place in your groups formation - anyway this what happens in my testing.

I'd really appreciate some help with this so if you get a chance let me know what happens on your PC.

EDIT: I've just had confirmation that the script does work but only through the middle mouse scroll action menu, not when you use the action keys like: F2 (unit) + 6 (action) + 4 (Capture Pow).

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  

×