Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,561 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
can someone correct this code? #373236
06/08/11 16:27
06/08/11 16:27
Joined: Jun 2011
Posts: 22
Germany
B
Bennett Offline OP
Newbie
Bennett  Offline OP
Newbie
B

Joined: Jun 2011
Posts: 22
Germany
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

#define STATE     skill1

function main()
{
	level_load("Puschel.wmb"); 	
}

function camera_follow(ENTITY* ent)
{
	while(1) 
	{
		vec_set(camera.x,vector(-150,10,50));  // camera position relative to the player      
		vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
		vec_add(camera.x,ent.x);      // add player position
		vec_set(camera.pan,vector(ent.pan,-10,0)); // look in player direction, slighty down      
		wait(1);
	}
}

action puschel();
{
	camera_follow(me)
	
	VECTOR vFeet;
	vec_for_min(vFeet,me); // vFeet.z = distance from player origin to lowest vertex
	my.STATE = 1;
	
	while (1);
	{
// state 1: walking ////////////////////////////////////////////
		if (my.STATE == 1);
		{
// rotate the entity with the arrow keys     
			my.pan += (key_cul-key_cur)*5*time_step;   

// move the entity forward/backward with the arrow keys
			var distance = (key_cuu-key_cud)*5*time_step;
			c_move(me, vector(distance,0,0), NULL, GLIDE);
					my.z = hit.z - vFeet.z; // always place player's feet on the ground
						wait(1);
			}
		}	
}



Last edited by JustSid; 06/09/11 16:09. Reason: Added code tags
Re: can someone correct this code? [Re: Bennett] #373242
06/08/11 16:53
06/08/11 16:53
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
We don't know what you want this code to do, you need to tell us what's wrong with it before we can fix it.

Just by looking at this though I can tell you though that you've got two improperly placed semicolons in the puschel action, one after the "while (1)" and another after "(my.STATE == 1)". You need to remove those.

EDIT: Upon further inspection you also need to remove the semicolon after "action puschel()" and replace the "NULL" parameter in your c_move call to "nullvector".

Last edited by Redeemer; 06/08/11 17:13.

Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: can someone correct this code? [Re: Redeemer] #373249
06/08/11 17:48
06/08/11 17:48
Joined: Jun 2011
Posts: 22
Germany
B
Bennett Offline OP
Newbie
Bennett  Offline OP
Newbie
B

Joined: Jun 2011
Posts: 22
Germany
Thank you very much, that already looks better!

it is simply supposed to allow me to control a model in 3rd person.

On startup, it now shows:

syntax error
<VECTOR vFeet>

Re: can someone correct this code? [Re: Bennett] #373258
06/08/11 18:55
06/08/11 18:55
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline
Serious User
pegamode  Offline
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
There's a semicolon missing in the line before "VECTOR vFeet;":

camera_follow(me)

Re: can someone correct this code? [Re: pegamode] #373261
06/08/11 19:29
06/08/11 19:29
Joined: Jun 2011
Posts: 22
Germany
B
Bennett Offline OP
Newbie
Bennett  Offline OP
Newbie
B

Joined: Jun 2011
Posts: 22
Germany
Thank you, but now I get an error one line later...
I'm a beginner with Lite-C grin

Re: can someone correct this code? [Re: Bennett] #373262
06/08/11 19:33
06/08/11 19:33
Joined: Jun 2011
Posts: 22
Germany
B
Bennett Offline OP
Newbie
Bennett  Offline OP
Newbie
B

Joined: Jun 2011
Posts: 22
Germany
Okay, it was another semicolon missing...
It starts now


Gamestudio download | 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