ID:1769577
 
(See the best response by Xirre.)
Code:
Level
var
clock
req
Level1
req = 100
proc
LevelComplete(mob/M)
if (M.score >= req)
M << "Winner."

/* Bareboned af. I'll develop it further ofc,
just have to get the damn thing to actually work is all.*>*/


mob/Bump(O)
if (istype(O))
src.score += O.pts
del O
var/Level/L
L.LevelComplete()

// One instance where it's called.


Problem description:
EDIT

So new problem. Run time errors whenever I process these codes. I've tried variants, btw. Such as 'var/Level/Level1/L' but no dice.

Probably an easy to spot mistake. . But I'm clueless. HALP!


No coding error here. Just stopped by to see if I could get some guidance on how to properly make a level system. The idea I have in mind is once a certain 'score' threshold is reached, you get a level completion.

I have the general idea of how I want to do everything.

The problem is I'm having trouble thinking of where I should go to design the system

Aka, do I build a child-type under Datum? (Doesn't seem right) Or atom, area, etc.

Since with the idea I have in mind, the different levels would have a bunch of different vars to add difficulties or to distinguish each stage.

EDIT: With a bit of thought. I think defining it under Dantum might actually work. I'll try to experiment. Any help is still appreciated.
Could you go a bit more in depth with what happens when and why?
You don't have to define datums under anything. They'll automatically inherit from /datum just like how mobs inherit from /atom/movable.
some_thingy
var some_var

proc/SomeProc()
Oh. I had no clue I could just go about it in that fashion. Thanks, I'll give that a shot.
Level
var
clock
req
Level1
req = 100
proc
LevelComplete(mob/M)
if (M.score >= req)
M << "Winner."

/* Bareboned af. I'll develop it further ofc,
just have to get the damn thing to actually work is all.*>*/



So can actually create levels functions using your system. @Kaiochao.

Problem is, it's giving me runtime errors. Basically the system works like such: Collecting items over the course of a road adds to your total score. Once you've reached a certain thresh-hold, you win the level.

I've kept it bare-boned, as it's just to testing purposes (and practice so that I can do more advance things with the language).

I run checks whenever the mob gains an item so that the Level proc (in theory) is consistently checked and goes through once the goal is reached.

Sadly, whenever I go bumping into a obj. .

proc name: Bump (/mob/Bump)
usr: Meme01 (/mob)
src: Meme01 (/mob)
call stack:
Meme01 (/mob): Bump(null)
Meme01 (/client): East()


Is displayed. Editting initial post so that potential assistance can see my problem earlier.
In response to Gtgoku55
Runtime errors start with "runtime error: [blah blah]", not "proc name: [blah]". You're missing the actual error.

I'm guessing you're deleting the object bumped into, then trying to access the object that was deleted.
runtime error: Cannot execute null.LevelComplete().
proc name: Bump (/mob/Bump)
usr: Meme01 (/mob)
src: Meme01 (/mob)
call stack:
Meme01 (/mob): Bump(Blueslime (/obj/Slimes/Blueslime))
Meme01 (/mob): Jump()
Meme01 (/client): North()


My bad, missed the first line. Also, hrm . . For a second there, I thought you had solved my problem in the blink of an eye.

Switched the del portion to the end, still getting errors.

On a side note, someone give Kaio a medal. So helpful.
In response to Gtgoku55
Best response
Gtgoku55 wrote:
On a side note, someone give Kaio a medal. So helpful.

He already has one and I'm going to steal it.

var/Level/L = new


It's still null. You may also want to make it new/Level/Level1. Your choice how you want things to work.
Ah. That was one of the errors that was causing my code to be a failure.

But thanks to your help, I also found out the other issues after reading the run time area. THX! *Votes up*

Even though the entire concept of 'new' kind of confuses me.