Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Very complicated script

Hello all

Ok, now i was thinking to make a sci-fi game, without random battles of any kind. What I'd rather like, is that the player can shoot bullets or at most lasers ( I think lasers are a bit unrealistic). The only problem with that is, that you can shoot in only 4 directions. It would be much more fun if the player could shoot in any direction, turning with the left and right button, walking with up and down, like in the first 2d GTA-games.

I was wondering whether this could be done with scripting or not. I realise it would be very, very hard. Maybe it could be 8 or 16 directions, so it would not take so much time to make the char set.

This was my question (I am dutch, so my english could be crap)
 
You want 8 directional movement? If so, find "def update" in Game_Player and replace the line that says "case Input.dir4" and all the way to the next line with "end" on it with this:
Code:
      case Input.dir8
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      when 7
        move_upper_left
      when 9
        move_upper_right
      when 3
        move_lower_right
      when 1
        move_lower_left
      end
 
That wasn't really what I meant. I'd rather thought of only turning your chara with the left and the right button, so that you don't walk, just stand still on the same place, only turning.
With this you could shoot at enemies, without walking yourself, just turning. But I think it would be a very complicated script, the turning, plus the shooting in that direction in which you are looking, plus hitting the enemy.

While I'm talking about enemies, how about enemies that shoot at you? I figure this would be possible. :)


Thanks anyway for the script You gave me
 
verballydecapitating":2z0i7amo said:
Yes, it could be done.

Well, that's good to know, but how? I realize you are only answering the specific question he asked, but I think it would be useful if you were to point him in the right direction to implementing this feature rather than just saying, "Yes, it could be done." After all, his next question would obviously be, "How?"

PRE-EDIT: Sorry, I just get a little peeved when people are really lazy in their replies to questions for help.

EDIT: And if you know it could be done, how do you know?
Have you seen it done, or have you done it yourself? If yes, more details would be more appreciated in your aforementioned answer.
 
Well he gave the part where it shows the key input.

If you look for "Game Character 3" and scroll down a bit in the coding, you'll see the different parts of controlling like Up, down, left, right, etc.

if you don't want them to move. and just turn. skip pass each section of turn_whateverdirection and go down to the part that increases the steps "@y = #" and change # to 0 if you on'y want them to turn.
 
Correct me if I'm wrong..But couldn't you do this with events?
Something like this:
@>Conditional Branch: If left is pressed
@>Move Event: Player face left

And the same with the other directions. Or would you need it in RGSS?
 
Ok you would need to change the moving system to just either move you forwards or backwards (when up or down is pressed), then for the turning when the player presses left, the direction += 1, and when they press right, the direction -= 1.
 
thank you all for your replies, they have helped me a lot.

The reason i asked this question, is that i thought it would be a bit stupid if the player could shoot in only 4 directions, because it would be weird battles.

So what I am actually asking, is a script that does this:
-the player is able to look in 8 (or yet better, 16) directions
-the player turns with left and right
-the player can shoot by pressing a specific button ( a or something)
-the bullet or laser travels in the direction the player looks in
-if the bullet hits the enemy, the enemy would be damaged.

I'm sorry I haven't been this clear from the beginning, i have been too vague.

I realise this would be a very complicated script, and hard to write.

Yet, thanks again for your replies.
 
sirsk8aton said:
Correct me if I'm wrong..But couldn't you do this with events?
Something like this:
@>Conditional Branch: If left is pressed
@>Move Event: Player face left

And the same with the other directions. Or would you need it in RGSS?

Actually, i do believe that could work. But you wouldnt do it with events, you would do it with common events and set it to paralelle and have 1 area with an event that turns it on. I do alot of stuff with common events, so ill check if this does work. And to walk the direction of that, set it so if facing left (or the direction) and you press up you walk one space to the left (or the direction). When i finish this common event, ill tell you everything.

I cant seem to find the Press Direction in the conditional branch. Maybe it cant be done on the RMXP under common events.
If they have it in there and i just cant find it heres what it would be like

Common Event Movement
Conditional Branch: if left is pressed
Move event: turn 90 degrees to the left<- you wouldnt want it to be face left, or he would only face left. turn 90 degrees makes he always turn 90 degrees to the left, not just face left.
end

Condtional Branch:if up is pressed
Condtional Branch:if facing left
move event: move 1 space to the left
end

Conditional Branch: if right is pressed
Move event: turn 90 degrees to the right
end

Condtional Branch:if up is pressed
Condtional Branch:if facing right
move event: move 1 space to the right
end

Conditional Branch:if pressed down
Conditional Branch: If facing up
Move event: face up
Move event: Move down 1
end

Conditional Branch:if pressed down
Conditional Branch: If facing left
Move event: face left
Move event: Move right 1
end

Conditional Branch:if pressed down
Conditional Branch: If facing right
Move event: face right
Move event: Move left 1
end

Condtional Branch:if up is pressed
Condtional Branch:if facing down
move event: move 1 space down
end

Condtional Branch:if up is pressed
Condtional Branch:if facing up
move event: move 1 space up
end

That would basicly be how its done, but i dont think you can do that, so yes, it must be in script format. Unless you guys can find this, but i do think that this can only be done on the original RM2K and 2K3. If you can try and find these, this is everything you need to do the face and turn. Its pretty easy. Ive been doing this kind of stuff for a while. I used to know how to make a Zelda battle system through this, but over the years i forgot all my practice, so im teaching myself all over again. As soon as i can (if i can) ill post if i can find a way a veriable version of this script i made.
 
Thank you! Even though i can't use it in RMXP, i understand more now of how this could be done. The only thing is, how about 8 directions? Could the player even look in the upper left corner for example?
I understand the shooting in the direction the player is looking in can be done by an other script or event.

Thanks again for your help
 
In common event, that is almost imposible, but if you could you would have to be able to set him to turn half of 90 degrees, which is 45 degrees but since that cant be done, its not really posible without making variables, which would take alot longer. I actually think you might be able to use the normal walking script with out modding the script you might be able to get 8 way direction walking with common events, but that would take a while to figure out to do. I'll try to figure a way to do this with variables, but yes, if you can find a script it would be alot easier on me and you to finish this. If i had some help on the variables (im pretty sure i should be using x and y variables and when equal to a number change the direction but im not completely sure, im know that thats what you use for battle systems and such like animated battle systems with common events, and ive actually seen that done, pretty good too.)
 
Somebody in the first few posts in this thread said by scripting the player could walk in upper_left direction, so maybe you could "call script" through event, to let player look in that direction.
 
You can do it with events without having to change your original script just to get 8 direction working. but you'll still have to call up the script to move in the other direction.
If you do it through events.
For Demonstration purpose, I didn't use common events but you can do it there.

http://img.photobucket.com/albums/v295/darkunderworld/movement.png[/IMG]

So yeah, you'll have to call up the script to move in all direction. which isn't bad

Upper right: move_upper_right
...left: move_upper_right
Lower Right: move_lower_right
...left: move_lower_right

I'll see if you can do it without script =)

EDIT: Ignore the script. There's actually a Move Upper Right, Move Upper Left, etc. in the Set Move Event. I don't know how I didn't see that :D
 
but will rmxp recognize you are looking in this direction? i mean if you want to walk in the direction you are looking in with the up-button, like in the first 2d GTA series.
 
wait. are you saying that when you press Up and Right. it changes the character to be looking upper-right. then when you hold up, it will still be showing that person going up but moving in the upper right direction?

I forgot how the 1st GTA was like :D

EDIT: I did a quick event movement. But I'll need to find a simple 8-directional Character. Can't really tell what's going on since i have it to show it facing right. hmm.. Let me create a ball with Arrows pointing in all the direction to test it :D
 
oh you forgot the first GTA.. hehe, well let me remind you.
you turn with left and right.
you walk into the direction you look in with up ( and backwards with down, but still facing the same direction).

So what I need, is if you press right, the chara turns 45 degrees clockwise, but it stands still on the same tile it was before pressing right.

you think it can be done through events?

EDIT: does RMXP or the ruby script stuff recognize 16 directional movement? Because it will rock like hell if I got that. You need pixel movement then, though, because there are only 8 tiles around you, if it can be done in the first place.
 
darkiewonder said:
You can do it with events without having to change your original script just to get 8 direction working. but you'll still have to call up the script to move in the other direction.
If you do it through events.
For Demonstration purpose, I didn't use common events but you can do it there.

http://img.photobucket.com/albums/v295/darkunderworld/movement.png[/IMG]

So yeah, you'll have to call up the script to move in all direction. which isn't bad

Upper right: move_upper_right
...left: move_upper_right
Lower Right: move_lower_right
...left: move_lower_right

I'll see if you can do it without script =)

EDIT: Ignore the script. There's actually a Move Upper Right, Move Upper Left, etc. in the Set Move Event. I don't know how I didn't see that :D

Dude, that is exactly what i needed. Where did you find in conditional branch the button pressed? He needs it to do the other thing he was requesting. I told him how to do it, but i couldnt find it on mine rmxp at all.
Oh yeah, your conditional branch you choose doesnt work. Ive tried it, it causes your character when you hit up or right to go diagonal. Ive tried it before, and I'm assuming that he wants it so he can have a diagonal look to his characters also. He should also try to find the pixel movement script where instead of moving by the tiles he moves by pixels like in the gta games.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top