Jump to content

Help with scripting


Han

Recommended Posts

I've been trying my hand at scripting the weekend, and mightily complicated it is. I feel it takes some advanced programming knowledge to get anything decent done. And I'm not all that good at programming :(

Anyway, here's a sample I put together. Basically it's a script where two halftracks with guns arrive as reinforcements, move to position, unlimber, the guncrews man the guns and rotate them in a certain direction. Works so far.

RunTrigger ( "reserv" )

Delay ( 1000 )

[reserv]

DELAY ( 5000 )

ReinforcementLand ( GROUP , "Guns" )

DELAY ( 3000 )

Runcommand ( GROUP , Guns , MOVE , RECT , "Rect_1" )

DELAY ( 120000 )

RunCommand ( GROUP , "Guns" , DETACH )

DELAY ( 3000 )

RunCommand ( GROUP , "Guns" , OUT_CREW , PASSENGER )

DELAY ( 3000 )

RunCommand ( GROUP , "Guncrew_1" , IN_CREW , UNIT , "211" )

RunCommand ( GROUP , "Guncrew_2" , IN_CREW , UNIT , "226" )

DELAY ( 60000 )

RunCommand ( GROUP , Pak43_1 , ROTATE , POINT , Point_3 )

RunCommand ( GROUP , Pak43_2 , ROTATE , POINT , Point_3 )

Runcommand ( GROUP , Guns , MOVE , POINT , "Point_4" )

Halt

Now this script works ok as long as one knows how long it takes the group to advance to it's setup-positions. I was wondering if there is any way to make the setting up of the guns dependant on arriving at "Rect_1"? That would make the script a bit more dynamic.

Is there any "library" of pieces of coding that can be used for making working scripts?

Any help would be appreciated!

Link to comment
Share on other sites

This is a trigger I am testing to attach a pak to an sdkfz, follow an array of points to a destination, detatch and crew the pak. During transit, I check for sdkfz immobilization or crew killed.

NOTE : @@capture is a flag used to prevent the _Capture_Unit trigger from re-crewing the pak while it is being attached.

Calling sequence :

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">SET @unit_vehicle = 44 // sdkfz unit

SET @unit_pak = 39 // pak unit

SET @maxunits = 6 // sdkfz crew + pak crew

SET @vehicle = "sdkfz251c_01" // group

SET @crew = "pak_crew_01" // group

SET @path = "array_01" // point array

SET @army = 2

RunTrigger ( "Move_pak" , @unit_vehicle , @unit_pak , @maxunits , @vehicle , @crew , @path , @army )</pre>

Link to comment
Share on other sites

Try a GetNunitsInArea loop in your Rect_1. Since you know the pak is your unit to act on have it count paks in the rect. When the number of paks are greater than 0 or 1 etc then goto your unlimbering routine. This will work unless there is already an "artillery" in rect_1, but you could also count for the amored car with both a set @nuGECar = etc. then it would be an IF pak and/or car is greater than 0 etc etc.... oh, and never forget ENDIF, at the end. use the compile button.

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Label Gunforce

Set @numGEGuns = GetNUnitsInArea ( ARMY , 1 , Artillery , "Rect_1" )

IF @numGEGuns > 0 THEN

Delay ( 2000 )

Runtrigger ( Reserv )

ELSE

GOTO Gunforce

ENDIF

HALT

</pre>

Link to comment
Share on other sites

Once you get that script to work you have to think of things that may go wrong with it and perhaps another short trigger for just in case. For example if the car towing the pak suddenly gets disabled before it reaches the target rect by some stray 20mm you might want to run the Reserv trigger right then. If other ppl play your scenario they might not lead into your scripting.

So have a dynamic rect drawn around the car, and do a loop GetNunitsinArea again and if the number of functioning cars (or armored_Car) is Less Than 1 then runtrigger reserve.

</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Label checktruck

CreateRectByObject ( RECT , "Towtruck" , 100 , UNIT , 419 , Car , 2 )

Delay ( 2000 )

Set @Truck = GetNUnitsInArea ( ARMY , 1 , Car , "Towtruck" , Not_Empty , OK_Engine )

If @Truck < 1 Then

RunTrigger ( "Reserv" )

ELSE

GOTO checktruck

ENDIF

HALT

</pre>

Link to comment
Share on other sites

Thanks again...

Other people playing the scenario...makes me wonder. Are there any custom scenarios for download somewhere? I noticed CMMODS has some, but that's only a handfull compared to what I'm used to with Close Combat?

Are there any custom skins for example for Normandy Panthers and Tigers?

Link to comment
Share on other sites

Originally posted by Han:

Are there any custom skins for example for Normandy Panthers and Tigers?

I made a panther without ambush pattern and a little dirty,

pantherpz5.th.jpg

for the tiger there was more than enaugh in game, you can select them in the missioneditor.

Link to comment
Share on other sites

I made a panther without ambush pattern and a little dirty,

Where could I download this skin? (and/or the map in the background; doesn't look like a stock one?)

Is it possible to adapt CCM textures to ToW? Or is editing so difficult that nobody tried it much so far? Gotta say that scripting is fairly complicated anyway.

Tread is running a bit off course right now ;)

Link to comment
Share on other sites

Originally posted by Han:

Where could I download this skin? (and/or the map in the background; doesn't look like a stock one?)

Here i've uploadet for ya, just dl panther skins.rar and extract in your ToW maindirectory.

http://hosted.filefront.com/rofl21/

Skin 1 is still default, 2 is the one from the first screen, 3 is the same without skirts

pan468ml5.th.jpg

The map on first screen is also selfmade but it's far away from beeing finished, if it is

ready in a few weeks i'll upload, no time ATM :( .

Originally posted by Han:

Is it possible to adapt CCM textures to ToW? Or is editing so difficult that nobody tried it much so far? Gotta say that scripting is fairly complicated anyway.

I don't know because i never played CCM.
Link to comment
Share on other sites

Wow! Thanks! Downloaded and installed ;)

Just wondering...I noticed you changed the color of the numerals to red. I'm working on a Cagny/Goodwood map; would it be possible to put divisional emblems on the front of the tanks; like the charging bull for 11th armored?

Link to comment
Share on other sites

Regiment emblems are allready includet in the game but not enabled and i found only one for the german (5.SS PzDiv.) and one for russia.

It's easy to make a new one but the problem is that the regimentemblems are linked to the vehicle and we cant choose in the editor :rolleyes: ....the enabled regimentemblem will allways appear on the tank.

The other way would be to make a few skins with differend embles and you can choose them in edior but the skins was only 512x512 and maybe its to low resolution for such small things but i'll try it out on the cromwell.

Link to comment
Share on other sites

Is it possible to rescale the tank graphics to 1024x1024? I had a look at those graphics, but at 512x512 you won't see those emblems indeed.

CMBB has some nice armor graphics, and those might be usefull for ToW, but they're on a different scale.

btw posted some screens in the screenshot tread at the main board.

Link to comment
Share on other sites

You can resize the texture to 1024x1024, but it will then need to be reworked, because they look crappy. Here is an example with a late 3rd Pz div emblem as an example:

unitemblemmz5.gif

I haven't gotten very far with this, as you can see. The 1024 images are, well, big and take a lot of time (which I don't have now)

Now if someone like MikeyD would do some of these, that would rock.

Link to comment
Share on other sites

1024 skins with differend emblems for many differend units would be to much work and maybe slow down the game a lot more then it is ATM.

I try to figure out how to add a new divison wich can be linked to individual skin but no sucsess so far, can't find the file where the division information is stored :(

In the parts.ini it would like:

[VehicleSkin_UKSummer1]

Type VehicleSkin

Name UKSummer1

Skin Summer1

Division UkEmptyGray

[VehicleSkin_UKSummer2]

Type VehicleSkin

Name UKSummer2

Skin Summer2

Division Uk_11

The emblems would be a fast job for a weekend and looks much better than painted on the skins.

The mat file for the emblems is available for almost all german, british and russian vehicles.

Ingame divison marking system...

emb1ca1.th.jpg

...painted on 1024

1024skinemblemsg8.th.jpg

...and 512

lowresembyq5.th.jpg

If you want dl at the 1024 at the same link as above.

[ March 26, 2008, 03:26 PM: Message edited by: rofl ]

Link to comment
Share on other sites

×
×
  • Create New...