OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: headshot_snipe on 31 Mar 2003, 20:10:42
-
i was trying to make a machinegunner (from the ww2ecteam 101st units) to shoot randomly from one point to another. I made a script for that but my script can only work if i can get the name of the weapon. there is no readme saying the name of the weapon or ammo. Does anyone know how i can find out the names of mags and weapons through the pbo file or do i have to e-mail them and ask them what the names are?
thx for the help :cheers:
-
To get the name of a weapon a soldier is holding, use a trigger like this:
Trigger
Radius: 0,0
Condition: Radio Alpha
Condition Field: this
OnActivation Field: hint format ["Weapons: %1\n\nMagazines: %2",weapons unit,magazines unit ]
Where unit is the name of your soldier ;)
You'll get two arrays (lists), the first being the names of all the weapons your soldier has. The second is an array of all the magazines your soldier is a carrying
-
thx for your help
i found out the weapon name (EC30C) but for some reason the guy still doesn't want to fire his gun.
my script is:
#loop
a2 fire ["ec30c","ec30c"];
~1
a2 fire ["ec30c","ec30c"];
Goto "loop"
is there smth wrong here?
(this thread is in the wrong place, i know, but i started it as editing general)
-
sorry for this double post but i found out one thing:
i should have put the ammo in the second place (which is EC30C_A) but it still doesn't work.
anyideas?
-
try
a2 fire "ec30c"
In other words, you can use a string rather than an array. With the array you have to get all the arguments right, whereas with a string it's a lot simpler.
In your script you have a spare ; at the end of the line. This doesn't seem to matter much in triggers, but I've had it cause problems in a script.
-
thx a lot, it works now (the guy actually fires)
but... but he looks in the sky and fires.
i tryed o make a script to make him watch 2 targets
#loop
~1.5
a2 dowatch target1
~1.5
a2 dowatch target2
goto "loop"
but the guy doesn't actually look at the 2 targets, he moves his body from side to side (which is what i want) but he looks in the wrong direction.
anyideas how to fix that?
thanks anyways
-
Maybe doTarget? doFire might help you too. Or setDir. You can set up a dummy target like an invisible H, or something setposed below the ground. AI won't target gamelogics though.
syntax in the Command ref.
-
try dude dowatch dude
-
invisible H's don't work - I want the same thing, and they are invisible
-
it looks like this only works on stationary guns (i tryed it with a m2). but i really want to know why the heck do the guys look at the sky instead of where i want them to shoot. I guess i'll have to wait until ww2ecteam release a 30 cal. as a stationary gun.
thx for all your replies anyways.
if anyones finds a way of making those guys shoot straight please notify me.
Cheers :cheers: