turf
icon = 'turfs.dmi'
cave
cave_floor
cave_floor_1
icon_state = "cave floor 1"
cave_floor_1_button //opens the secret door in the cave
icon_state = "cave floor 1 button"
Entered(mob/hero/M)
M << "*click!* You hear a rolling in the distance..."
var/turf/cave/cave_floor/secret_door/D
for(D in world)
D.icon_state = "cave floor 1"
D.density = 0
secret_door
icon_state = "cave wall"
density = 1
Problem description:
I have two questions:
1) Is using a for loop to find the secret door a bad idea? Certainly there must be better ways. If anyone has any suggestions I'd like to hear them.
2) I'm still quite new to DM, so I don't quite understand how everything works yet.
Particularly, I am often thrown off by what arguments to pass into procedures.
In the Entered() proc, for example, what I think I am doing (and what I want to do) is make it so the procedure only executes (correct terminology?) when the hero (the player's character) steps on the button. However, when ANY mob (like a wandering monster) steps on it, the procedure is called.
How do I pass in arguments to Entered() so that only the player(/mob/hero) can open the secret door?
And another question...
code
mob/hero/verb
fireball(mob/monster/M in oview())
usr << "You hurl a massive fireball at [M]!"
missile(/obj/magic/fireball, usr, M)
obj/magic
density = 1
icon = 'magic.dmi
Bump(atom/O)
if(ismob(O))
Damage()
problem description
As it is now, when I use missile() and shoot a fireball at a target, the target is damaged immediately (before the missile actually hits it). I want to use Bump() so that damage calculation doesn't take place until the missile reaches its target. The code which I provided, never actually calls Bump().
Also, I don't know if it's okay to ask multiple questions in one post, or not. I don't have regular access to the internet, so I try to save up my questions and post them when I can. Also, I didn't want to clutter up the board with multiple posts. Please let me know which method is the most appropriate.
Thank you
2. Entered() accepts something of type /atom/movable as its first argument (AKA either a /mob or /obj), so even if you typecast the argument you still need to typecheck what's being passed in. You can very easily do:
3. missile() is a purely visual effect that doesn't actually create a new object or use the movement stack. If you want Bump() to be called, then you're going to have to create an instance of /obj/magic/fireball and send it at the target using something from the step_*() or walk_*() families of procedures.