|
C-Script problem...
#167829
11/16/07 22:16
11/16/07 22:16
|
Joined: Nov 2007
Posts: 18
JimmyJazz
OP
Newbie
|
OP
Newbie
Joined: Nov 2007
Posts: 18
|
Hi all,
Just started with GStudio and I'm trying to code some basic movement / environment manipulation scripts. I know there are templates for this sort of thing but it's helping me learn the basics. Anyway, I've a door entity that is rotated using a EVENT_CLICK and the script works just fine - that is, unless it's used in conjunction with my player movement script!
The problem seems to be that the movement script takes exclusive control of any mouse / keyboard input and mouse clicks just don't seem to register at all.
Any help would be appreciated! Thanks in advance, Jim.
** DOOR SCRIPT **
// DoorFunctions.wdl
function manipulateDoor() {
if(event_type == EVENT_CLICK) {
my.pan += 45; } }
action doorControls {
my.ENABLE_CLICK = ON; my.event = manipulateDoor; }
** PLAYER CONTROL SCRIPTS ** // PlayerControls.wdl
// ** Global variables var moveVector[3] = 0, 0, 0;
action playerControl { player = me;
wait(1); // ** Loop while player exists - check for keyboard / mouse input while(player != null) { // ************************************* // ** Control and update player movement moveVector[0] = ((key_w - key_s) * 4 * time); // ** Sets "reldist" vector that sets the // ** "direction" of the player's forward // ** / reverse movement moveVector[1] = ((key_a - key_d) * 2 * time); // ** Sets "reldist" vector that sets the // ** "direction" of the players strafing // ** movement player.pan -= (mouse_force.x * 8 * time); // ** Pans the camera - controls x-rotation // ** Tilts the camera while restricting the amount of tilt to + / - 75 degrees var newTilt = 0; var tempTilt = 0; tempTilt = (mouse_force.y * 8 * time); if((camera.tilt + tempTilt) > 75) { newTilt = 75; } else { if((camera.tilt + tempTilt) < -75) { newTilt = -75; } else { newTilt = (camera.tilt + tempTilt); } } ent_move(moveVector, NULLVECTOR); // ** Moves the player
vec_set(camera.x, player.x); // ** Moves the camera camera.pan = player.pan; // ** Rotates the camera camera.tilt = newTilt; // ** Tilts the camera
if(key_space == 1) { c_scan(camera.x, camera.pan, vector(10, 10, 200), SCAN_ENTS); } if(mouse_left == 1) { }
wait(1); } }
|
|
|
Re: C-Script problem...
[Re: JimmyJazz]
#167834
11/17/07 00:09
11/17/07 00:09
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
it could be mouse_mode ore mouse_range
"empty"
|
|
|
Re: C-Script problem...
[Re: JimmyJazz]
#167837
11/17/07 11:36
11/17/07 11:36
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
another try make and add a mouse_map and move the mouse wite
while(1) { mouse_pos.x += mouse_force.x; mouse_pos.y += mouse_force.y; wait(1); }
"empty"
|
|
|
|