ID:147097
 
I have had atleast fourdifferent ways of doing the bump proc.Each had there own little problem.Now this is what i have came to.(PS:Please just Fix-tell me whats wrong with this instead of giving me your bump proc)
    Flag
icon='icon.dmi'
icon_state="fl"
name="Flag"
layer=5
Bump(var/obj/O)
if(O.name=="Flag")
for(var/mob/M in world)
world<<"[usr.key] found the flag!You have just previewed the upcoming maze challenge for our byond halo game."
M.loc=locate(5,5,1)
M.frozen=0
else
return
Stand
icon='icon.dmi'
icon_state="fl2"
name="Stand"
density=1
mob/Bump(var/obj/O)
if(usr.key)
if(O.name=="Stand")
for(var/mob/M in world)
world<<"[usr.key] found the flag!You have just previewed the upcoming maze challenge for our byond halo game."
M.loc=locate(5,5,1)
M.frozen=0
else
return

These are objs by the way.
Well, there at least three problems that I can see.

  • No put usr in proc. Ungh.
  • You're using Bump() backwards; it belongs to the bumper, not to the bumpee. Look up Bumped() on the forums for a way to do what you had in mind.
  • You can't assume that O is actually an /obj. The argument to Bump() may be null (edge of the screen), or any atom.

    Besides that, I'd avoid repeating your "[player] has found the flag" code over and over. You should make that a proc, like EndGame(), so all reinitialization is done there. That way you can keep it consistent.

    Lummox JR
In response to Lummox JR
Ok so from what i've seen it should go somthing like...
    Stand
icon='icon.dmi'
icon_state="fl2"
name="Stand"
density=1
obj/Stand
A.Bumped(src)
Bumped(atom/movable/A)
for(var/mob/M in world)
world<<"[usr.key] found the flag!You have just previewed the upcoming maze challenge for our byond halo game."
M.loc=locate(5,5,1)
M.frozen=0
else
..()
proc..
<dm>
atom/proc/Bumped(atom/movable/A)
atom/movable/Bump(atom/A)

Yet when i bump nothing still seems to happen.
In response to CodingSkillz2
You didn't actually define Bump() to call Bumped(), nor are you using the A argument in Bumped(), which you need in place of usr.

Lummox JR
In response to CodingSkillz2
No, that's NOT what i posted.

I said

atom/proc/Bumped(atom/movable/bumped_by) //Declare a new proc for all atoms called Bumped.
atom/movable/Bump(atom/O)
if(O) O.Bumped(src) //Then make Bump call Bumped for the atom that was hit.


You have to tell us(me) what Stand is. If it's an obj this should work:

obj
Stand
icon='icon.dmi'
icon_state="fl2"
name="Stand"
density=1
Bumped(atom/movable/A)//this is how you call a proc in an obj
if(istype(A,/mob/Whateveritis))//check to see the thing that bumped is a mob who is a player, whateveritis is the type path of the bumping player.
var/mob/M = A//assign a mob to A
world << "[M] found the flag!You have just previewed the upcoming maze challenge for our byond halo game."
M.loc=locate(5,5,1)
M.frozen=0


There's no reason to do for(var/mob/M in world) and then display the message to the entire world anyway instead of just all the mobs in the world.

For would cause lag and be pointless in the way you've done it.

Note: I didn't read what Lummox said so i may have done some things wrong.
In response to DeathAwaitsU
DeathAwaitsU wrote:
var/mob/M = A
for(var/mob/M in world)
world<<"[M] found the flag!You have just previewed the upcoming maze challenge for our byond halo game."

You've just abandoned the value of the mob who found the flag by using the same var in a for() loop (and declaring it anew, which'll cause a compiler error), and then told everyone in the game that everyone found the flag. (Although the world message being in the loop was an error in his code that just carried over into yours, and until now I didn't catch it either.) The player who captured the flag was A, not the M in the loop.

Actually you have no need to do a type cast here with var/mob/M=A. Since you're not using A's vars or procs for anything, but you're just reporting who won, the type cast is useless.

Lummox JR
In response to Lummox JR
I didn't actually post for(var/mob/M).

But ok thanks about the var/mob/M = A thing.
In response to DeathAwaitsU
DeathAwaitsU wrote:
I didn't actually post for(var/mob/M).

You did; it was quoted from your original post, before you edited it. The loop is still needed to reset all the mobs back to their original position; the world output line just shouldn't be in it.

Lummox JR
In response to Lummox JR
I posted it, then i start reading over my post and saw that it shouldn't be done like that and started editing. So i guess you were probably typing your message out as i was fixing the code :)

Oh i didn't understand what he was trying to achieve with his code really, i thought he wanted to relocate the winner to go on to the next challenge or something.