Jump to content

Oudy

Members
  • Posts

    191
  • Joined

  • Last visited

Posts posted by Oudy

  1. SlapHappy

    Very interesting. I hadn't thought much about surrender. I've been working on morale checks after groups have lost a percentage of men. If they fail the check they will withdraw back to a withdrawal point. I don't like the idea of having to kill everyone on the map to win. That isn't very historical at all.

    Here is some very rudimentary code from a trigger called "Stop_Attack" that checks for casualties. It works, but probably needs to be tweaked to get the results you would like.

    </font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">SetWorkArmy ( ARMY , 2 )

    //this trigger sets conditions for German withdawl

    Label Test1

    set @check_G_AC = GetNUnits ( ARMY , 2 , ARMOREDCAR , NOT_EMPTY , OK_WEAPON , OK_ENGINE )

    set @check_GHumans = GetNUnits ( ARMY , 2 , HUMAN , NO_PANIC )

    set @check_RHumans = GetNUnits ( ARMY , 1 , HUMAN , NO_PANIC )

    set @check_RArt = GetNUnits ( ARMY , 1 , ARTILLERY , NOT_EMPTY , OK_WEAPON )

    //Initial check

    If ( @check_GHumans < 20 "AND" @check_G_AC < 2 "AND" @check_GHumans < @check_RHumans "AND" @check_RArt > 0 ) then

    Delay ( 2000 )

    Set @random = RND ( )

    If ( @random < 25 ) then

    RunCommand ( ARMY , 2 , RETREAT , POINT , "G_Reinf_Spawn" )

    RunTrigger ( "Mission_Win" )

    Halt

    else

    Delay ( 5000 )

    goto Test2

    endif

    else

    goto Test1

    endif

    //If they pass initial check then check after more casualties

    Label Test2

    set @check_GHumans = GetNUnits ( ARMY , 2 , HUMAN , NO_PANIC )

    set @check_RHumans = GetNUnits ( ARMY , 1 , HUMAN , NO_PANIC )

    If ( @check_GHumans < 15 "AND" @check_GHumans < @check_RHumans ) then

    Delay ( 2000 )

    RunCommand ( ARMY , 2 , RETREAT , POINT , "G_Reinf_Spawn" )

    RunTrigger ( "Mission_Win" )

    Halt

    else

    Delay ( 5000 )

    goto Test2

    endif

    Halt</pre>

  2. SlapHappy

    I posted the unlimber code in my coding examples topic, but it has fallen several pages back...So much for it being useful. :rolleyes:

    http://www.battlefront.com/discuss/ultimatebb.php?ubb=get_topic;f=63;t=001242

    I've found a number of errors in the manual, so when I need the correct syntax, I always use the code from the included campaigns.

    I've about got my test mission finished. I've been reluctant to work too much on it until the patch, so I used it primarily to test code. To debug the mission, I scripted the movement of my own troops as well as that of the AI, so I start the mission and watch both sides advance. It's actually kind of fun to watch...two robot armies attacking one another.

    Best wishes

    Oudy

  3. Question to one of the 1C devs. Is there any possibility of getting more scripting commands added? In particular it would be nice to be able to:

    1. Get the number of visible units.

    2. Get a way to programatically loop through your forces.

    3. It would be nice to have a FOR NEXT command.

    4. It would be nice to be able to determine unit IDs from within groups.

    5. It would really be nice to be able to limber and unlimber artillery via code.

    Anyway, just wondering.

    Oudy

  4. Normal Dude

    I guess the real trick is to fall somewhere between "real life" and gaming expectations. I'm not interested in playing every scenario "to the death." I've been trying to play balance a mission that I'm working on and it is a delicate balance.

    It has been fun playing the enemy AI commander, trying to figure out how he would react to situations. Currently, he still beats me most of the time, probably because I'm too busy watching the show.

    Oudy

  5. I guess the issue that is the most puzzling is does the casualty rate at which an overall attack is called off scale down to the size of the actions in TOW. Take for example if you have three squads totaling 30 men; 40% would be 12 men. Would this allow for a challenging scenario? Or, would you have to scale up the enemy numbers to take into account the casualty rate, at which point you may end up with battles too large for computers to handle.

    I guess this is an issue I'll have to play with to see where the right balance lies.

    Oudy

  6. After looking at most of the scripts included with the game, often you must destroy virtually all of the enemy forces to win. I know that in real life most attacks weren't pressed home until everyone was killed. It's only fair that our poor AI commanders shouldn't do this either.

    What I'm trying to decide is what a reasonable percentage of casualties would be before a commander decides to break off the attack and withdraw. The percentage will probably vary between different nations. For example, Soviet commanders may be willing to accept a higher percentage of casualties than an American commander.

    Off the top of my head, I thought that you might begin to think about breaking off your attack at somewhere between 40-50% casualties, but I'm really not sure. I would appreciate some input about this issue.

    Thanks

    Oudy

  7. How to unlimber and fire a gun using code.

    This is a code of my own creation.

    With this example you have to cheat because there is no way to limber or unlimber using codes. So, here is what I did as a workaround. In the mission tree I created a transport vehicle, the artillery piece and a separate crew. I put the crew in the vehicle and attached the artillery piece. When the unit spawns the vehicle is towing the artillery piece with the crew inside. The vehicle is ordered to move to a rectangle. Once it is in the rectangle the crew is ordered out of the vehicle. The vehicle and gun are then destroyed and another vehicle and gun are respawned at that spot. The crew is then ordered to man the gun. Since there is no unlimber command, you need to know in advance where you want to position the gun because you have to manually place the replacement gun and vehicle in the editor.

    This example demonstrates the need for an unlimber command or at least the ability to dynamically spawn units in different locations during play. If anyone wants to improve on my meager coding attempt, please feel free.

    [Call from GTank_Reinf]

    </font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Set @group = "Group_AT_1Sect_Trans"

    Set @rect = "GArt_1"

    Set @army = 4

    Set @crew = "Group_AT_1Sect_Crew"

    Set @gun = 533

    Set @SdKfz7 = 534

    RunTriggerInstance ( "GArt_Unlimber" , @group , @group , @rect , @army , @crew , @gun , @SdKfz7 )</pre>

  8. Canuckistani

    Click on the tank, halftrack etc and you will see pictures of the crew. When you hover your cursor over the pictures it should tell you, Commander, Gunner, Loader. Left click on the person you want to move and drag them to the proper position. The men will (or should) then switch.

    Hope that helps

    Oudy

  9. I'd like to start a topic where people can post scripting examples. I'll start with providing some examples from the missions made by 1C. Please try to keep this topic limited to examples of code and not discussion of other issues.

    How to attack a Rectangle

    </font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">SetWorkArmy ( ARMY , 2 )

    RunCommand ( GROUP , "Group_Ger_02" , STORM , RECT , "Rect_1" )</pre>

  10. Nonickch

    I don't believe there is a way with the limited number of commands we have available to check for a unit's ID within a group. The only way around this that I can think of is to set up a whole bunch of global variables for all of the units you want to track. For example, Set @@GunCrew_01 = [unitID]. This is unwieldy and I don't know what the impact on performance would be of having so many defined Global Variables.

    One of the big problems for me is how do identify which units are visible. We really need a command like GetNUnits but called GetVUnits (for Get Visible Units). Right now you have to use the UnitsIsVisible command then loop through every unit to find which ones are visible. And that is a problem because there is no easy way to loop through all of the units or groups in your army, without defining them all as Global Variables. But, I may be missing some easier way to do it.

    But, being able to get the unitIDs from within groups would be very nice.

    Oudy

  11. ...Note to self...

    Take out all GOTO statements...

    Or else... ;)

    nonickch, what I would love to see happen is for people to write a series of triggers that handle some of the basic operations that will be used in most missions. I'm thinking about triggers to move a unit along a path of an array, or that check which units are visible, or randomize the time before reinforcements arrive. I've been collecting samples from the missions done by 1C and will post them when I can, but I suspect that many of these can be improved upon. (because they use GOTOs, hehe).

    I've had some experience programming, but it is not my profession, and I would love to see people who write code professionally help to write some code that could be used by all mission builders.

    Oudy

  12. Thewood

    The good and bad thing is that there is tremendous flexibility. There are two types of AI, the hardcoded AI and then the scripted AI. You can write a mission with virtually no scripting, but the enemy troops will will move to wherever you tell them and then stay there. They won't adapt to changing battlefield situations so it would be very easy to "game" the game. With scripting you can make the enemy troops deal with the changing flow of battle in a little more "human" way.

    Oudy

  13. Got a couple of more questions.

    1. If a unit is under a move command and it is fired upon will it continue to move or will it go into Defend mode? I ask this because in the script "Move Horche" and "Move Zonder" in the Paratroopers mission tests to see if it is under the command Defend. If this is the case, what are the conditions that will make a moving unit change its current command?

    2. When is it appropriate to use the "DestroyTrigger" or "DestroyTriggerInstance" command? Should all instances be destroyed once run or not? If you use "DestroyTrigger" can you call another trigger with the same name later?

    Thanks

    Oudy

  14. Jeff

    If you are placing your own troops for initial deployment, you have to use placeholders. In the Mission Tree under ArmyComposition you will find Placeholders. You must have one for each of your initial units.

    Wherever you place enemy troops or reinforcements is where they will spawn.

    Hope that helps.

    Oudy

  15. I would love to see a bunch of generic maps that have different geographical features. That way you could match the map to your particular battle. With the upcoming Map editor you could then add whatever buildings and static items you wanted.

    Oudy

  16. Webwing

    I'm looking at the whole visibility issue as well, the enemy troops should only act on units they see or have been seen. The problem is that there is no easy way to determine what unit you see. You have to loop through every enemy group and check them individually. I've not found an elegant way to loop through all of the groups to test visibility. There are some workarounds I've thought of but as far as I can tell you can't easily loop through them all. I would love advice if anyone has found a good way to do this.

    I would love a command like GetNUnits that would filter for visibility. That way you could add a rectangle around visible units and attack them.

    The scripting language is fairly robust, but there are a few commands I would love to see.

    Oudy

×
×
  • Create New...