Home   Help Search Login Register  

Author Topic: Scripting a Counter Attack  (Read 455 times)

0 Members and 1 Guest are viewing this topic.

Sol Fire

  • Guest
Scripting a Counter Attack
« on: 29 Apr 2003, 08:47:24 »
Generally, Im making a mission that would probably lag if i had extra tanks/infantry etc.. sitting out of site untill they need to be called in for a counter attack

i would much rather script it and i pretty much already have a script (notice i didnt say "Working Script") that should do it but i tested it and it doesnt work

i think its adding "Invisible" tanks/infantry/crew etc.. since i didnt see anything show up when i tested it

i got most the commands out of the 1.85 Command Reference and i also have a part in the script continually checking where the chopper is untill its near a certain marker then i used the flyinhieght command to make it land and 20 seconds after the flyinheight command i command the group inside the chopper to bail out (by now it should be on the ground) and move to markers i have set up as waypoints pretty much

only problem is nothing shows up when i test the script.. nothing is created but i dont get an error from the commands creating the stuff but i did get 2 seperate errors in around middle and probly end of script before i stopped testing but i dont remember what those were

im adding the script to this post if anyone can check it out and find out whats going on and possibly either tell me how to fix it or fix it for me (i'll end up looking in the script to find out how to do it for future Reference) it's very much Appreciated

Thank you for your time and effort

CrashnBurn

  • Guest
Re:Scripting a Counter Attack
« Reply #1 on: 29 Apr 2003, 17:17:45 »
At the top of your script it tells you how to do it. The minimum required things are position, and groupname. You gave them all names but didn't create them for a pre-existing group. They have to be part of a group that already exists on the map. If you don't want them assigned to groups that are already on the map, then create dummy groups. Place a soldier on the map and give it a groupname and delete it. alpha = group this; deletevehicle this. Now you have a groupname to work with and the soldier is deleted at mission start and won't be on the map. You can even give it waypoints and the created units will follow them.

Now to create soldiers you'd use this syntax.
"SoldierEMG" createunit [getmarkerpos "blahblah", alpha, "soldier1 = this", 0.7, "CORPORAL"]

Now you have the position, groupname, init which gives the units name, his skill, and rank. All your created units need that. You need to use the quotation marks also. If you only use position and groupname it will work, but then you can't move them into vehicles since you don't have a soldier name to work with, so you want to use the init part. Also the default skill is 0.1 (total idiot) so using 0.7 gives him a little brains. You can use any groupname you dream up, it doesn't have to be alpha or bravo etc...Remember that you can only create 12 soldiers for a group, so if you're making a bunch, then make several dummy soldiers with different groupnames to work with. Obviously, you want different groupnames to make units for tanks and other vehicles.

I noticed you're creating units to put in a Mi24, but the Mi24 won't hold that many in its cargo as you're creating. You need to check the editing depot for vehicle capacity values.
« Last Edit: 29 Apr 2003, 17:31:19 by CrashnBurn »

CrashnBurn

  • Guest
Re:Scripting a Counter Attack
« Reply #2 on: 29 Apr 2003, 19:21:34 »
Here's an example mission using a fixed version of your script. Extract the zip to Operation Flashpoint/Users/yourname/missions. It will create its own subfolder called "Counter Attack Test". Load desert island in the editor and you'll see it.  ;)

Sol Fire

  • Guest
Re:Scripting a Counter Attack
« Reply #3 on: 30 Apr 2003, 05:34:39 »
Thank you very much

Generally the Mi24 was just to show you what i was trying to do with the chopper so i probly should have just used 2 or 3 instead  ;)

i got all the info from the Command Reference and pretty much used the info i found to devise this script (like i normally do  ;D )

i'll check the "Fixed" version and see how badly a messed up.. i'll be sure to credit you too, Thanks

*downloads fixed version*
« Last Edit: 30 Apr 2003, 05:41:19 by Sol Fire »