mob //This and the following proc should work
NPCs //as far as I know, with my limited knowledge...
Number_1 //but I get a runtime error with it.
icon='Enemies.dmi' //runtime error: Cannot read null.x
icon_state="#1" //proc name: BossFight1 (/mob/proc/BossFight1)
name="#1" // usr: JS173 (/mob/DM)
verb // src: #1 (/mob/NPCs/Number_1)
Challenge() // call stack:
set src in oview(1) //#1 (/mob/NPCs/Number_1): BossFight1(null, 1)
usr<<"Challenging me?! Insolent Fool! Prepeare to die!" //#1 (/mob/NPCs/Number_1): Challenge()
spawn(10)
BossFight1()
return
proc
BossFight1(var/mob/M,s as num)
switch(input("Will you fight?","BOSS") in list("Yes","No"))
if("Yes")
var/boss=0
var/turfs=list()
s=1
M.OldX=M.x
M.OldY=M.y
M.OldZ=M.z
M.loc=locate(rand(75,76),rand(235,236),30)
M.kp+=s
for(var/turf/arena_turf/boss/T in orange(30,M))
turfs+=T
for(boss = 0, boss !=s, boss++)
var/turf/T=pick(turfs)
new/mob/Monsters/bosses/Number_1(T)
else if("No")
usr<<"Get out of here then!"
..()
BurnProc(mob/P) //following the example of my other skill
for(var/mob/M as mob in oview(3))
var/b
var/s
var/n
var/t=round(P.wis*0.25)
var/damage
if(usr.mp>=250 && usr.angerused==3)
n=250
b=rand(330,450)
s=rand(25,38)
damage=round(P.totalwis-(M.totalwis+(M.totaldex/2))*0.75+rand((usr.hateful*0.2),(usr.hateful*0.5)))
if(P.emotion1=="Anger")
var/mob/S=new/mob/skills
P.mp-=n
S.icon_state="burn"
S.loc=M.loc
if(damage<1)
damage=1
P<<"You hit [M] for [damage] damage!"
M.hp-=damage
M.Deathcheck()
del S
spawn()
P.ClearEmotions()
for(b != 0) //this doesn't count the use of the vars in the compiling for some reason (b,s,and t)
spawn(s) //it always says they're defined but not used.
b-=s //but obviously, I'm using them, I tried with an if() instead of for(),
if(b<0) //but that actually gave errors, not just warnings.
b=0 //can you see what's wrong? is it the for() because it's already in a for() loop?
M.hp-=t //or is there something else wrong? I appreciate the help.
M.Deathcheck()
break
else
P<<"You couldn't use that skill."
..()
break
Problem description:
I look, and I look, and I, as unexperienced at coding as I am, can't see the problems with the codes.
while the code has notes I made, I will spell the problems out here as well.
the first code, is for a boss fight, it uses code almost exactly like my random encounter procedure(which works, until multiple people call it, then it traps one of the players there), but it gives a run-time error(in the notes of the code) when you talk to the boss to start the fight.
and the second code, is for a skill, it once again uses code similar to another thing of code, the problem is that when I have both skills active, they only do 1 damage when they should be doing around the 20-100 range, and the burn effect(basically poison) isn't working at all.
I appreciate help, I had help before, which is mostly how I made the skill code, though the encounter code was all me(and a few references), but I lost contact with my 'mentor' as it were.
my requests are, simply, point out what the problems are, and if you'd be so kind, perhaps a fix, pointing them out and explaining the problem would probably be sufficient though.I'd also like to pose a purely selfish request, that is in no way necessary, perhaps tell me where in the code for the boss fight it messes up the return for multiple players.
Thank You
For the second error, it's because you are never ASSIGNING a value to b, so any attempt to actually use it is somewhat meaningless. s and t might trigger the warning because they are behind unreachable code: the code inside the for(b != 0) block cannot ever execute, as b will always be null (evaluating to 0 for numerical operations).
Speaking of which: you should not be using a for() loop there at all. Look up what they are actually used for in the Reference.