Code:
Problem description: How do i make a code so it tells when someone Kills someone? Example: Blah has been killed by Blah.
1
2
ID:144394
Dec 21 2006, 6:46 pm
|
|
In response to Kaioken
|
|
yea it's a rip.. so how do you do it Kaioken?
|
In response to Uniden
|
|
I don't know because of the same reason YOU don't know (and you shouldn't have this problem...its your game).
You know what is the reason? I don't know your code. Unfortunately, you don't either. |
In response to Kaioken
|
|
wow i just looked at the title and wondered what i was thinking of..
|
In response to Uniden
|
|
mob I think that works... |
In response to Revojake
|
|
Revojake wrote:
mob I think that works... mob proc Check(mob/M) if(!M.hp) [src] has killed [M]! You shouldn't post your umm unhelpful code unless it works did you even test it... |
In response to A.T.H.K
|
|
I just pulled it off the top of my head >_>
|
In response to Revojake
|
|
Stop posting with the !hp stuff, if someone has -5 hp it is true.
|
In response to Xx Dark Wizard xX
|
|
Almost but not quite, you did make a few mistakes.. especially with "[src] has killed [M]!", you never stated who got that message nor were there quotes around it.. not to mention you should add .name as well :|:
mob Links for refencing: Boolean MinMax information (click here for DM Ref. for min() or max() get_step() text macros We know you meant well Rev but please, try not to post broken codes.. as for what DW ws trying to say.. read the boolean part above - GhostAnime |
In response to GhostAnime
|
|
I know you guys meant well, though I don't think you helped, just look at the dude's post;
Uniden wrote: Code: > Problem description: How do i make a code so it tells when someone Kills someone? Example: Blah has been killed by Blah. Note he didn't ask how to code in attacks/kills. He only wanted to know how to add a message to his ripped game (and he didn't even post any code). Now if I were you and wanted to help I'd refer him to the DM Guide and recommend he makes his own game. |
call a deathcheck proc after damage is dealt.
|
In response to Chue
|
|
Because you are already have if(hp>=1)return, there's no point for else if(hp<=0) because you already stop the code from happening if it's higher than one..
I like how precausious (sp?) you are but please.. think of the bytes :P - GhostAnime |
In response to GhostAnime
|
|
GhostAnime wrote:
Because you are already have if(hp>=1)return, there's no point for else if(hp<=0) because you already stop the code from happening if it's higher than one.. No offense to him, but I'd define his behaviour "stupid", not "precaucious (sp?)", and he should know coding better before posting sample code, and read the DM Guide, since not only did he still use 'else' despite using 'return' (which is a somewhat common mistake), BUT in an 'else' statement, he used the negative of the if() that the 'else' was referring for... |
In response to Kaioken
|
|
Kaioken wrote:
he should know coding better before posting sample code. Thank you. |
In response to A.T.H.K
|
|
It was nothing, don't mention it. ;)
|
In response to GhostAnime
|
|
What would happen if the players hp wasn't over 1? Say it went into the negatives?
What I see is, is that he probably meant that after damage was dealt, it called the proc, and checked for health and all. Then if the health is such and such, then such and such would happen. I'm not good at coding, nor do I understand enough to create my own game, but that is how I see it. |
In response to Krimson Fury
|
|
Looks like he edited out his code snippet..
Anyways, as to answer your question: 'return' immediately stops that code block from continuing forward.. so if the hp was 1 or greater (hp>=1), it would call return which would stop the rest from happening, which is all the good nifty death stuff involved... thus if the hp was < 1, it would continue forward to its' demise. if(hp>=1) return //Everything below will NOT happen because the return stopped it - GhostAnime |
In response to GhostAnime
|
|
http://developer.byond.com/hub/Zilal/ZBT
Simple... read that... It's one of the steps to un-noobifying yourself... go to developer.byond.com and click the link for you people who can't read... it says "New users click here" .... CLICK IT and click making a dream or whatever, look at the steps at the bottom, and have fun |
In response to GhostAnime
|
|
By the way, you should probably use only the > (or <) operator when you can, its probably 0.00001 faster than >= (and <=). :D
if(hp > 0) return |
1
2
2) If you're asking this, this most likely means you're ripping. Dont. Do It.
Otherwise, if you wrote your attacking&death code yourself, you obviously should be able to do this.