ID:954108
 
(See the best response by Shwb1.)
i trying to make the code which when u defeat a player like 10 times and then u win a characters.
Can u help me please thank u very much just an example

what do you mean defeat a player like 10 times and then you win characters?
Exactly as he said, he probably wants players to be able to unlock new characters, you could just have a kill variable and check that.


~Deathscyth
I think they mean, you fight the same person 10 times and win, you unlock them as a playable char.
mob/var/kills=0
mob/proc/Death(mob/m)
...//basic death stuff goes here
m.AddKill(1)
mob/proc/AddKill(n as num)
kills+=n
if(kills==10)
...//whatever you need done here
OR
mob/var/list/kills=new()
mob/proc/Death(mob/m)
...//same as before
m.AddKill(src)
mob/proc/AddKill(mob/m)
if(kills["[m]"]) kills["[m]"] ++ //Checks if you've killed this mob before. If so, it adds a kill to the amount you've killed this player before.
else kills["[m]"] = 1//otherwise, it defines the player into the list
//Honestly, I don't think this is the best way to do this, I haven't tinkered with list in this way.
if(kills["[m]"]==10)
...//whatever needs to be done here.


Sorry, this is just something quick I put together to give an example of both ways to do this. It is not intended to be used as a guide-line, but only as a example to base yourself off of. This is not the best way to go about it and requires modification in order to function properly.
Not sure how well something like this would work, just thought it might but I don't have time to test. I'll put it here just so you can get a general feel for the idea though:
mob
var
list/available_chars = list(new/mob/playable_char/monkey)//a list storing the characters are available to the mob
list/unlockable_chars = list()//a list storing all the characters the mob can unlock12

New()
..()
for(var/I in typesof(/mob/playable_char)-/mob/playable_char)// for all mobs defined under the type /mob/playable_char
if(I in available_chars) return // If you can alreayd play the charcter there is no need to put it here
unlockable_chars += I // add I to the unlockable chars
unlockable_chars[I] = 0 //set I's associated value to 0

proc/Death(mob/m)
//death stuff
if(istype(m, /mob/playable_char)) // if m is of the playable char type
for(var/mob/I in unlockable_chars) //loop through the contents of src.unlockable_chars
if(I.type == m.type) // if the current I has the same type as m
unlockable_chars[I]++ //we add 1 to I's associated value
if(unlockable_chars[I] >= 10) // if that value is 10 or higher
available_chars += new I.type // we add a mob of I's type to available_chars
unlockable_chars -= I// then we remove I for unlockable_chars as we don't need it there any more.

playable_char//just random things for demonstration purpose
monkey

shark

bird

snake

Hope this helps in some way.
Yes Great fisher :). i made few changes and it give me incosistent indentation
I made a a map as a selection characters, example ( Luffy,Roronoa Zoro,Lucci)ok when you click one of them it bring it to you to the next map as the icon. Now you are facing another player or players is like PVP, when u defeat him like 10 times you unlock a new characters which it doesnt show u before in the selection characters
And my problem is how to make a code, when u defeat him ten times it give it to u a new character
Best response
mob //if you dont know what this is go read the guide again
var/avalible_players() //where the players you can be are stored

var/newplayer = 0 //wether or not you are new

var/kills = 0 //how many kills you have

Login() //when you log in

..() //do all the built in stuffs and stuffs with the stuffs >.>

if(!(newplayer)) //if you are new..

world << "[name]([usr]) has logged in for the first time!" //annouce it!

usr.avalible_players += new mob/derp() //give you your very first player :D

usr.newplayer = 1 //makes it so you are no longer a new player! LEVEL UP!

else //if you are NOT new

world << "[name]([usr]) has logged in!" //tell everyone that you have logged in

proc //if you dont know what this is go read the guide again

Deathcheck() //just the standard death check

//put the deathy stuff here :)

Give_kill(usr,1) //give the usr 1 kill

Give_kill(who,num) //the proc for giving kills

who.kills += num //give "who" the kills

kill_check(usr) //check if they are eligable for rewards

kill_check(who) //the proc for checking for awards/rewards

if(who.kills == 10) // checks if they had "number" kills, in this case checks if they have 10 kills

who.avalible_players += new mob/derpette() //give them the awesome derpette player! LEVEL UP! +10 DERPINESS!


do not just copy this and put it straight into DM make sure you read it and understand it or you will just be coming back
also i tried to space it out so it will be less hard to read :)
and finally i just wrote this up in like 5 minutes, maybe 7 because of the time it took me to write the comments, expect errors
Thanks u so much it help me a lot :) this example i made one as well but it keep say to me undefined var and undefined proc which i already put...
I made a code, studied from your but i found out ur code have problems : mob: undefined var, derp: undefined var, who kills undefined var, who.avalible_players. undefined var, derpette:undefined proc, usr.avalible_players: undefined var Can u help on this ?
In response to Beppinoman
Don't EVER copy/paste code, what he gave you was an example code and wont work.
just wodering and that's what i said i found out..
You don't seem to even understand how the indentation in DM works or how variable definitions work, you need to learn the basics before trying to make a full fledged game my friend.
Ok my friend
Lol, touche. Not to pick on you specifically, we get a lot of help requests here which are basically "can you do the programming for a game feature for me?" requests. It is one thing to ask for help debugging or optimizing existing code, or for general ideas on where to start or an approach, but to code an entire component of a game in a modular way at the request of people is not really the point of the forum.