OK, when I compile this code:
var/list/fighterLevels = list(100, 2000, 4000, 8000, 16000)
mob
var/list/expLevelList
var/exp
var/level
Wolf
expLevelList
level = 1
New()
..()
src.expLevelList = 100
src << "You gained [++exp]!"
proc/AddExperience(myAmount)
exp += 100
if(exp >= 100[++level])
src << "You are now level [++level]!"
I get a warning that says:
players.dm:18:if :warning: if statement has no effect
also, when I want to assign a mob experience, would I do it like this:
mob/Badguy
Wolf
icon = "Wolf.dmi"
exp = 200
Will that work? Thanks,
Gilser
ID:151172
![]() Feb 25 2001, 9:40 am
|
|
How do I make it say "[usr] just gained [++exp]" when they kil the enemy?Here's the code:
var/list/fighterLevels = list(100, 2000, 4000, 8000, 16000) mob var/list/expLevelList var/exp var/level Wolf expLevelList level = 1 New() ..() src.expLevelList = 100 src << "You gained [++exp]!" proc/AddExperience(myAmount) exp += 100 if(exp >= 100[++level]) src << "You are now level [++level]!" My wolf code use just: Wolf icon = 'wolf.dmi' HP = 1 shield = 1 dexterity = 2 armor = 2 offense = 2 karma = 1 exp = 200 New() ..() walk_rand(src, 10) Thanks, Gilser |
proc/AddExperience(myAmount) I have no idea why that works at all... change that portion to proc/AddExperience(myAmount) exp += myAmount if(exp >= expLevelList[level+1]) src << "You are now level [++level]!" Then when you add experience, do this: var/experience = 98 mob.AddExperience(experience) //change mob to src, usr, or the target, and experience to the number you'd like to add. You won't be able to copy and paste this. You have to put it in manually based on the situation at hand. So if you were to kill a mob and add its exp var, then you would do usr.AddExperience(mob.exp) where mob is the mob you have killed. See if you can come up with your own experience system! Don't just ask us for help, because pretty soon we're not going to keep answering... also, when I want to assign a mob experience, would I do it like this: Yes, but only at compile time. |
On 2/25/01 12:51 pm Gilser wrote:
How do I make it say "[usr] just gained [++exp]" when they kil the enemy?Here's the code: |
The line under the if statement is not indented far enough to be considered part of the if(). Put another tab there.
Yup!