ID:1288876
 
(See the best response by Super Saiyan X.)
Code:
        condition(time, damage, obj/type)

spawn()

src.add_overlay(type)
while(time > 1 && src.HP > 1)

src.HP -= damage
damage_numbers(src, damage)

if(istype(type, /obj/spells/poison))

if (istype(src, /mob/players))
var/mob/players/P = src
if(P.poisoned < 1)
break

sleep(10)

src.remove_overlay(type, 1)

if (src.HP <= 0)

switch(src.type)

if(/mob/players)
var/mob/players/P = src
world << output("<font color = purple><b>[src] died to [type.name].", GI)
var/G = round((P.gold / 4), 1)
P << output("<font color = red>You lost [G] gold", GI)
P.gold -= G
P.loc = respawn_locaion
P.location = "t1"

P.HP = P.MAXHP

if(/mob/enemies)
usr.death(src)


Problem description:
It does not check to make sure player is dead, and if poison = 0 it does not break.
Do you have a deathCheck proc?

If it is the usr.death(src) then you may want to move that up to the /mob/players and do:

players.death(src)


That way if it is a player passed into the statement than it will do a death check.

As to the posion, do you have a timer proc within poison that handles the time or if the poision = 0?

From what I see you have something to check if the player is poisioned is < 1, but I do not see any for or while statement that decrements the time.

It appears the time should be determined when the condition proc is originally called. Thus, you could try:

while(time > 1 && src.hp > 1)

(your code here)
sleep(10)
time--


Which brings me back up to before as to if the decrement is handled within P.poisoned.

        condition(time, damage, obj/type)

spawn()

src.add_overlay(type)
while(time > 1 && src.HP > 1)

src.HP -= damage
damage_numbers(src, damage)

if(istype(type, /obj/spells/poison))

if (istype(src, /mob/players))
var/mob/players/P = src
if(P.poisoned < 1)
time = 0

sleep(10)
time --
src.remove_overlay(type, 1)

if (src.HP <= 0)

switch(src.type)

if(/mob/players)
var/mob/players/P = src
world << output("<font color = purple><b>[src] died to [type.name].", GI)
var/G = round((P.gold / 4), 1)
P << output("<font color = red>You lost [G] gold", GI)
P.gold -= G
P.loc = locate(/turf/start)
P.location = "t1"

P.HP = P.MAXHP

if(/mob/enemies)
usr.death(src)



Yeah .. Yeah. My problem still is it does not check the P's hp and P.poisoned < 1 does not check o.And I do not want death check called for the players
It is not recognizing the type.

if(istype(type, /obj/spells/poison))
What happens if you add an output within those statements to show who/ what p is. I have a feeling that src is changing to something other than the player.
        condition(time, damage, obj/type)

spawn()

src.add_overlay(type)
while(time > 1 && src.HP > 1)

src.HP -= damage
damage_numbers(src, damage)
world << output(type, GI)
world << output(src, GI)
if(istype(type, /obj/spells/poison))
world << output("ok1", GI)
if (istype(src, /mob/players))
var/mob/players/P = src
world << output("ok2", GI)
if(P.poisoned < 1)
world << output("ok3", GI)
time = 0
time --
sleep(10)
src.remove_overlay(type, 1)


Doing it now.
When you call condition what are you passing in for the /obj/type and how are you passing It in?
src.target.condition(time, damage, /obj/spells/poison)

/obj/spells/poison
Ripper man5
/obj/spells/poison
Ripper man5
/obj/spells/poison
Ripper man5


That is what the output told me.
What happens if you do src.poisioned?
How do you know it is not checking p.poisioned, or p.hp, and that it is not recognizing the type?

Such as if you do world << p.hp in the loop what does it show?
Poisioned
is a player var.
And you are calling it when you do

Var/mob/players/p = src
if(p.poisioned)
//yadda yadda

So do src.poisioned and see what it does to make sure src is still ripper and not the obj.

On my phone so a bit difficult to reply.
Code\Condition.dm:23:error: src.poisoned: undefined var
Code\Condition.dm:21:warning: P: variable defined but not used


I got these errors.
So src is not a player.
Yes it is; it is a var/mob/players var.
We need to pass thhe target in as an argument as well because src is changing from player to obj.
But if poision is a player var and src. Poision is undefined. Than src is not a player cause it can not access the player vars.
This procedure is a mob procedure, so it should automatically be as src. However, I will try to call the target through the procedure. It is weird that the overlays are placed on the player as src.
Ok give an update after you try that. I might have an idea why.
            POISON()

if(src.MP<round(14*sqrt(src.poisonlevel),1))
step_towards(src,src.target)
else

src.MP-=round(14*sqrt(src.poisonlevel),1)
missile(/obj/spells/poisonbolt,src,src.target)
sleep(get_dist(src,src.target))

if(!src.target)
return
var
time = round(src.poisonlevel / 2) + 4
damage = round(rand(10 * (sqrt(src.poisonlevel * ((src.Intelligence / 100)+1))), 13 * (sqrt(src.poisonlevel * ((src.Intelligence / 100) + 1)))), 1)
if(src.target.Poisres > 0)
damage-=round(damage * (src.target.Poisres/100), 1)
src.target.poisoned = 1
src.target.condition(time, damage, /obj/spells/poison, src.target)
step_away(src, src.target)

mob

proc
condition(time, damage, obj/ctype, target)

spawn()

src.add_overlay(ctype)
while(time > 1 && src.HP > 1)

src.HP -= damage
damage_numbers(src, damage)

world << output(ctype, GI)

world << output(src, GI)
if(istype(ctype, /obj/spells/poison))
if (istype(target, /mob/players))
var/mob/players/P = target
if(P.poisoned < 1)
time = 0
time --
sleep(10)
src.remove_overlay(ctype, 1)

if(istype(ctype, /obj/spells/poison))
if (istype(src, /mob/players))
var/mob/players/P = src
P.poisoned = 0


The procedure does not recognize poison even with the changes.
Page: 1 2