NDF exercises

From AOW HT Wiki


Within this tutorial, you will learn how to use the NDF and ParNDF languages through simple exercises.

  • In order to achieve the following exercises, you will have to launch the game with the ModManager (located in <GameDirectory>\SDK\bin\ModManager.exe) using the DevMode option. Along those exercises, you may also have to use DebugView whenever printing output is required (DebugView is an application that lets you monitor debug output on your local system). Normally, the game should start on an empty map.
  • The NDF file, say MyFile.ndf, you will use for those exercises must be placed in the <GameDirectory>\datalight\effet\TestModding directory.

If these directories do not exist, create them.

  • Each time you edit your file, you will have to load it (CTRL + P) and then launch it (CTRL + D) to see the result of your modding.



N.B: It is possible to put several NDF files in the TestModding directory. By pressing CTRL + P, all the files in the directory will be compiled and by pressing CTRL + D the game will launch the Test effect which is comparable to the main with C.


The solution page to the following exercises is here

Contents

Exercise 1

Lessons

  • The NDF language, the ParNDF language
  • Accesseur, Effet

Keywords

  • SEQ
  • TEffetRepeatSequentiel
  • TEffetEugDebugWin32
  • TAccesseurStringFromInteger
  • Local variable of type integer
  • The assignement operator ":=" with a multiplication

Exercise

Write the following text in the DebugView output window

 
1
-1
1
-1
1
-1

Solution



Exercise 2

Lessons

nothing!

Keywords

  • TAccesseurStringFormat
  • Local variable of type string

Exercise

Write the following text in the DebugView output window

 
=+1
=+1+1
=+1+1+1
=+1+1+1+1

Solution


Exercise 3

Lessons

  • The simple templates
  • The naming

Keywords

  • Template

Exercise

Write the following text in the DebugView output window by "templating" the previous exercise

 
=+1
=+1+1
=+1+1+1
=+1+1+1+1
=+Y
=+Y+Y
=+Y+Y+Y

Solution


Exercise 4

The use of the ParNDF Debuggeur to trace the code in the exercise 1, 2 and 3

Exercise 5

Lessons

  • Simultaneous effects
  • wait

Keywords

  • SIMU
  • TWaitPrecis

Exercise

Write the following text in the DebugView output window taking inspiration from the first exercise where <t> is DebugView time

 
<t> 1
<t> 1
<t+1> -1
<t+1> -1
<t+2> 1
<t+2> 1
<t+3> -1
<t+3> -1
<t+4> 1
<t+4> 1
<t+5> -1
<t+5> -1

Solution


Exercise 6

Lessons

  • Nothing!

Keywords

  • Nothing

Exercise

Write the following text in the DebugView output window
Use three loops, an external one and two others for each lines

 
1_12222
2_11222
3_11122
4_11112
1_13333
2_11333
3_11133

Solution


Exercise 7

Lessons

  • Launch the game
  • The usual Accesseurs: TAccesseurPositionPlancher*, TAccesseurUnitBalise*, TAccesseurUnitBaliseList*, TAccesseurReal*, TAccesseurVector*, TAccesseurCamp*, TAccesseurBoolean*,...
  • Notions of UnitBalise, PositionPlancher (Ground position).
  • Notions of effects launcher
  • COMPET

Keywords

  • TEffetCreateWarrior
  • TAccesseurPositionPlancher_PickedPoint
  • TAccesseurPositionPlancher_Decalage
  • TAccesseurPositionPlancher_SelfFromUnitBalise
  • TAccesseurRealFromPositionPlancher_Distance2DEnCase
  • TAccesseurBooleanComparatorReal
  • TEffetDonnerUnOrdre
  • TEffetWaitCondition
  • TEffetKillUnitBalise
  • local variable of type UnitBalise
  • local variable of type PositionPlancher

Exercise

1. Create a warrior underneath the mouse pointer
2. Make your warrior walk along a rectangular path
3. Kill your warrior when the walk is completed
4. Make sure your code doesn't crash if the warrior is killed while he is walking
Solution


Exercise 8

Lessons

  • "if/else" with NDF equivalent to #ifdef with C
  • NDFFunctions to achieve complicate test within those "if/else"
    • Equal
    • SamePointer
    • EqualNil
    • EqualListeVide

...

Keywords

  • Nothing!

Exercise

Write a Sequential Effect Template taking as parameters a list, a boolean, a TypeWarrior and 3 effects of your choice

  • This Template should execute the first effect ONLY IF the list is empty
  • This Template should execute the second effect ONLY IF the boolean is true
  • This Template should execute the third effect ONLY IF the TypeWarrior is different from the TypeWarrior TypeWarriorBouchon

Solution


Exercise 9

Lessons

  • The mobiles
  • The GraphicCarac*
  • The TypeWarrior
  • The property of the TTypeWarrior GraphicDescriptor

...

Keywords

  • TGraphicCarac_LauncherEffet
  • TGraphicCaracGeometric
  • TGraphicCaracModel3D

Exercise

Bind an effect to the soldier that will make an interrogation point spin above his head during 1 seconde every 3 secondes

Solution