Jump to content
Sign in to follow this  
GenPattonX

have units stay in group but not in formation

Recommended Posts

hi

I am trying to get some soldiers stay behind a series of sandbag wall fortifications and trenches, but because there is a limit for the amount of individual units i can place in the map, i need to have my soldiers in a group. Probably you could say that the "line formation" would solve my problem but it doesn't, i need to have some soldiers stay at very specific positions along my walls, so i want them to ignore formation.

I tryed these:

this setUnitPos "up"; doStop this;

the first command obviously is so the AI wont go prone once the battle starts, which would be dumb because they have to stay up to defend and target the enemies. The last command i was hoping it would allow me to force a soldier to stay at a specific location, so not in formation, but still in a group, but it doesn't work :(

plz help

one more thing: anyone knows the command or something that makes a unit to watch or look at a specific direction?

Share this post


Link to post
Share on other sites
hi

I am trying to get some soldiers stay behind a series of sandbag wall fortifications and trenches, but because there is a limit for the amount of individual units i can place in the map, i need to have my soldiers in a group. Probably you could say that the "line formation" would solve my problem but it doesn't, i need to have some soldiers stay at very specific positions along my walls, so i want them to ignore formation.

I tryed these:

this setUnitPos "up"; doStop this;

the first command obviously is so the AI wont go prone once the battle starts, which would be dumb because they have to stay up to defend and target the enemies. The last command i was hoping it would allow me to force a soldier to stay at a specific location, so not in formation, but still in a group, but it doesn't work :(

plz help

one more thing: anyone knows the command or something that makes a unit to watch or look at a specific direction?

What you have done is about all there is. DisableAI "move" could be used also. You could try Gen.Barrons cover script. It forces untis to stay behind cover. There is not much that can be done with formation except to set each unit to formation "none" in the editor.

cover.sqs

;========================================

; COVER.SQS

; BY GENERAL BARRON

; AW_BARRON@HOTMAIL.COM

;========================================

; Forces a unit to stop moving, and holds him behind his cover. Place the unit behind cover in the editor, then put this in his init field:

; [this, position#, <building position>] exec "cover.sqs"

; building position is optional; see below.

; position# is an integer that determines what stance the unit will take. Options are:

;0) SITTING

;1) PRONE

;2) CROUCHING

;3) STANDING

;4) STANDING IN THE NEAREST BUILDING

; For #4, you must provide a building position, which is a number telling the script which window or door to hide the guy behind.

;Put your mouse over the grey blocks for buildings in the editor and it will say "Position #2" or something similar; use that number.

; #0 (sitting) makes the guy sit down on the ground, in safe mode. It is just there for convenience, it isn't cover related.

;Once this script is run on a unit, he can never move again.

;Note about placing units behind sandbags

; Units don't like to fire over sandbags, for some reason. However, if you put this in the

; init field of the sandbags, the units will fire over them MUCH more often:

this setdammage 1

;The same thing applies for lots of other types of cover.

;Placing enemies behind cover in this way can make the AI much harder to kill and your missions

;more interesting. Instead of many units running around in the open to defend a base, you can use

;a few units in well placed cover to greater effect. See the example mission for some ideas.

;Also notice in the mission how units are grouped across the town. This method means that when

;guys on one side of the town see you, the guys on the other side of town will also know about you,

;and fire on you if they can. Have fun!

_man = _this select 0

_position = _this select 1

?_position == 0 : goto "SIT"

_man disableAI "move"

_man setbehaviour "combat"

_man setcombatmode "red"

?_position == 1 : goto "PRONE"

?_position == 2 : goto "CROUCH"

?_position == 3 : goto "STAND"

?_position == 4 : goto "BUILDING"

#SIT

dostop _man

_man setbehaviour "safe"

_man playmove "EffectStandSitDown"

exit

#PRONE

_man setunitpos "DOWN"

exit

#CROUCH

_man setunitpos "UP"

~.1

_man playmove "Crouch"

exit

#STAND

_man setunitpos "UP"

exit

#BUILDING

_man setunitpos "UP"

_man setpos ((nearestbuilding _man) buildingPos ((_this select 2) - 1))

;_man dowatch [(getpos _man select 0) - 2 * ((getpos nearestbuilding _man select 0) - (getpos _man select 0)), (getpos _man select 1) - 2 * ((getpos nearestbuilding _man select 1) - (getpos _man select 1)), 2]

;This line *sometimes* makes the guys face out of the window or door. Uncomment it if you wish.

exit

Share this post


Link to post
Share on other sites

you could direct the units with doMove or moveTo and provide a prearranged position, and force them to stay there with forceSpeed 0 (to check if they reached the destination use moveToCompleted, you have to act immediately otherwise the unit will return automaticaly to formation)

doWatch and doTarget, answer the other question.

Share this post


Link to post
Share on other sites

to zulu1: that Gen.Barrons cover script was a good idea i tried it out, it can work for me since all my units holding the trenches are suppose to die so i dont need them to move anywhere

to gammadust: after years of playing this game and creating missions i am still very noob about alot of things... i mean i need more info about what u said, i dont know how to use those moves: "doMove or moveTo" and "doWatch and doTarget"

u probably didn't write anything because it must be obvious, but not to me :( sorry pz tell me how do i use those moves, it should be something like: this doMove "something"; or doMove "something" this; right? plz let me know

---------- Post added at 04:34 ---------- Previous post was at 04:03 ----------

ok i did some search to find examples of those moves i think i got it:

_ESoldier1 doTarget _WSoldier1

this doMove (getMarkerPos "Marker1")

but if u want to help me further i thank you

---------- Post added at 06:27 ---------- Previous post was at 04:34 ----------

ok im actually back to zero... Gen.Barrons cover script only seems to work for vanilla units, i mean when i use the script for a Resistance original soldier it works, but when i use it for addon units it doesn't work, and on my mission i am using DMA and EG resistance soldiers... so.... i am still trying to figure out what to do...

Share this post


Link to post
Share on other sites

I just noticed (my bad i know) that this is on OFP subforum... some of the commands i referenced might not be available, and my help would be limited by this. Anyway i meant them as references for further checking in what should become your bible while scripting. These include pratical examples, also remember to check comments and even the discussion page on the wiki before deeper searches on the forum, useful information there. Whenever i want to do something my first stop is the wiki to check for available commands that might make it possible, then the experience will expedite the process.

Regarding your main purpose the example you found should be a good start. Or someone more seasoned in OFP could chime in.

Share this post


Link to post
Share on other sites

thx guys for replying i got my problem solved with the following set of commands:

doStop this;

s1 setpos getmarkerpos "d1";

this doWatch (object 129150);

this setUnitPos "up";

the 1st and 2nd command combined forces a unit to stay at a marker location, so i just place the marker behind my trenches and its done XD

thx to all

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  

×