1 registered members (TipmyPip),
18,631
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
Serious User
|
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: 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
OP
Junior Member
|
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
Serious User
|
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
Expert
|
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
2424
Guest
|
Guest
Joined: Apr 2011
Posts: 1
|
|
|
|
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
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2010
Posts: 56
Hertfordshire, England
|
This is what I have so far.
#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?
Last edited by Panda_Dude; 04/09/11 08:07.
|
|
|
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
Expert
|
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!
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|