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
1 registered members (TipmyPip), 18,633 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
Page 2 of 5 1 2 3 4 5
Re: Yet another question.. [Re: Panda_Dude] #367017
04/08/11 19:27
04/08/11 19:27
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
when you write a #define, the compiler reads what you have put on the left part, and reads it as if you have put the thing from the right. So you can do this:

Code:
#define number 2



Then when you write number on your code, the complier will read it as a 2

Last edited by painkiller; 04/08/11 19:27.

3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Yet another question.. [Re: painkiller] #367019
04/08/11 19:34
04/08/11 19: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 in the example I posted, the engine would read skill1 as STATE?
Anyway, why does the error code say "'state' : is not a member of 'ENTITY'". What does this mean?
I have tried switching wherever I wrote STATE to skill1 and the script now runs. Was this the right thing to do?

Last edited by Panda_Dude; 04/08/11 19:53.
Re: Yet another question.. [Re: Panda_Dude] #367020
04/08/11 20:09
04/08/11 20:09
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
you should have used state, not STATE


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Yet another question.. [Re: painkiller] #367023
04/08/11 20:26
04/08/11 20:26
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
The system is case sensitive. So my.State , my.STATE, my.state and my.StAtE are 4 different things as far as the compiler is concerned.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Re: Yet another question.. [Re: Panda_Dude] #367048
04/09/11 06:51
04/09/11 06:51
Joined: Apr 2011
Posts: 1
2
2424 Offline
Guest
2424  Offline
Guest
2

Joined: Apr 2011
Posts: 1
Thank you very much.


ragnarok ragnarok
Re: Yet another question.. [Re: 2424] #367050
04/09/11 07:21
04/09/11 07:21
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 remember that. Thanks. laugh

Re: Yet another question.. [Re: Panda_Dude] #367051
04/09/11 07:58
04/09/11 07:58
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 what I have so far.
Code:
#define state skill1

var movement;
var allow_fire;
var p_angle;
ENTITY* enemy = "enemy.mdl";

function state_wait ()
{
	while (1) c_move (me, nullvector, nullvector, 0);
	c_scan (my.x,my.pan, vector (360,0,1000), SCAN_ENTS | IGNORE_ME);
	if (event_type =EVENT_SCAN) my.state = 2;
	wait (1);
}
function state_attack ()
{
	if (my.state == 2)
	{
		while(1) c_move(me,vector(player.x,player.y,0), nullvector,GLIDE);
	}
}

action enemy_act ()
{
        enemy = my;
	my.state = 1;
	while (my)
	{
		switch (my.state)
		{
			case 1: state_wait(); break;
			case 2: state_attack(); break;
		}
	}
}


But for some reason the enemy doesn't move towards the player when the player is in proximity of the enemy. Does everyone have this much trouble when they start to learn or is it just me? confused

Last edited by Panda_Dude; 04/09/11 08:07.
Re: Yet another question.. [Re: Panda_Dude] #367097
04/09/11 20:05
04/09/11 20:05
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? What's wrong? confused

Re: Yet another question.. [Re: Panda_Dude] #367105
04/09/11 21:44
04/09/11 21:44
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Your code is horrible.

if (event_type =EVENT_SCAN) --> is always true.
if (event_type ==EVENT_SCAN) --> and set this in a event function.

In your action enemy_act you have a switch (my.state), if it is 2 you call the function state_attack() and here you check my.status again? And also the while(1) is not the best solution.

In your action you call state_attack always if my.state = 2 and the while(1) loop never ends, so every frame starts one more of your function state_attack.

Re: Yet another question.. [Re: Widi] #367115
04/09/11 22:29
04/09/11 22:29
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
FoxHound Offline
Expert
FoxHound  Offline
Expert

Joined: Jun 2004
Posts: 2,234
Wisconsin USA
You are missing a set of brackets for the while loop. Plus what Widi said. And yes everyone has problems when they first start out. I spent my first 100 posts asking questions and the next 1900 helping people out.


---------------------
There is no signature here.


QUIT LOOKING FOR ONE!
Page 2 of 5 1 2 3 4 5

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