1 registered members (7th_zorro),
793
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Need help with a little script
#105143
01/03/07 16:45
01/03/07 16:45
|
Joined: Apr 2004
Posts: 258 Canada, Nova Scotia
Damarus
OP
Member
|
OP
Member
Joined: Apr 2004
Posts: 258
Canada, Nova Scotia
|
hello guys,
my bro and me try to learn 3dgs and I am currently working on c-script and ran into a little problem. I tried to make a little movement script but it doesn't really work or at least I think it doesn't The thing I wanted to do is to let the player only change the motion up and down and the object was supposed to move straight ahead at all times.
the problem, after I created a little testlevel (just one block and one .mdl to asign the action) I put in the script and assinged the action to the mdl. after I started the lvl, however, everything was black, can someone give me a hint on how I should change the script to make it work? here is the script: //////////////////////////////////////////////////////////////////////// // A6 main wdl: // Created by WED. ////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////// // The PATH keyword gives directories where template files can be found. path "C:\\Program Files\\GStudio6\\template_6"; // Path to A6 templates directory path "C:\\Program Files\\GStudio6\\template_6\\code"; // Path to A6 template code subdirectory path "C:\\Program Files\\GStudio6\\template_6\\images"; // Path to A6 template image subdirectory path "C:\\Program Files\\GStudio6\\template_6\\sounds"; // Path to A6 template sound subdirectory path "C:\\Program Files\\GStudio6\\template_6\\models"; // Path to A6 template model subdirectory
///////////////////////////////////////////////////////////////// // Filename of the starting level.
....
////////////////////////////////////////////////////////// // Actions ////////////////////////////////////////////////////////// var dist[3];
action player_move { <test_object.mdl> = me; While (1) { dist.x = 10 * mouse_force.x; dist.y = 10 * mouse_force.y; dist.z = 10; Move(MY,nullvector,dist); wait(1); } } // thats the stuff I wrote ///////////////////////////////////////////////////////////////// //INCLUDE <debug.wdl>;
I hope somebody can help me. by the way, I tried to use mouse_force to use the mouse to move the object, I also changed mouse_mode in the function main part to 1 but I didn't included it in this post due to the length.
thx
|
|
|
Re: Need help with a little script
[Re: Xarthor]
#105149
01/03/07 17:30
01/03/07 17:30
|
Joined: Mar 2006
Posts: 752 Portugal
demiGod
User
|
User
Joined: Mar 2006
Posts: 752
Portugal
|
Did you assigned a script file (template) in wed properties? Press 0(zero) button and try to navigate or go outside the model with the camera. Also there is much tutorials and resources all around here, search for simple workshops to start with. Hope it helps. EDIT: Oops, Thunder was faster
Last edited by demiGod; 01/03/07 17:32.
|
|
|
Re: Need help with a little script
[Re: Damarus]
#105150
01/03/07 17:35
01/03/07 17:35
|
Joined: Dec 2005
Posts: 252 MyOwnKingdom
nipx
Member
|
Member
Joined: Dec 2005
Posts: 252
MyOwnKingdom
|
Its probably because the camera is IN your block Code:
action blahblah { var vecMovement[3];
while(1) { vecMovement.x = 10 * mouse_force.x * time_step; //time_step for smooth movement vecMovement.y = 10 * mouse_force.y * time_step;
//move the block c_move(me, vecMovement, nullvector, glide); wait(1); } }
this code should work nipx edit: and Im THE slowest
|
|
|
Re: Need help with a little script
[Re: demiGod]
#105151
01/03/07 18:06
01/03/07 18:06
|
Joined: Apr 2004
Posts: 258 Canada, Nova Scotia
Damarus
OP
Member
|
OP
Member
Joined: Apr 2004
Posts: 258
Canada, Nova Scotia
|
var dist[3];
action rocket_move { While (1) { dist.y = 10 * mouse_force.x; dist.z = 10 * mouse_force.y; ent_move(dist,nullvector); wait(1); } }
I don't see the black screen anymore but I still need to set the camera onto the model itself, right now, I move the model as intended up, donw, left right.
do I have to use my.camera for a first person camera at the model?
EDIT": Thx for the code, it is a little bit better than mine but I still am not the block but can only see it as a third person
Last edited by Damarus; 01/03/07 18:16.
|
|
|
Re: Need help with a little script
[Re: Damarus]
#105152
01/03/07 19:30
01/03/07 19:30
|
Joined: Dec 2005
Posts: 252 MyOwnKingdom
nipx
Member
|
Member
Joined: Dec 2005
Posts: 252
MyOwnKingdom
|
ok for an absolute simple camera: Code:
//place this code right after your movement (c_move or ent_move)
//it sets the camera.x and camera.y at the position the me entity (rocket or player) is //and the camera.z 35 quants above your player/rocket vec_set(camera.x, vector(my.x, my.y, my.z+35));
//set the same angles as the me entity (player/rocket) vec_set(camera.pan, me.pan);
edit: to make the rocket invisible for the camera use Code:
camera.genius=me; (place it at the beginning of your action) look this stuff up in the manual to see what your exactly doing didnt test it but it should work and dont forget to use time_smooth in your dist.x = .... * time_smooth nipx
Last edited by nipx; 01/03/07 19:33.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|