Jump to content

Checking To See If Object X Has Passed Over Tile Y


Addictgamer
 Share

Recommended Posts

Addictgamer

Hello guys, in this tutorial you're going to learn how to do stuff similar to what the devs did with the return small digger to base objective in explosive action.

Here, take a look at this sample script:

;The start of the npl

Top:


;Nothing happens if the objective is showing

GetObjectiveSwitch ? SetMessagePermit 0

GetObjectiveSwitch ? :SkippedSkip

GetObjectiveShowing = 1 ? :Skip


SkippedSkip:



TRUE ? SetMessageTimerValues 2000 1000 10000

:end


end:


;check for level fail

TRUE ? SetR1 0

GetToolstoresBuilt = 0 ? AddR1 1

GetTutorialBlockIsGround 5 = FALSE ? :SkipDiggercheck ;If the tile the small digger is on is in an undiscovered cavern, skip over the digger check since the GetBlargOnLevel functions ignore objects in undiscovered caverns.

GetSmallDiggersOnLevel = 0 ? AddR1 1

SkipDiggercheck: ;The small digger is in an undiscovered cavern. Skip over the small digger exists check.

GetR1 > 0 ? SetLevelFail


GetRecordObjectAmountAtTutorial 4 > 0 ? SetLevelCompleted ;When the small digger passes over tuto block 4, this function returns '1', since there's one record object on the block. A record object is an object we told the game to keep track of.




Stop


Skip: ;This code run while objective is showing.

TRUE ? SetTutorialFlags 0

TRUE ? SetMessagePermit 1

TRUE ? SetTimer0 0

TRUE ? SetTimer1 0

TRUE ? SetTimer2 0

TRUE ? SetR0 0

TRUE ? SetR1 0

TRUE ? SetR2 0

TRUE ? CameraUnlock

TRUE ? GetRecordObjectAtTutorial 5 ;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.

Stop


Next:


Clear:

Stop


finish:

stop
The script is pretty self explanatory (mostly due to the comments :P ). First, you grab the object you want the game to keep track of, which is known as a record object.
TRUE ? GetRecordObjectAtTutorial 5
The parameter specifies the tuto block to grab the object at. This code is placed in the skip: codeblock since that code is run while the objective is showing. This way, we are sure the game won't make any other object that passes over that tuto block a record object. Now to check if a record object is on tile x, use this function:
GetRecordObjectAmountAtTutorial 4 > 0

The parameter is the tuto block. The function returns 0 for no recorded objects present, or the number of recorded objects present. Ya, you can make goals that require all 4 raiders returning to base ;)

That should be all. If you have any questions, comments, suggestions, constructive criticism, just ask.

If you have nonconstructive criticism, get out.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Can you tell the game rather than keeping track of an object that was on a tutorial block, instead telling it to keep track of Object [whatever number it was] ?

Link to comment
Share on other sites

Can you elaborate what you mean by:

tell the game

instead telling it to keep track of Object [whatever number it was]

Object [whatever number it was]

Link to comment
Share on other sites

What I was meaning was can you type into the nrm to tell it to keep track of am object. But instead of telling it to keep track of an object that was on a tutorial block (which is what was in your script), can you tell it to keep track of an object from the object list?

 

If that makes more sense...

Link to comment
Share on other sites

What I was meaning was can you type into the nrm to tell it to keep track of am object. But instead of telling it to keep track of an object that was on a tutorial block (which is what was in your script), can you tell it to keep track of an object from the object list?

Doesn't seem there's any way to do that.

Have you taken a look at the NERPS reference? It lists every NERPS function in existence. If any of them seem like they provide that ability, then try them (none of them look like they'd do that, sadly).

CameraLockOnObject is the only function known to interact with the object list.

Link to comment
Share on other sites

  • 2 weeks later...

When I use this code in a level, I win the level as soon as I get a certain rock raider at the target area. This isn't supposed to happen according to your post, since the raiders do not start on a tutorial block.

 

Are you sure that GetRecordObjectAtTutorial actually sets a record object? I looked in the code for level 6 and it doesn'tuse any function at all to set the record object, nor does the small digger start on a tutorial block. In fact, the script uses GetRecordObjectAtTutorial to check if the digger is on the target area.

Link to comment
Share on other sites

From my experience, I think the game records all objects that are placed in a level using the OL file. I tested this by having a pre-placed raider walk over the "goal" tuto block, which completed the level, and a freshly-spawned raider, which did not complete the level.  However, further testing with addictgamer showed that we can actually record specific objects by placing them on a tuto block in order to stick a floating arrow above them or lock the camera to them.

 

It's weird, but it seems like any and all pre-spawned objects would trigger the level completion in Explosive Action and levels similar to it.

Link to comment
Share on other sites

Ok, thanks for the information. It's a shame that one presumably cannot use this type of win condition if there are other prespawned objects that could reach the target area.

Link to comment
Share on other sites

  • 5 years later...

Very old topic, and I'll probably graft my findings into this, but it appears that the game automatically records all objects in revealed caverns at the start of the game and will not care if you use TRUE ? SetRecordObjectPointer NUM ; using that line won't do a thing.

 

For instance, say something, like a raider, is on tutorial block #10 at the start of the game and in a discovered cavern. Then, if all my NERPS script contains is this one line, nothing else, no labels, no nothing:

GetRecordObjectAmountAtTutorial 10 > 0 ? SetLevelCompleted 

I will instantly get a level completed.

 

However, if tutorial block 10 and its raider are in an undiscovered cavern at game start, the game won't care how many SetRecordObjectPointer or GetRecordObjectAtTutorial lines I feed it, it will never trigger that SetLevelCompleted (which BTW as you may guess is the "you win" trigger).

 

Has anybody found any examples to the contrary?

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.