OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: DaveDash on 04 May 2004, 00:36:40

Title: The Fire command.
Post by: DaveDash on 04 May 2004, 00:36:40
Hi all. I have been having trouble with the "fire" command (yes I have used the "wonderful" search function).

I am using one of E&S's Marines with the M249, I am at work now and cannot remember the gun and mag names, but I assure you it is correct. I will call it M249 for now.

I am trying to simulate a shooting range, with the marines shooting at targets.

I have this in the unit's init line: this setunitpos "down", [this,target01] exec "forcefire.sqs", and he is meant to be firing at the "Target E" objected named "target01".

This invokes a script that works along the lines of this:

_unit = _this select 0
_target = _this select 1
_count = 0

~4
_unit dowatch _target

#loop
? ( _count == 50 ) : exit
_unit fire "M249"
_count = _count + 1

goto "loop"

The object of this script is to make him fire some short bursts at the target, and it works fine apart from one annoying thing.

The soldier in question promptly hit's the dirt, then looks up straight in the air and proceeds to fire his rounds straight up.

Messing around with the target command and dowatch commands avail to nothing.
It is interesting to note that if you simply use the fire command in his init he lets off one round without this annoying behaviour.

The search function revealed someone else has had this problem too, but it remains an unsolved mystery.

Thanks
Dave
Title: Re:The Fire command.
Post by: Dubieman on 04 May 2004, 03:27:18
Yes this has happened before and know one knew what what was going on. I'm sure its easy to bag a duck or gamebird with a SAW so you can eat some real meat not the crappy rations. :)

Anyways there may be several ways to do this. You might be able to make a Soviet dude and group the target e to him then in the soviets inti line put    deletevehicle this
That might work, I've never tested it. Get invisble targets add on here at OFPEC (about 10 -20 kb, not very big) This would probably solve your problem the easiest. Or in your script instead of the fire command maybe a  
dofire target          I'm still not sure about this one either.
Best way to go may be the invible targets add on. :P
Title: Re:The Fire command.
Post by: DaveDash on 04 May 2004, 04:06:14
Yes this has happened before and know one knew what what was going on. I'm sure its easy to bag a duck or gamebird with a SAW so you can eat some real meat not the crappy rations. :)

Anyways there may be several ways to do this. You might be able to make a Soviet dude and group the target e to him then in the soviets inti line put    deletevehicle this
That might work, I've never tested it. Get invisble targets add on here at OFPEC (about 10 -20 kb, not very big) This would probably solve your problem the easiest. Or in your script instead of the fire command maybe a  
dofire target          I'm still not sure about this one either.
Best way to go may be the invible targets add on. :P

Thanks for the suggestions! I might try the invisible target then dofire, a normal dofire and the guy just sits there doing nothing.

It still irks me that it doesn't work. :) There has to be some sort of explaination for it.
Title: Re:The Fire command.
Post by: h- on 04 May 2004, 08:20:15
Just change the the doWatch to doTarget and fire to doFire, with appropriate syntaxes of course...
Title: Re:The Fire command.
Post by: Rokket on 04 May 2004, 09:01:05
the invisible target sounds great. I can't find it in addons, searches for "invisble" and target" come up empty (well, "target" gives me every time word "target is used...")
Title: Re:The Fire command.
Post by: DaveDash on 05 May 2004, 00:04:57
Ok, I have used the dofire command with a invisible target.

Now the unit unloads all his ammo at the invisible target until it is either removed using deletevehicle, or destroyed using setdammage 1.

The only problem with this, is I can't seem to createvehicle one back so the unit can resume firing.

Any ideas? I have tried setting the invisible target as a captive, and tried moving it away then back again with undesirable results.

Title: Re:The Fire command.
Post by: DaveDash on 05 May 2004, 00:05:46
the invisible target sounds great. I can't find it in addons, searches for "invisble" and target" come up empty (well, "target" gives me every time word "target is used...")

empty -> Bas Objects Misc (or something) -> all the TARGETS.
Title: Re:The Fire command.
Post by: Dubieman on 05 May 2004, 00:38:00
It should be here at OFPEC just browse through the list may be a good ten minutes but well worth your time to download it.

Anyways couldn't you make another script that's activated by the first target being setdammaged that places a new invis. target at invisible or visible marker that's behind original invis. target. :)


camcreate "invis target"
getpos "marker"
setpos "marker"

Something like that with those commands... :-\
Title: Re:The Fire command.
Post by: DaveDash on 05 May 2004, 00:56:20
It should be here at OFPEC just browse through the list may be a good ten minutes but well worth your time to download it.

Anyways couldn't you make another script that's activated by the first target being setdammaged that places a new invis. target at invisible or visible marker that's behind original invis. target. :)


camcreate "invis target"
getpos "marker"
setpos "marker"

Something like that with those commands... :-\

I could browse through a few scripts that use the invisible targets I guess, my problem is I'm not entirely sure what to call it when creating it.
The createvehicle command requires you to know the objects name in the cfgvehicles file or some such thing, it's not nessesarily a direct translation from the editor.

For example, the invisible targetin the editor is called "Target - East Inf" , but "Target - East Inf" createvehicle setmarkerpos "marker01" doesn't do anything, yet I have tested with a normal jeep and that works, so I obviously have the name wrong.



Title: Re:The Fire command.
Post by: Dubieman on 05 May 2004, 01:17:26
LesIETA      - invisible target man east
LesIWTA      - invisible target man west
LesIGTA      - invisible target man resistance
LesICTA      - invisible target man civil

That's what your looking for right? The invisible guy targets. Those are the names. The  rest are in the readme file attached  to the add on. :)

Title: Re:The Fire command.
Post by: DaveDash on 05 May 2004, 01:51:26
LesIETA      - invisible target man east
LesIWTA      - invisible target man west
LesIGTA      - invisible target man resistance
LesICTA      - invisible target man civil

That's what your looking for right? The invisible guy targets. Those are the names. The  rest are in the readme file attached  to the add on. :)



That's exactly what I'm looking for (and yes, I read the readme.txt - if they were in there im damn blind:) ). I'll have another go tonight.

Thank's a lot.

Title: Re:The Fire command.
Post by: DaveDash on 06 May 2004, 00:51:09
Ok I finally got it working, it what may seem blatantly obvious to the more experianced scripters here.

I created an invisible target in the editor, saved the mission, and opened up the mission.sqm file.

It is called "bas_targetEastI" or something to that effect.

Then using a simple createvehicle script to spawn the target on the default BIS targets works (for now). Obviously they cant both be on the same square at once and the troops end up firing off to the side, so I will have to perfect the script a bit better and put the invisible target a little behind the corresponding BIS targets.

The troops now fire in for a random period of time at their respective target, then check it out with binocs, then have a few more goes, etc. It looks quite good. :) It would be nice to get the BIS targets to "pop up" but for now I have just made a script which makes them invulnerable.