Jump to content

Npl Scripting With Ogun's Npl Tool.


Addictgamer
 Share

Recommended Posts

Addictgamer

Hey guys!

Today, I will teach you how to use Ogun's npl assembler/disassembler/compiler to create an npl for you level. This guide assumes you have basic knowledge of modding Lego Rock Raiders. It also assumes that you have basic knowledge of how to use the command line. Finally, this guide assumes you are using windows.

Why would you want to create an npl file for your level? Find out here.

So, let's get started.

Part 1. Compiling a ".npl" file.

First, grab ogun's tool. Topic: here. Github repository (grab the latest download from here): here (click the Zip button to download it).

If you suck with command lines, extract the zip's contents onto your desktop, not into a folder on your desktop.

Otherwise, extract contents anywhere.

Now, create a text file in the directory you placed the npl tool and name it test.txt.

Open it in your favorite text editor (nothing fancy like Microsoft word though), and paste this into it:

TRUE ? SetTutorialFlags 0
TRUE ? SetMessagePermit 1

; Check for level fail
TRUE ? SetR1 0
GetToolstoresBuilt = 0 ? AddR1 1
GetMinifiguresOnLevel = 0 ? AddR1 1
GetR1 = 2 ? SetLevelFail

; Check for level success
;GetCrystalsCurrentlyStored > 199 ? SetLevelCompleted
GetMinifiguresOnLevel = 3 ? SetLevelCompleted
Ok, rename the file to test.nrn

Great, You're more than halfway there!

Now, open up a command prompt.

Navigate to the directory you placed the npl tool. (If you placed it on the desktop, then all you have to do is type cd Desktop if you are using vista/windows 7. Shoudl be pretty much the same for all windows OSs. ).

And, type:

npl -c test.nrn -o test.npl
(You do not necessarily have to rename your txt file to nrn, although for the sake of following the guide, do so the first few times.)

Finally, place the resulting npl in your level folder (don't forget to rename it accordingly!) and test your level.

If you did it right,you will win once you teleport down 3 rock raiders.

Part 2. Intro to goal scripting.

Good, now we know how to compile our scripts into gibberish that the game executes.

So, I shall begin teaching you goal scripting itself.

Example 1. - The basics

So, create your text file.

Add this:

TRUE ? SetTutorialFlags 0
According to the wiki, that disables all "game tutorial functions."

Now, this goes in:

TRUE ? SetMessagePermit 1
According to the wiki, that "Enables the game to show messages as needed."

Ok, so there is all the "boring necessary code".

Now, we will write a lose level check.

TRUE ? SetR1 0
This sets the first register to 0. What are these registers? They just are variables for you to use, explained on the lowest level.
GetToolStoresBuilt = 0 ? AddR1 1
Here we encounter several things.

GetToolStoreBuilt = 0 asks the game how many tool stores are built, then checks to see if that is equal to 0.

The '?' Means, If true, then do this.

AddR1 1 tells the game to increase the value of register 1 by 1.

So that line increases the value of register 1 by 1 if there are no toolstores on the level.

GetMinifiguresOnLevel = 0 ? AddR1 1
It is exactly the same as above, only here it checks if the number of mini-figures is equal to zero.
GetR1 = 2 ? SetLevelFail
GetR1 = 2 checks if register 1 has a value of true. The only way that can occur in this script is if there are no tool stores in the level and no mini-figures in the level.

SetLevelFail tells the game that you lost the level.

Now for the victory condition.GetCrystalsCurrentlyStored checks how many crystals are in the level.

If that is greater than 9, for example the value is 10, then you win the level because of SetLevelComplete.

Although no level that comes with the game does this, you can set a collect ore objective simply by changing the last line to:

GetOreCurrentlyStored > 99 ? SetLevelCompleted
Here is how you can set level fail on 0 or less air:
GetOxygenLevel < 1 ? SetLevelFail
Get oxygen level simply asks the game how much oxygen there is, then it checks if it is less than 1.

If so, it then tells the game that you failed the level.

Example 2 - Slimy slugs based on rock raider count.

Just create your text file and fill it with all the lose-win code you wish.

TRUE ? SetR2 0
First, we set register 2 to 0. Register 2 will be used to keep track of how many conditions were met for slugs to emerge.
GetMiniFiguresOnLevel > 5 ? AddR2 1
This is the first condition.

6 or more raiders must be teleported down to the level before the stream of invasion notices can begin.

GetSlugsOnLevel = 0 ? AddR2 1
This is condition 2.

It checks if there are 0 slugs on the level.

GetR2 = 2 ? GenerateSlug
Now it checks if both of these conditions are met.

If so, it generates a slug with GenerateSlug.

You can spice up this script to make invasions more random by adding this line before the check:

GetRandom100 = 1 ? AddR2 1
And changing the check to this:
GetR2 = 3 ? GenerateSlug
Oh wait, a new name has occured.

GetRandom100 supposedly generates a random number that is no greater than 100.

We then tell the game that if that random number happens to equal 1, then another condition is met.

I suggest you make a whole new level in the map creator solely for the purpose of trying this out.

And by the way, here is a modified version of the script above that I use to tease the player in the upcoming version of my map, Karnanga:

;Simple slimey slug script. I use it to freak out the player.
TRUE ? SetR2 0
GetMiniFiguresOnLevel > 9 ? AddR2 1
GetMiniFiguresOnLevel < 21 ? AddR2 1
GetRandom100 = 1 ? AddR2 1
GetR2 = 3 ? GenerateSlug
You should be able to figure out that this makes slugs randomly come out as long as the player has more than 9 raiders, but less than 21.

Warning, certain levels that come with the game will not work with your custom npl file. For optimal testing conditions, make your own level and test the npl in that.

  • Like 1
Link to comment
Share on other sites

  • 10 months later...
  • 2 weeks later...
  • 7 months later...
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.