ID:180905
![]() Oct 1 2000, 8:54 am
|
|
How would i make the code so that it tells the user how many times they have killed someone? (i can do deaths easily)
|
On 10/1/00 12:32 pm Guy T. wrote:
On 10/1/00 11:54 am Cinnom wrote: thanks, on a stat panel for kills, would i just have it display opponentDeaths[0]? |
On 10/1/00 2:11 pm Cinnom wrote:
On 10/1/00 12:32 pm Guy T. wrote: uh, when i try compiling that it says bad argument definition for MyKiller... |
uh, when i try compiling that it says bad argument definition for MyKiller... D'oh! I was going to look at this last night and got swept up in the GoB. I'll try to come up with an answer this evening. |
uh, when i try compiling that it says bad argument definition for MyKiller... Hmm. I pasted it into my debug world and it compiled fine on the first try... did you alter the code at all? If you like, you can send me the code and I'll see if I can figure out what's going on (gughunter@yahoo.com). Or if it's short, just post it here and I'll play with it. |
If you're letting people kill the same opponent over and over again, without actually deleting the mobs, something like this might work. This method uses "associated values"; for more info, search for that term in the Reference (or ask another question). :)
mob
var/opponentDeaths[0]
proc/Die(mob/myKiller)
src << "You were killed by [myKiller]!"
myKiller.RecordDeath(src)
proc/RecordDeath(mob/myVictim)
if(opponentDeaths[myVictim])
++opponentDeaths[myVictim]
else opponentDeaths[myVictim] = 1
src << "You have now killed [myVictim] [opponentDeaths[myVictim]] times."