ID:1343977
 
(See the best response by Spunky_Girl.)
Hey Im working on a soul eater based game and I want to know how to make vector plate like objects.
basically an arrow that when stepped on,will flick an icon state that is 9 ticks long and send them flying in the direction that the arrow is pointing until they hit a dense tile.please help


turf/Entered() for the "vector plate" and then obj/Bump() for the "arrow". Once you get the mob caught on the arrow, you'll use obj/Move() to control the mob/Move() to have them move in the same direction. Finally, once either one Bump()s into a wall, stop the movement or del() the arrow.
ummm....that helped but I still dont quite understand what to do
btw "vector plate" is what the arrow is called

I've seen soul eater
In response to Kenryuto1
Best response
Wow I must've been tired when I wrote this. I interpreted everything completely differently. However, now I think I understand what you're talking about. A vector plate is like what, in Pokemon, Team Rocket used in their bases (in the games) for puzzles. If so...

You still need turf/Entered() for the vector plate itself. In this proc, you will designate a direction the player will be forced to walk in (using the walk() proc). Then, you must make sure to restrain the player from being able to make movement commands while their movement is being forced by the vector plate, until they hit a dense atom.
ok,but how do I do that? I havent used entered() or walk in my code so far yet and I dont know how to stop their movement commands
mob/Move()
if(cantMove)return
..()
mob/Bump()
..()
if(cantMove)cantMove = 0

turf/plate/Entered(atom/A)
..()
if(istype(A,/mob))
var/mob/M = A
M.cantMove = 1
walk(M,NORTH)


Yay untested variable undeclared DM programming!

Read what I just wrote and read Mrs.Spunk's post and you should be able to work out the logic.
In response to Rushnut
Wouldn't walk() fail once it tries to move the player with cantmove set to a true value? You should also return 0 in your Move() proc to make sure it returns a false value.
In response to Spunky_Girl
Spunky_Girl wrote:
Wouldn't walk() fail once it tries to move the player with cantmove set to a true value? You should also return 0 in your Move() proc to make sure it returns a false value.

Yup, the woes of programming in the browser.

return alone will work for this example.
"...will work for this example."

Okay...? What about all other examples? It's just good programming practice. Also, when I said restrict the player's movements, I was moreso referring to making the macros return instead of calling movement.
In response to Spunky_Girl
Spunky_Girl wrote:
Also, when I said restrict the player's movements, I was moreso referring to making the macros return instead of calling movement.

I noticed this after I screwed up. /slowclap
this is all confusing me... why walk(M.north). I wanna make is walk in vector plate's direction

and cantMove is not a variable....should I add it?

It was an example. You need to adapt it to your code if you want to try to make it work.
Code:
mob/Move()
if(cantMove)return 0
..()
mob/Bump()
..()
if(cantMove)cantMove = 0


obj/vectorplate
icon='vectorplate.dmi'
icon_state="base"
Entered(atom/A)
..()
if(istype(A,/mob))
var/obj/V=/obj/vectorplate
var/mob/M=A
M.cantMove=1
flick("activate",src)
sleep(9)
M.cantMove=0
walk(M,V.dir)


Problem Description:It Dont Work
In response to Kenryuto1
Try reading the other posts in this thread.
I have.I dont understand any of this
In response to Kenryuto1
Kenryuto1 wrote:
I have.I dont understand any of this

Okay I should apologize as my code was fundamentally flawed, but Spunky pointed out where and why it's flawed and then gave you the solution.
I read the solution but It still wont work
If you read my solution to Rushnut's post, then you must not understand it. The walk() proc will return without movement since the variable "cantmove" is preventing the Move() proc from doing its thing.

The solution was to prevent the player's movement MACROES from ever calling movement, instead, if the variable "cantmove" is true. This stops the player's commands for movement from ever succeeding rather than just making movement fail.
ok Im kinda following you but how am I supposed to fix that?
Page: 1 2