ID:155074
 
Question 1:

I seem to be having problems colorizing overlays.

I know how to add an such but i've had 2 problems.

First time i tried i would add the overlays and it would not color them.

2nd time, I would color them but not add them.

Can someone please show an example of properly adding an overlay to a character, and then being able to color it?

Question 2:

A player receives exp upon killing a enemy. How do I go about rewarding the player exp based on the level of the mob that was killed.
Coloring an icon is accessible through reference.icon += rgb() or reference.Blend(rgb()/html code) to my knowledge.

var

icon/shirt = new( 'shirt.dmi' ) /* Set the icon. */

color = input( "Choose a color." , "Color Wheel" ) as color /* Allows the user to choose a color from the built-in color wheel. */

shirt.Blend( color ) /* This is where the color gets added. */

reference.overlays.Add( shirt ) or you can do reference.overlays += shirt


As for your second question, you simply do exactly what you're asking.

proc/add_experience( mob/shooter , mob/dead_guy )

return shooter.experience += dead_guy.level /* Add experience to the killer(shooter) based on the dead_guy(enemy)'s level. */


It can be done another way, I have just began liking what return can do.
In response to Neimo
1st one, ok good i just forgot to add "new"


2nd one. No i meant like...


If my level is lower than them i get more exp, if my level is the same i get normal exp, if my level is higher i get less exp.
In response to Komuroto
All you would do is compare the levels.

if( enemy.level > player.level ) return the higher experience.

else if( enemy.level < player.level ) return the lower experience.

else if( enemy.level == player.level ) return the normal experience.
In response to Neimo
Thats what I thought too, but when applied my code is not assigning given exp.

Does it have something to do with my death proc?

As i kill a !key player, by del.

I assign exp based on that. But it doesnt seem to work.

I have done what you said, before you even said it, but its just not assigning the XP.
In response to Komuroto
Show me the death proc, or wherever you are wanting to add the experience.
In response to Neimo
well its not mine, i am helping someone on a teamviewer connection. But i could write one up real fast.
In response to Neimo
would it be better to add exp within death proc or somewhere else?
In response to Komuroto
I would personally do it within the death procedure, or wherever you are giving the death message, if you are.
In response to Neimo
well normally speaking
I added it to the level check, because i didnt know how to check who was killed in the deathcheck beyond !key and player.

In response to Neimo
DeathCheck(mob/M)
if(M.health<=0&&M.npc)// if the hp's 0 and its a NPC.
usr <<"[M] was killed!"/// say they've killed M
del(M)
if(M.health<=0&&M.client)
Frozen=1
M.CanAttack=0
usr << "You have fallen in Combat!"
world << "[src] has fallen in Combat!"
sleep(100)
Checkpoint()
src.health=src.Maxhealth
src << "Try to be more careful, this time."


here just wrote this up real fast.


Now what i did under attack code, was to check to see if given player was dead, then added in the if statements if player was, but i did so after deathcheck when thinking about this , that seems illogical as player was already checked for death and del if (!key)

So.... now I know this has to be applied to my death check, but i honestly dont know how to start that, with victims and such.
In response to Neimo
Neimo wrote:
Coloring an icon is accessible through reference.icon += rgb() or reference.Blend(rgb()/html code) to my knowledge.

> var
>
> icon/shirt = new( 'shirt.dmi' ) /* Set the icon. */
>
> color = input( "Choose a color." , "Color Wheel" ) as color /* Allows the user to choose a color from the built-in color wheel. */
>
> shirt.Blend( color ) /* This is where the color gets added. */
>
> reference.overlays.Add( shirt ) or you can do reference.overlays += shirt
>



i HAVE this, and it doesnt work :/

if("Male")
src.icon='Male.dmi'
var/icon/hair = new('Hair.dmi')
var/color = input( "Choose a color." , "Color Wheel" ) as color
hair.Blend( color )
src.overlays.Add( hair )
In response to Komuroto
Have you tryed doing icon += color?
In response to Neimo
Nvm it took me 2 hours but i figured it out myself.