Instead of istype src, mob player.

Do istype target, mob/player
This is a path and cannot be checked by istype /obj/spells/poison. You pass this as ctype in the arguments to condition.

        world<< istype(/obj/spells/poison,/obj/spells/poison) //evaluates false as arg 1 is a path
world<< istype(new /obj/spells/poison,/obj/spells/poison) //evaluates to true, because arg 1 is an object
Pirion that is what i thought, I have to recreate the obj to be detected. o.o
Or you can just validate the paths match.

/obj/spells/poison==/obj/spells/poison
If you want to compare types, you can simply use the equality operator.
var/a = /obj/spells/poison
if(a == /obj/spells/poison) world << "IT WORKS!"
Putnyour debug world output stuff into each of the if statements to display the src to see which if statements it is breaking at.
Also, you have a bit of a mistake there,
You have this definition:
mob/proccondition(time, damage, obj/ctype, target)

But, you're passing a type, not an object in the third argument:
 src.target.condition(time, damage, /obj/spells/poison, src.target)


Also - why are you passing src.target?
When src.target.condition() is called, the src IS src.target (the same thing you're passing) inside the proc.
src.target.condition(time, damage, new/obj/spells/poison)
Solved the issue, Pirion gets my vote.

The knowing of making something new or not is an issue with me. I will have to look into this more.

Ripper man5
Except...in the way your code is written right now, it's pointless to create a new object if you're not doing anything with it.

mob
enemies
proc

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, new/obj/spells/poison)
step_away(src, src.target)

mob

proc

condition(time, damage, obj/ctype)
spawn()

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

src.HP -= damage
damage_numbers(src, damage)
if(istype(ctype, /obj/spells/poison))
if (istype(src, /mob/players))
var/mob/players/P = src
if(P.poisoned < 1)
time = 0
time --
sleep(10)


Than how shall I deal with this?
In response to Ripper man5
Like how Pirion or I suggested above - you can explicitly compare types using ==.

(and you don't need the typecasting in the ctype argument definition)
I need to istype check because this is not only used for poison. And having many variables defined for each type would be annoying.

var/a = /obj/spells/poison
if(a == /obj/spells/poison)
var/b = /obj/spells/suffer
if(b == /obj/spells/suffer)
var/c = /obj/spells/wither
if(c == /obj/spells/wither)
Best response
You don't need to define the variables - you already have it defined in the argument definition. (I used a as an example)

You can use a switch statement - which is a very powerful tool in DM.
mob/proc/condition(time, damage, ctype)
//your other code here
switch(ctype)
if(/obj/spells/poison)
//do stuff
if(/obj/spells/wither)
//do stuff
if(/obj/spells/suffer)
//do stuff
//insert more code


Though, from the looks of your code, it looks like it'd be better to set up the effects within the definition of the spells themselves - and then you'd have a reason to create the object.
Alright That when through my mind. Thank you Super Saiyan X and Pirion.
Page: 1 2