arrow keys movement

Status
Not open for further replies.
Level 2
Joined
Sep 18, 2004
Messages
14
hi ppl were making gothic 2 rpg map we have a close 3rd person camera mod and we need to know how to make the character move with arrow keys or at least wasd
 
Level 7
Joined
Jul 30, 2004
Messages
451
CMEPTb said:
hi ppl were making gothic 2 rpg map we have a close 3rd person camera mod and we need to know how to make the character move with arrow keys or at least wasd

Code:
event - 
    player X presses left key 
actions - 
    set bLeft[player number of triggering player] = true

event - 
    player X releases left key 
actions - 
    set bLeft[player number of triggering player] = false 

//same with right

event -
    player X presses up key
actions -
    set bUp[player number of triggering player] = true

event -
    player X releases up key
actions -
    set bUp[player number of triggering player] = false

event - 
    periodical every 0.50 seconds 
actions - 
    for A = 1 to MaxPlayers
        set fFace[A] = facing direction of unit[A]
        if bLeft[A] == true then
            set fFace[A] = fFace[A] + 8.00
        if bRight[A] == true then 
            set fFace[A] = fFace[A] - 8.00
        make unit[A] face fFace[A] degrees over 0.00 seconds
        if bUp[A] == true then
            set pointMoveTo[A] = position of unit[A] offset by 128 towards (fFace[A]) degrees
            order unit[A] to move to (pointMoveTo[A])
            call RemoveLocation( pointMoveTo[A] )
    end loop

thats the basics, and its also only one of several ways to do it
 
Level 2
Joined
Sep 18, 2004
Messages
14
can u plz tell me what are the veriables is it real booleran stuff like that cuz im noob at map making
cant figure out by myself and in insta gib i could not use the code cuz like i said im a noob but the map is very cool
 
Level 5
Joined
Aug 16, 2004
Messages
89
Well, If you really need help, open the warchaser map. I learned many basic things from that map, except cinematics. I've played gothic 2, love it, but gothic 1 story is still the best. Why don't you make gothic 1 RPG?
 
Level 5
Joined
Jun 9, 2004
Messages
181
Well what raptor said is almost the same way how i did it in InstaGib
variables are boolean, and facing of the hero is real

Now i'll tell u how to make the camera turn with the hero:

variables:
hero: a hero defined when the player selects one, this refers to his/her hero. (unit variable)
HeroFacing: the facing of the hero. Can be used in other triggers, coz this one doesn't really needs it.

events:
periodic: every 0.01secs
cond:
-
action:
for each integer A 1 - max players
set variable HeroFacing (int. A) to facing of hero (int. A)
lock camera of player (int. A) to the hero (int. A)
set camera of player (int. A) angle of attack to 325-360 (any between these values are good)
set camera height of player (int. A) to 50-150
set camera distance of player (int. A) to 250-600
set camera facing angle of player (int. A) to HeroFacing(int. A)

and in case of movement i suggest to use 0.1sec periodic event. That won't be so choppy.
And not +-8 deg turning, that's extremely slow. +-15 or 20 is good.
 
Level 2
Joined
Sep 18, 2004
Messages
14
Raptor-- said:
Code:
event - 
    player X presses left key 
actions - 
    set bLeft[player number of triggering player] = true

event - 
    player X releases left key 
actions - 
    set bLeft[player number of triggering player] = false 

//same with right

event -
    player X presses up key
actions -
    set bUp[player number of triggering player] = true

event -
    player X releases up key
actions -
    set bUp[player number of triggering player] = false

event - 
    periodical every 0.50 seconds 
actions - 
    for A = 1 to MaxPlayers
        set fFace[A] = facing direction of unit[A]
        if bLeft[A] == true then
            set fFace[A] = fFace[A] + 8.00
        if bRight[A] == true then 
            set fFace[A] = fFace[A] - 8.00
        make unit[A] face fFace[A] degrees over 0.00 seconds
        if bUp[A] == true then
            set pointMoveTo[A] = position of unit[A] offset by 128 towards (fFace[A]) degrees
            order unit[A] to move to (pointMoveTo[A])
            call RemoveLocation( pointMoveTo[A] )
    end loop

thats the basics, and its also only one of several ways to do it

how do u make the true false thing?
 
Level 5
Joined
Jun 9, 2004
Messages
181
Choose the "Set Variable" Action.
Create a boolean variable if u haven't created one before.

Oh and something:
The InstaGib movement script makes difference between turning while standing still and turning while in motion. It uses two different triggers for turning, and there's an if/then/else in each what checks if "FWD" var is true or not. If false: then it orders the hero to face +-27 deg from current facing. If true: then moves to current posiotion with polar offset: i think 125 towards +-19 deg from current facing.
 
Level 2
Joined
Sep 18, 2004
Messages
14
yes i used insta gib but the left right triggers didnt work so i did something else i made a trigger that will turn the hero 60 degrees left or right
and now it almost as good as i wanted it

tnx alot your trigger helped alot
 
Status
Not open for further replies.
Top