Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (7th_zorro), 793 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
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 Offline OP
Member
Damarus  Offline 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: Damarus] #105144
01/03/07 16:55
01/03/07 16:55
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
As far as i know there is no Move command. It is the old ent_move or c_move to move the entity. Also you dont need the <test_object.mdl>=me because you are assigning the action to the player in WED.

Re: Need help with a little script [Re: demiGod] #105145
01/03/07 17:00
01/03/07 17:00
Joined: Apr 2004
Posts: 258
Canada, Nova Scotia
Damarus Offline OP
Member
Damarus  Offline OP
Member

Joined: Apr 2004
Posts: 258
Canada, Nova Scotia
ok, I changed those things (removed MOVE(...) and <test_...> = me; but i still don't see anything once I run the lvl, is there a line of code I missed or something?

Re: Need help with a little script [Re: Damarus] #105146
01/03/07 17:10
01/03/07 17:10
Joined: Mar 2006
Posts: 752
Portugal
demiGod Offline
User
demiGod  Offline
User

Joined: Mar 2006
Posts: 752
Portugal
What do you mean by dont see anything? What level are you running? Do you have a hollow block surrounding your level? It gives some error? Be more precise.

Re: Need help with a little script [Re: demiGod] #105147
01/03/07 17:19
01/03/07 17:19
Joined: Apr 2004
Posts: 258
Canada, Nova Scotia
Damarus Offline OP
Member
Damarus  Offline OP
Member

Joined: Apr 2004
Posts: 258
Canada, Nova Scotia
sry, ok, I got a hollow block large, I scaled it a little bigger but not to big, added the default tex on it, created a little block in med, added the block in the lvl and moved it inside the block then I assigned the above action.

After I pressed built and run, I only see a black window.

Re: Need help with a little script [Re: Damarus] #105148
01/03/07 17:29
01/03/07 17:29
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
sounds like your camera is sticking inside of one of the walls.

Try either to press "0" (zero) and move around with the Cursor Keys and the mouse or add a "Position" somewhere in your level where you should see something.

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 Offline
User
demiGod  Offline
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 Offline
Member
nipx  Offline
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 Offline OP
Member
Damarus  Offline 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 Offline
Member
nipx  Offline
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.
Page 1 of 2 1 2

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1