Welcome to the Iron Front Fan Forums!
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
Tayuk

Avatar / Picture

Retired Admin/IFR
Registered:
Posts: 456
Reply with quote  #1 
Here is some instruction and code on how to place units exactly were you want them, in trenches.

  1. Create a trigger,
  2. set it to a radio activation, repeatedly.
  3. On the "on act" box, place this:
copyToClipboard format ["this setPosATL %1;this setDir %2",getPosATL player, getDir player] 


  1. Now go anywhere on the map, pick the location and the facing you want, and set the radio activation.
this setUnitPos "UP"; this disableAI "MOVE"; group1 = group this; group1 setBehaviour "COMBAT"

Use the above code to set them up the way you want.
  • UP is standing,
  • MIDDLE is crouching,
  • DOWN is prone.
  • COMBAT can be switched to CARELESS, AWARE, SAFE or STEALTH.
  • Disabling move means they will stay in that fortification.

This can be used for mines, trenches, tanks, anything really. Handy for placing snipers in tricky locations!
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,757
Reply with quote  #2 
I had updated this thread to give a better layout for instructions as i wanted know how to place soldiers and other misc units in trenches.

Any other tips, and info for placing units in trenches please post them.

__________________
0
Poor Old Spike

Avatar / Picture

IFR Team
Registered:
Posts: 415
Reply with quote  #3 
As an alternative to Tayuk's trigger/radio method of putting units into Squad Trenches, I simply set each unit to 'Special=None' and in their Initialization fields I paste-
this setunitpos"up";this disableai"move"

and they do their job, here an AI Russki schreck lets fly- 




To put a gun into a Gun Trench and stop it sinking into the ground I set 'Special=None' and paste this into their Init fields-
this setpos[getpos this select 0,getpos this select 1,0.7]



Noob note- The units fire regardless of whether they've got a command link to a commander or each other.
Also, you'll probably have to go back to the editor map a few times to slide them a few inches to make sure they're positioned exactly facing the firing notch or they'll be useless if they can't see anything to their front.
(I don't get on with trenches and prefer building my own defences out of earthen ramparts and sandbags etc, but that's a topic for another thread if anybody brings up the subject)
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,757
Reply with quote  #4 
Thanks for posting that Spike, that helps.
I had never tried working with the trenches in If, so i figured for my own little missions I like to play I'd try them out.

__________________
0
scars09

Sergeant
Registered:
Posts: 73
Reply with quote  #5 
the trenches have buildingpositions wich means you can setpos a unit right into the predefined position. the ammount of positions is different for any trench, and the first is always position 0
If the trench is placed in the editor, give it a name, lets say trench1 and then write in initfield of unit
this setpos (trench1 buildingpos 0)


If the trench is part of the island place a unit near the trench and write in unit init
this setpos (nearestbuilding this buildingpos 0)
or using the object id (clicking id´s in editor and zoom in to get the id)
this setPos ((position this nearestObject 12345) buildingPos 0)
12345=the id displayed in editor

to check how many buildingspositions there are and where exactly u get placed create a trigger, activation radio alpha, repeadetly, size 0 and write in on activiation
player setpos (nearestbuilding player buildingpos num); hint format ["buildingpos %1",num]; num = num +1
and in initfield of player
num=0
if u then press 0-0-1 u will get teleported into the buildingpos 0, and when u press 0-0-1 again in buildingpos 1 and so on. if there are no more buildingpositions left u will end up in the middle of the map. U will also get a hint with every activation telling u wich buildingpos u use at that time.
works with the trenches, most buildings and some other things, for example some ruins and fences
setdir and disableai move and setunipos up, as said before, need to be done aswell of course

another way to check quickly if a building has buildingpos available is to create a move waypoint right on the object and see if there are buildingpos listed, note that in that list the buildingpositions start with 1 not 0, but the first buildingpos is if u use the above mentioned commands the buildingpos 0
0
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #6 
I got this code from one of oksmans videos some time ago and then i beleive i saw it here on this Forum.

this setunitpos "Middle";doStop this; this allowFleeing 0; this disableai "target";this forceSpeed 0.5;

What it does is force the unit to kneel,stops them from running away,stops them from moving to "pursue"an enemy but does give them the liberty of turning on the spot to "track"you.Great for troops behind sandbags.I have on one occasion entered a room of a house and the unit with this code had stopped firing from a window and had turned to face me.Great.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.