Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Dragoon

EXP and Leveling System

Question

Hello all, I'm having a bit of trouble getting this Leveling system to work.

 

The problem: Upon starting the level, the player instantly achieves max level and the max experience to level up constantly rises to the max DooM allows.

 

This code is found under the XP DECORATE lump:

actor Experience : Ammo
{
    inventory.amount 0
    inventory.maxamount 500
    ammo.backpackamount 0
    ammo.backpackmaxamount 500
    +IGNORESKILL
}

actor Level : Ammo
{
    inventory.amount 0
    inventory.maxamount 75
    ammo.backpackamount 0
    ammo.backpackmaxamount 75
    +IGNORESKILL
}

 

This next code is found under the first map's Scripts:

 

#include "zcommon.acs"

script 800 ENTER
{
	while(true)
	{
		if (CheckInventory("Experience") == 500);
		{
			GiveInventory("Level", 1);
			TakeInventory("Experience", 500);
			SetAmmoCapacity("Experience", GetAmmoCapacity("Experience") + 50);
			HudMessage(s:"LEVEL UP!";
			0, 1, CR_YELLOW, 10, 20, 15);
		}
		Delay(1);
	}
}

 

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 1

@Dragon 

Yo, i've been working on a levelling system for my Wad and this looks very similar if not identical to mine :) I would recommend adding a mechanic that once one level up is achieved, the next threshold for levelling up is increased by 10% or something. Making it more harder to level up the next time. 

 

I'm just trying to figure out how to do my own Skill tree system, perhaps we can help each other, how are you going to do yours?

Share this post


Link to post
  • 1
31 minutes ago, GreenKat said:

I would recommend adding a mechanic that once one level up is achieved, the next threshold for levelling up is increased by 10% or something.

That's exactly what the SetAmmoCapacity function in his script is doing.

Share this post


Link to post
  • 1
6 minutes ago, Dragoon said:

Is there a way to make it a percentage? I have it raise by 50 per level at the moment.

Try for example "GetAmmoCapacity("Experience") * 11 / 10" for a 10% increase. Beware an integer overflow after the number becomes too big.

6 minutes ago, Dragoon said:

Is there a way to make the level up script happen in every level without adding the script into every level script?

Yes, with libraries and LOADACS.

Share this post


Link to post
  • 1
8 minutes ago, Dragoon said:

Yup, got it, thanks! Is there a way to make it a percentage? I have it raise by 50 per level at the moment.

 

The skill tree, I was thinking of making it a terminal the player press use on that will bring up a menu of text showing the skill type (Passive or Active) and those would be submenus with the skills. Planning on doing movement speed, damage, health, etc for passives. Active might be difficult cause I'll have to create something for them, like if one Active would let the player fire Imp Fireballs out of his hand.

 

Is there a way to make the level up script happen in every level without adding the script into every level script?

percentage = current experience / total experience for the next level * 100

 

And if you want it for the entire thing, you can make an .o file (compiled .acs) and put in an ACS directory in your .pk3 file. Then use a LoadACS.txt with the name of the script (minus the .o).

Share this post


Link to post
  • 0
25 minutes ago, scifista42 said:

Remove the semicolon after the if statement.

Yes! Thank you so much! Wow, can't believe a semicolon was the problem. I appreciate this, it helped me with so much stress. I can finally move on to a Skill tree system. THANK YOU!

Share this post


Link to post
  • 0
2 hours ago, GreenKat said:

@Dragon 

Yo, i've been working on a levelling system for my Wad and this looks very similar if not identical to mine :) I would recommend adding a mechanic that once one level up is achieved, the next threshold for levelling up is increased by 10% or something. Making it more harder to level up the next time. 

 

I'm just trying to figure out how to do my own Skill tree system, perhaps we can help each other, how are you going to do yours?

Yup, got it, thanks! Is there a way to make it a percentage? I have it raise by 50 per level at the moment.

 

The skill tree, I was thinking of making it a terminal the player press use on that will bring up a menu of text showing the skill type (Passive or Active) and those would be submenus with the skills. Planning on doing movement speed, damage, health, etc for passives. Active might be difficult cause I'll have to create something for them, like if one Active would let the player fire Imp Fireballs out of his hand.

 

1 hour ago, scifista42 said:

That's exactly what the SetAmmoCapacity function in his script is doing.

Is there a way to make the level up script happen in every level without adding the script into every level script?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×