Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ modifying exp loss on death request for help
modifying exp loss on death request for help
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| SirRoughknight
(19 posts) Bio
|
Date
| Wed 06 Jan 2010 06:40 PM (UTC) Amended on Wed 06 Jan 2010 06:42 PM (UTC) by SirRoughknight
|
Message
| I would like to make the game force the player to lose 1 entire levels worth of experience on death, down to a minimum of level 2 (so they can still save), and 10% of their total gold.
I'm thinking a command something very much like the balzhur command, is what I want...
only it would come with some if checks that get the current players level and gold, and subtract 1 and 10% accordingly, then apply it to the character.
Have it act like the anti-mpadvance, if you will.
Something I could have happen to a character when they get sent to the VNUM_ALTAR location on death. Jazz it up with some mpechoat's to make it feel like a "grim reaper" mobile gives the character another chance but extracts its price.
I just don't how to write the code.
Sorry if these forums aren't meant for these kinds of requests.
I've rarely had problems implimenting snippets and code, or modifying existing code to function more the way I want with a little guidance when I do encounter an error...
I've also started reading some c++ manuals, and picked up a book on building muds. Been reading like a mad man, but I'd appreciate some guidance on this one if its possible. | Top |
|
Posted by
| Hanaisse
Canada (114 posts) Bio
|
Date
| Reply #1 on Wed 06 Jan 2010 06:53 PM (UTC) |
Message
| Which Smaug codebase are you using?
(Also, Smaug is written in C, so you'll want to read up on that) |
aka: Hana
Owner in Training of: Fury of the Gods
alm-dev.org:4000 | Top |
|
Posted by
| SirRoughknight
(19 posts) Bio
|
Date
| Reply #2 on Wed 06 Jan 2010 06:54 PM (UTC) |
Message
| I'm using SMAUGFUSS 1.9, compiled cleanly, no errors so far.
Only modifications I've made were in fight.c, lowered the exp gained on damage dealt, and made it so damage is displayed numerically on damage messages shown to the players.
Well that and named the mud, wizlocked it, and added some custom built areas. | Top |
|
Posted by
| SirRoughknight
(19 posts) Bio
|
Date
| Reply #3 on Wed 06 Jan 2010 09:40 PM (UTC) |
Message
| Namely the reason I'm requesting this is, mpadvance doesn't demote players, at least not in my experience.
greet_prog that triggers when the pc enters the room from where they are sent(ALTAR room is now the player's open grave, they have to crawl out to meet the reaper.)
1> if level($n) == 49
2> mpechoat $n It is not your time to be with me $n, go back to the life you tried to leave behind.
4> mpadvance $n 48
5> mptransfer $n 1001
6> endif
(There's a whole list of if checks for each level, and mpadvances I tried to use as demotes down to level 2)
Raises the character to level 50, instead of demoting it to 48.
I've got area building in SMAUG pretty well down, and I try to find most of my solutions therein. Guess I'll stop by the library and snag some books on C instead of C++. Thanks for pointing that tidbit out Hanaisse. | Top |
|
Posted by
| Hanaisse
Canada (114 posts) Bio
|
Date
| Reply #4 on Wed 06 Jan 2010 10:55 PM (UTC) |
Message
| MPAdvance only works to advance levels, however there is another imm command "advance" that can demote levels. Not sure if it can be used in mobprogs though.
Also there is a mobprog variable extension snippet (at smaugmuds.org) that can easily check a ch's current level, which you could just -1 to demote, but I would instead use the code for death penalty to demote the full level instead of doing it in a prog. Otherwise you'd have to delete this penalty.
In fight.c the death penalty is currently this;
/*
* Dying penalty:
* 1/2 way back to previous level.
*/
if( victim->exp > exp_level( victim, victim->level ) )
gain_exp( victim, ( exp_level( victim, victim->level ) - victim->exp ) / 2 );
I'll let you do the math to change it :) |
aka: Hana
Owner in Training of: Fury of the Gods
alm-dev.org:4000 | Top |
|
Posted by
| SirRoughknight
(19 posts) Bio
|
Date
| Reply #5 on Thu 07 Jan 2010 12:32 AM (UTC) Amended on Thu 07 Jan 2010 12:36 AM (UTC) by SirRoughknight
|
Message
| Modified
/*
* Dying penalty:
* 1/2 way back to previous level.
*/
if( victim->exp > exp_level( victim, victim->level ) )
gain_exp( victim, ( exp_level( victim, victim->level ) - victim->exp ) / 2 );
to
/*
* Dying penalty:
* 1/2 way back to previous level.
*/
if( victim->exp > exp_level( victim, victim->level ) )
gain_exp( victim, ( exp_level( victim, victim->level ) - victim->exp ) -1 );
just to see what it would do if the mod was set to 1 experience lower than the base for its current level...
Well, the exp went lower, but the level stayed the same.
There must be something else coded in from preventing players from losing levels due to negative exp at death? | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #6 on Thu 07 Jan 2010 01:51 AM (UTC) |
Message
| There is no feature in Smaug to downlevel. If you use advance to downlevel someone, it resets them to lvl 2 and then advances them back up the level you picked to downlevel them to.
You would need to code an entire function to handle downleveling (if you are expecting max HP to go down, etc). |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| SirRoughknight
(19 posts) Bio
|
Date
| Reply #7 on Thu 07 Jan 2010 04:07 AM (UTC) Amended on Thu 07 Jan 2010 04:12 AM (UTC) by SirRoughknight
|
Message
| I understand the way advance works, reseting to 2 and then raising the character to the specified level.
To sum up what I was hoping for was to either get an explanation on how to code a command like mpadvance except that it works like advance does in reseting to 2 and then raising back to the specified level. (a command that I could give to a mobile to use. Sucks that advance doesn't work for object/room/mob programs, for my purposes atleast.)
Or to make mpadvance also function as advance does, in that it can either advance or demote a level.
I see now that mpadvance doesn't even raise by a specified level, it just raises by one.
Ah well,
In the mean time its back to the drawing board I guess.
I've got some ideas to make the area work without demoting a player.
I learn better when someone takes the time to explain how in a function the operators work.
I guess I'll postpone this one one until I have a better understanding of the C language and can do it myself.
Thanks for your patience Zeno, and Hanaisse. I know it can be difficult to explain things to people who don't have the same understanding you do. Hope I didn't sound too awfully ignorant. | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #8 on Thu 07 Jan 2010 04:44 AM (UTC) |
Message
| Are you sure mpadvance only does one level? The helpfile says otherwise. |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| SirRoughknight
(19 posts) Bio
|
Date
| Reply #9 on Thu 07 Jan 2010 07:37 AM (UTC) |
Message
| I'm pretty sure.
to test it out just now I set a greet_prog:
if level($n) == 1
mpadvance $n 5
mpechoat $n testing, testing. 1, 2, 3... You've been raised to level 5.
endif
Well, the result was the player advanced only one level.
In fact you don't even need to specify a level with mpadvance in the program. Just:
mpadvance $n
raised it up one level as well. | Top |
|
Posted by
| Hanaisse
Canada (114 posts) Bio
|
Date
| Reply #10 on Thu 07 Jan 2010 02:49 PM (UTC) |
Message
| The dying penalty is only dealing with exp, so yes, the formula drops exp, so your math is incorrect.
Try changing dying penalty and remove / 2 or - 1 and leave blank to let it drop all the exp gained and see what happens.
or
Searching around it seems mpadvance is a controversial command anyway due to how easy it can be abused so specific checks were made to make sure it only advanced one level.
If you think a mobprog function would be best you could create a new function, ie; mplevel
Next decide how you want it to function. There's a couple of choices.
You could follow the do_advance function of SmaugFUSS and allow it to demote down to lvl 2 then up again, if you really want to mess with hps/moves/mana values. You'll want to be careful to remove any code that references imm levels.
The other option is to follow the do_advance function of another Smaug based codebase - LOP. The do_advance function was modified to not demote down to lvl 2 then up again, it simply changes level without changing hps/moves/mana. There's no code referencing imm levels as that has been changed to another function.
I'm not saying either will be easy trying to piece together code without fully understanding it (I don't code either, but can get the gist of most of it) so it may be a lot of hit and miss to get it to work.
Again, you'd have to remove the dying penalty, or you're punishing players twice.
Before you do any of these however, I suggest you step back and question why you want to do this. Is it really beneficial to the gameplay of your MUD to penalize players a level for dying? I can tell you, most players won't like it.
(reference: LOP = Lands of Pabulum code base, available at http://www.smaugmuds.org) |
aka: Hana
Owner in Training of: Fury of the Gods
alm-dev.org:4000 | Top |
|
Posted by
| SirRoughknight
(19 posts) Bio
|
Date
| Reply #11 on Fri 08 Jan 2010 01:43 AM (UTC) |
Message
| Ah, gotcha. Does indeed drop the xp left blank.
I was playing around with it to see what would happen if the exp went below the set amount for that level. Nothing except that it went one point below.
A friend of mine cleared this up for me a lot, and I don't feel quite as ignorant now.
I was hoping the character would downlevel. But before I wasn't keen on interpreting how to read the code completely. A whole bunch has been been explained in a way that I now understand.
I was able to get that friend of mine to sit down with me, and explain some things, and then write up a working command.
When I get home I'll post it, so as anyone who might be interested in something like having mobs demote player levels for any number of reasons.
The levels/experience in general in the mud I am working on are hidden from the player anyway. Its a more role-playing intensive theme.
To actually fight any mobile or receive any reward you have to pick a quest up from an npc mob, and then go on the quest. The quest mobs/items/progs etc. will only trigger if you have a certain quest flag set.
All the mobiles scale in level and stats with the players level, and through a pretty nifty series of mob-progs and room-progs will offer different responses either at random, depending on level, and just about any other factor.
But alot of the numerical statistics, etc. go virtually unnoticed.
Most of the messages have been cleaned up to say things like, "Your abilities grow as time passes, and your achievements help to foster your renown throughout the lands." when a player levels.
Instead of a numerical value in the score sheet they'd see almost a system of titles based on level and alignment... essentially to dumb it down it'd be "Hero of the realm" or "Villain of the realm". A level 47 "Crusader" for good would become a "Champion" for good at level 48 in their score.
The actual title command was renamed and given a help file update. It's now Surname.
The level loss in my mud would be more like a player was given a second chance but the reaper took his price. The numerics go unnoticed. Classes are hidden too, actually there is only one.
You unlock spells/skills by completing quests from certain npc mobs, or doing other things.
That 1/2 exp bit really helped by the way.
Most of my MUD experience lies in building for zones and stuff.
And the codebase might be more stock-ish SmaugFUSS right now, but the areas are completely unique.
I'm trying my hand actually learning code and getting more into that aspect, as I'm sure once I have a sound enough knowledge in the appropriate programming languages I'll be able to make some worthwhile contributions to a community like this. My head is full of ideas. (pun intended) :)
--
I've been playing MUDs forever, and the SMAUG codebase has been one of my favorites to build for.
Anywho. Thanks for your guy's help, and when I get the chance to post the code/command information let me know what you think. | Top |
|
Posted by
| Hanaisse
Canada (114 posts) Bio
|
Date
| Reply #12 on Fri 08 Jan 2010 02:05 AM (UTC) |
Message
| Wonderful!
Glad to hear you got it worked out and learned along the way.
Your MUD sounds very interesting, with a lot of thought behind it.
Good luck :) |
aka: Hana
Owner in Training of: Fury of the Gods
alm-dev.org:4000 | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
32,374 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top