OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: simoneldridge on 02 Jun 2004, 23:38:49
-
Hi Guys
can some one please tell me if its possible to have a group of Tanks (3x T72)
firing randamly at a set target like a town or maybe just an area lets say 100m square???....any help would be much appreciated!!
Many thanks :)
Wedge
-
you can doTarget some object and then use the "fire" spell :
tank1 fire [a, b, c]
where abc are muzzle, weapon, ammo (as fasr as I recall, its been a while) :P ::) ;D
-
Or invisible targets of some sort and after a knowsabout command is returned a timer goes off in a script which then deletes these targets so that the t72s don't just go crazy on these tarets but make an opening barrage.
Just an idea...
-
There is an invisible target addon somewhere ... you could get the tanks to target it repeatedly while moving it around randomly.
-
Thanks for all the help guys
the only problem is im not too good at scripting.. so therfeore i dont really know about the knowsabout command.
Without being cheeky i really need someone's help pretending im a complete idiot who has never done any real scripting
(acually theres no need to pretend ;D)
i like what Macguba said but have no idea how to go about it :'(
Wedge
-
First of all, find the invisible target addon. It's not hosted at ofpec though somebody did once put a link on the forum.
Right, now insert said target into the mission. I'd have one target for each tank. Place it somewhere in the area you want the tanks to suppress. Right next to each target insert a gamelogic. Name everything.
Now read snYpir's Friendly Intro to Code Snippets and Johnd Gustafsson's Scripting Guide. They will give you the basics of how to create a script file (easy peasy) and make it work (ditto).
Now you need a script. I'm no scripter - this is just a sketch and in particular the syntax is not guaranteed. Somebody nice might write you a proper script but this will get you started if they don't.
; this script makes the tanks fire into the village
tankStop=false
_maxDist1=100
_maxDist2=150
_maxDist3=200
#loop
? tankStop: exit
~3
tank1 doTarget target1
tank2 doTarget target2
tank3 etc (I won't put in all the extra tanks here )
tank1 doFire target1
tank2 etc etc
_rand1A = (random 40) - 40
_rand1B = (random 40) - 40
target1 setPos getPos [(getpos target1 select 0) + _rand1A, (getpos target1 select 1) + _rand1B, 0]
? target1 distance gameLogic1 > _maxDist1: target1 setPos getPos gameLogic1
_rand2A = (random 40) - 40
_rand2B = (random 40) - 40
target2 setPos etc
goto "loop"
-
hey mac
sorry about the late reply
firstly thanks for all your help
but im afraid its not working
it tells me that there is an error getpos:type array
but its so long i cant read the whole error message
this is what i got so far...
tankStop=false
_maxDist1=100
_maxDist2=150
_maxDist3=200
#loop
? tankStop: exit
~3
tank1 doTarget target1
tank2 doTarget target2
tank1 doFire target1
tank2 doFire target2
_rand1A = (random 40) - 40
_rand1B = (random 40) - 40
target1 setPos getPos [(getpos target1 select 0) + _rand1A, (getpos target1 select 1) + _rand1B, 0]
? target1 distance gameLogic1 > _maxDist1: target1 setPos getPos gameLogic1
_rand2A = (random 40) - 40
_rand2B = (random 40) - 40
target2 setPos getPos [(getpos target2 select 0) + _rand2A, (getpos target2 select 1) + _rand2B, 0]
? target2 distance gameLogic2 > _maxDist1: target2 setPos getPos gameLogic2
goto "loop"
sorry to be a pain
Wedge ;D
-
I'm afraid we need more of that error message. Make it happen several times and write down more of it each time. In particular we need to know where the # occurs.
Syntax is not my strong point so use the comrefs to check all the getpos commands in the script.
The random 40 - 40 should of course be random 40 - 20, to give you a random number between -20 and +20. OR of course you can change it to whatever you want. Similarly the maxdists, the actual number is entirely up to you.
-
Hi
Well as i said...the error message is so long i cant read it all unless there is a way that you can??
all i can see is this
target2 setPos getPos [(getpos target2 select 0) + _rand2A, (getpos target2 select 1) + _rand2B, 0]|#|':Error Getpos: Type Array, expected
I cant see any more than that ???
Sorry
-
No, that's fine - you sometimes can't see the end but it's always true that the more you can quote the better, if only so that we can be sure of which line is causing the problem. ALWAYS quote as much of an error message as you can. In this case it's given me enough of a clue. There's an extra getpos in there, which is the sort of thing that happens to me ALL the time. Try
target1 setPos [(getpos target1 select 0) + _rand1A, (getpos target1 select 1) + _rand1B, 0]
and similarly for target2: both have the error but the target2 one occurs last, which is why it appears as the error message.
-
Hey mac thanks for that
there is no error meassage any more
but i have been a bit of a plum.... i cant find the invisible targets anywhere
has anyone got any ideas??
-
I can tell you that they are not at ofpec, but they are somewhere vaguely sensible. Somebody has posted the location on this board, so the forum search function might do the trick.
But if somebody knows where they are, post it here.
-
I've been shamed into action and have something close to what you [might] want now sitting on the Addons Beta Forum.
It seems odd that OFPEC hasn't got its 'own' solution to a common problem. Time to put something back into the pot, I think . . .
-
Hey all!
Here is a link with the invis targets included in Keycats cool MG supression script. Both are worth having.
http://keycat.no-ip.com/files/ManMG_001.zip (http://keycat.no-ip.com/files/ManMG_001.zip)
Wadmann
-
thanks wadmann.
il try it now with targets
;D
-
hi all
thanks for all your help on this subject
it is working now so all is good ;D
i do have just a couple of small questions though
within the script mac has given me is it possible to change the damage of the shell's????
secondly.. if i wanted to imitate tanks with turrets raised and firing like they are giving artillery support to anothr part of the island ...how can i do this??
Many thanks once again :)
Wedge
-
You could just raise the height of the invisible objects.
-
tried it.It didnt seem to work
in the target's read me it said that tanks wont fire their sabot's at them.?? ??? :(
-
The targets may be falling back to the ground. You might have to use a setpos loop to keep them in the air. Alternatively, place them faraway and give the tanks a reveal command.
If sabot doesn't work use heat - it will look better anyway. Changing the explosion at the other end is possible, but would be hard work. You'd need to use a nearestobject command to grab the shell as it left the barrel, delete it and then create an explosion where it should have landed. What do you want bigger bangs for anyway? Where is the player in all this - what is he actually going to see?
-
Hi
To be honest the bigger bang was literally just a question,i just wondered if it could be done.
The other idea's(reveal command + looping) are very good but im afraid once again i have no idea how to implement them.?
Wedge
-
Yes you do. ;)
You know how to make a script work. You know how to look up the online command reference. You know how to .... well, err, that's it actually. If you haven't read snYpir's Friendly Intro to Code Snippets and Johan Gustafsson's Scripting Guide its time you did.