Jump to content
Sign in to follow this  
travn

Fleeing morter

Recommended Posts

Hi all.

I´m trying to make a morter unit dismantle the morter and run away as the enemy gets close, but with my simple knowledge I can´t find the solution :-(

I have search the forum, but still no result.

Share this post


Link to post
Share on other sites

I'm pretty sure it's possible, but you are going to have to put work into it.

There's going to be multiple stages to the script that determines what the crew will do.

You would have to have a loop that checks for units of the opposing side within the radius that you want.

Then if that happens, you would have to tell the crew to disembark/eject. When they are done that, they would have to call the action to dismantle the mortar. After that, the crew would have to be told to pick up the two seperate pieces (I think it's in two pieces right?).

After all that, they would be assigned a waypoint to retreat.

Just try to think small and work your way up.

Share this post


Link to post
Share on other sites

I think you could try using waypoints and triggers if you want something specific.

Create a trigger and size is as how you would like, make it activated by BLUFOR or whoever you want.

Give the crew unit a "move" waypoint to where its supposed to stay, synchronize it[using F5] to the trigger and then create the waypoints of what the unit is supposed to do when the enemies are spotted, I'd put disembark, move etc.

The waypoints after the move one will execute only once the trigger is activated.

I hope it helps.

Share this post


Link to post
Share on other sites

I answered this for someone here:

http://forums.bistudio.com/showpost.php?p=1866421&postcount=3

You can have an empty mortar just make someone (named mortarman) get in it before blufor get to the trigger. Name the mortar "mortar" in this case. You could put this in mortarman's init.

mortarman assignAsGunner mortar;  [mortarman] orderGetIn true;

Extra fun

Have the mortar crew run away once discovered, you need a runaway marker:

Trigger blufor, once, present.

OnAct:

[mortarman] orderGetIn false; mortarman doMove getMarkerPos "runaway";

Share this post


Link to post
Share on other sites

He wants this:

dismantle the morter and run away

What you posted isn't what he's looking for. Plus, moveInGunner and moveInCargo are better than telling them to get in.

Share this post


Link to post
Share on other sites

OK then:

http://forums.bistudio.com/showthread.php?p=1736958&highlight=disassemble#post1736958

Kylania has a dissasemble/assemble script in the 4th post down - combine that with the suggestions in my post and you should have your solution.

MoveInCargo and MoveInGunner are not better - just different. These act instantly to teleport the AI in whereas orderGetIn makes them move to the mortar and operate it with animations. It is likely the player is watching the AI, so MoveInCargo and MoveInGunnerwould not be very realistic. You would see the AI suddenly teleport into/out of the mortar?

I always use orderGetIn if the player is likely to see the mortar crew at work or the AI are on the player's team.

If Travn is going to the trouble of dissasemble/assemble the mortar, it must be for a reason. If the player does not see it, then it's best to simply setPos the mortar and crew around the map and use MoveInCargo and MoveInGunner.

Everyone happy now?

Edited by PELHAM

Share this post


Link to post
Share on other sites

Nice link there, thanks. I'm happy :yay:

Share this post


Link to post
Share on other sites
I always use orderGetIn if the player is likely to see the mortar crew at work or the AI are on the player's team.

Could you post your code for this?

Everytime I use orderGetIn for units under the players control, it fails. Works okay for AI units with an AI commander though.

Share this post


Link to post
Share on other sites
Could you post your code for this?

Everytime I use orderGetIn for units under the players control, it fails. Works okay for AI units with an AI commander though.

Sorry - could have explained that better - for the players team I order Get In with the command menu action. There is no scripted action listed for that as you say.

There is a corresponding action for the player team to order get out that you can use instead of fumbling for the disembark command.

playerman2 action ["Get Out", Mortar1]

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  

×