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
3 registered members (TipmyPip, OptimusPrime, AndrewAMD), 14,882 guests, and 6 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
Page 1 of 2 1 2
Learning gamestudio A7 #365610
03/27/11 20:15
03/27/11 20:15
Joined: Mar 2010
Posts: 56
Hertfordshire, England
Panda_Dude Offline OP
Junior Member
Panda_Dude  Offline OP
Junior Member

Joined: Mar 2010
Posts: 56
Hertfordshire, England
This is about A7, so I thought I'd post it here. I have some script and I don't know what's wrong. I have checked with the tutorial and I don't think I've missed anything. Would someone mind going through my script? I'm sure it's probably something simple.
Code:
#include <acknex.h>
#include <default.c>

var health = 200;
BMAP* panel = "panel.bmp";
BMAP* healthbar = "window.bmp";
BMAP* knob = "slider.bmp";
STRING* s_health = "Health";
ENTITY* car1 = "car1.mdl";

TEXT* t_health =
{
	pos_x = 44;
	pos_y = 22;
	layer = 10;
	string (s_health);
	FLAGS = SHOW;
}

function main ()
{
	level_load("room.wmb");
	vec_set(camera.x, vector(16,447,358));
	vec_set(camera.pan,vector(90,-89,0));
	screen_size.x = 500;
	screen_size.y = 500;
	screen_color.green = 150;
	mouse_mode = 4;
}

PANEL* first_panel =
{
	BMAP = panel;
	window(40,10,50,3,healthbar,health,NULL);
	digits(7,12,3,"Arial#15",1,health);
	vslider(7,52,31,knob,200,0,health);
	FLAGS = OVERLAY | SHOW | OUTLINE;
}

action* car =
{
	car1 = me;
	while (1)
	{
		if (key_a)
			my.pan -= 3 * time_step;
		if (key_d)
			my.pan += 3 * time_step;
		if (key_w)
		        c_move(car1,vector(5 * time_step,0,0),nullvector,GLIDE);
		if (key_s)
			c_move(car1,vector(5 * time_step,0,0),nullvector,GLIDE);
	}
}


The script won't even start running. I don't know what's wrong exactly, but I'm pretty sure it's to do with the car 1 action. Thanks for any help!

Last edited by Panda_Dude; 03/27/11 20:16.
Re: Learning gamestudio A7 [Re: Panda_Dude] #365613
03/27/11 20:21
03/27/11 20:21
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
"action car()", not "action* car =" laugh

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Learning gamestudio A7 [Re: JibbSmart] #365614
03/27/11 20:23
03/27/11 20:23
Joined: Mar 2010
Posts: 56
Hertfordshire, England
Panda_Dude Offline OP
Junior Member
Panda_Dude  Offline OP
Junior Member

Joined: Mar 2010
Posts: 56
Hertfordshire, England
oh yeah... I got mixed up. I have corrected it and the script runs, but the car won't move...? Thanks for the quick response! grin

Last edited by Panda_Dude; 03/27/11 20:25.
Re: Learning gamestudio A7 [Re: Panda_Dude] #365615
03/27/11 20:32
03/27/11 20:32
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
No worries laugh
There should be a "wait(1);" in the while loop so it gets to the next frame.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Learning gamestudio A7 [Re: JibbSmart] #365616
03/27/11 20:34
03/27/11 20:34
Joined: Mar 2010
Posts: 56
Hertfordshire, England
Panda_Dude Offline OP
Junior Member
Panda_Dude  Offline OP
Junior Member

Joined: Mar 2010
Posts: 56
Hertfordshire, England
so like this?
Code:
action car()
{
	car1 = me;
	while (1)
	{
		if (key_a)
			my.pan -= 3 * time_step;
		if (key_d)
			my.pan += 3 * time_step;
		if (key_w)
			c_move(car1,vector(5 * time_step,0,0),nullvector,GLIDE);
		if (key_s)
			c_move(car1,vector(5 * time_step,0,0),nullvector,GLIDE);
	}
	wait (1);
}


It still doesn't move the car. Or do I do the wait (1) inside the parenthesis for the while? I tried both and it doesn't move the car. confused

Last edited by Panda_Dude; 03/27/11 20:37.
Re: Learning gamestudio A7 [Re: Panda_Dude] #365617
03/27/11 20:43
03/27/11 20:43
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Inside the braces.

What happens is: the while loop happens infinitely, without giving other functions/rendering/everything else a chance to happen, so "wait (1);" tells the engine to wait until the next frame before continuing.

Lastly (I think), I just realised, you're using a view entity, which I believe can't use c_move and the like. Use ent_create instead to put your entity in the level.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Learning gamestudio A7 [Re: JibbSmart] #365618
03/27/11 20:45
03/27/11 20:45
Joined: Mar 2010
Posts: 56
Hertfordshire, England
Panda_Dude Offline OP
Junior Member
Panda_Dude  Offline OP
Junior Member

Joined: Mar 2010
Posts: 56
Hertfordshire, England
ok I'll try that then. What is a view entity?
and also, do I still have to define the entity and attach the action to it? can I change the action to a function and put that in the ent_create parameters?

Last edited by Panda_Dude; 03/27/11 20:53.
Re: Learning gamestudio A7 [Re: Panda_Dude] #365619
03/27/11 20:57
03/27/11 20:57
Joined: May 2010
Posts: 117
Germany , Dortmund
B
Bone Offline
Member
Bone  Offline
Member
B

Joined: May 2010
Posts: 117
Germany , Dortmund
I think you have to load your model with ent_create()

ENTITY* car1 = ent_create("car1.mdl", nullvector, car);

nullvector is the position for your model and the last parameter (car) call
the entity to use the action car

Re: Learning gamestudio A7 [Re: Panda_Dude] #365620
03/27/11 20:57
03/27/11 20:57
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Actually, I just got confused about the view entity thing. Is your car placed manually in WED? Make sure it has been given the "car" action.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: Learning gamestudio A7 [Re: JibbSmart] #365621
03/27/11 21:01
03/27/11 21:01
Joined: Mar 2010
Posts: 56
Hertfordshire, England
Panda_Dude Offline OP
Junior Member
Panda_Dude  Offline OP
Junior Member

Joined: Mar 2010
Posts: 56
Hertfordshire, England
Well I know where the problem lies there... I can't seem to get the list of actions populated. There are no actions to select. I have selected the script from the map properties section but the action I created isn't available.
EDIT: ok, I selected the action from the list for the car, but the car still won't move.

Last edited by Panda_Dude; 03/27/11 21:05.
Page 1 of 2 1 2

Moderated by  HeelX 

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