Jump to content

New Questions on an old NPL Scripting Discussion


RockRaiderWolf
 Share

Recommended Posts

RockRaiderWolf

>checking to see if object x has passed over tile y

Okay in that topic it mentions there is a problem where any object that passes over the tutorial block will complete the level and not just the digger. 

 

So I was wondering if I could get a veteran Nrm/Npl at goal scripting to maybe help me try to figure this out by going through the script and listing what each line of code does. even if we have no luck actually figuring it out it would probably help me to understand how to make my own scripts better.

https://ore.rockraidersunited.org/legacy/06_848983.nrm

https://ore.rockraidersunited.org/legacy/06.npl_decompiled_81522.txt

and here is a screenshot showing the level in map creator with the tutorial blocks/flags? shown as well as the only (?) Object being the smalldigger for the objective. 

 

It seems there isn't all that much to the script just the following

____________________________________________________________________________________

TRUE ? SetTutorialFlags 0
TRUE ? SetMessagePermit 1
 
// Setup initial values
GetObjectiveSwitch ? SetR1 0
 
// Check for completion or failure events
GetOxygenLevel < 1 ? SetLevelFail
 
// Check for no minifigures and no toolstore
GetMinifiguresOnLevel > 0 ? :CanRebuild 
GetToolstoresBuilt = 0 ? SetLevelFail
 
CanRebuild:
 
TRUE ? SetR1 1
loop:
GetRecordObjectAtTutorial GetR1 ? SetLevelCompleted
TRUE ? AddR1 1
GetR1 < 7 ? :loop
__________________________________________________________________________________

So basically all there is to ask (I think?) is what the things In red font do exactly.

 

 

PS: didn't want to necro the old topic so i made this new one as I already made a level with the idea this type of objective could be used for it so i will have to figure something else out if we can't find a way to make it work :/

Link to comment
Share on other sites

GetMinifiguresOnLevel > 0 ? :CanRebuild

This says that if there are more than one RR's on a level, it will jump to 'CanRebuild'.

 

 

 

CanRebuild:

That's telling it where to jump to.

 

 

loop:

GetRecordObjectAtTutorial GetR1 ? SetLevelCompleted

TRUE ? AddR1 1

GetR1 < 7 ? :loop

Ok.

First line: If any objects that one told to record (using some other function) are on the tutorial block that is the number R1 (in this case, 1, but if R1 was 2 then it'd look for anything on tuto block 2)

Second line: It adds 1 to R1. This is so it can cycle the tuto blocks.

Third Line: If R1 is smaller than 7, go to 'loop'. If R1 is NOT smaller than seven (a.k.a seven or eight or whatever), restart the script (as when it reaches the end it loops back to the beginning)

Note that if he had renamed 'loop' to anything else, it would still work. 'Loop' is just a nice term - it's no different from CanRebuild.

 

 

On the subject of the script, you need something to tell it to record the object.

Aha, it looks like this:

TRUE ? GetRecordObjectAtTutorial 5

This tells it to... *quotes what Addict said* 

Here is where the game is told that whatever is on tuto block 5 should be kept track of. In our case, a small digger.

 

And then it should work fine.

 

EDIT: Wait a minute, it won't. I think you need

GetRecordObjectAtTutorial GetR1 > 0 ? SetLevelCompleted

rather than

GetRecordObjectAtTutorial GetR1 ? SetLevelCompleted

as you didn't actually ask it to do anything. You didn't specify how many things there had to be on there.

 

P.S.

Prespawned objects (such as raiders) for some reason count as RecordObjects. Maybe you don't need

TRUE ?  GetRecordObjectAtTutorial 5

, but try it with it anyway.

Link to comment
Share on other sites

RockRaiderWolf

Crap never-mind it I just realized I made a mistake. I tested it and on level06 any pre-placed raiders WILL work to complete the level as well. I had mistakenly thought that was not the case. looks like I will have to figure out another way to get my level to work.... maybe i will look into making my level require finding the trapped raiders and then collecting a certain number of crystal/ores as well.

Link to comment
Share on other sites

RockRaiderWolf

Hey I got another new level I made, this one I will release even if I don't get the script the way I want. It's a sequel to Rocky_Horror (yes I know this level has numerous versions already). anyways basically what I need is a script that Counts how many pre-placed   RockRaiders there are on Tutorial Blocks #20. Is there any way to do that? What I am wanting to do is require the rescue of multiple lost raiders and have the required to be brought back to base or some other area. (as well as collecting a bunch of ore but I already got that part down :P )

Link to comment
Share on other sites

anyways basically what I need is a script that Counts how many pre-placed   RockRaiders there are on Tutorial Blocks #20. Is there any way to do that?

If you want to find the total minfigs on the level, you use "GetMiniFiguresOnLevel", but what you want specifically is "GetRecordObjectAmountAtTutorial x", where X represents what Tutorial Block(s) the script is checking. Try build a script using those.

RecordObject might not work with minifigures, but we'll find out. I'm also not sure if it can handle multiple blocks marked with the same number, but it should be able to.

Link to comment
Share on other sites

RockRaiderWolf

 

anyways basically what I need is a script that Counts how many pre-placed   RockRaiders there are on Tutorial Blocks #20. Is there any way to do that?

If you want to find the total minfigs on the level, you use "GetMiniFiguresOnLevel", but what you want specifically is "GetRecordObjectAmountAtTutorial x", where X represents what Tutorial Block(s) the script is checking. Try build a script using those.

RecordObject might not work with minifigures, but we'll find out. I'm also not sure if it can handle multiple blocks marked with the same number, but it should be able to.

 

Great thanks. 

 

EDIT: The "GetRecordObjectAmountAtTutorial" function does not seem to work at all. and when I use "GetRecordobjectatTutorial 20 > 6 ? SetLevelCompleted" it does not seem to count it correctly? like at first it would consider level complete when 4 were there now it is doing it at 3? no matter what I try this is as close as I have been able to get.

Link to comment
Share on other sites

 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.