1 registered members (TipmyPip),
18,631
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Yet another question..
[Re: Panda_Dude]
#367138
04/10/11 11:24
04/10/11 11:24
|
Joined: Mar 2010
Posts: 56 Hertfordshire, England
Panda_Dude
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2010
Posts: 56
Hertfordshire, England
|
ok, so let me try to get this straight... The switch command switches the case according to the state of the entity... ? So in the enemy_act action case 1 is assigned to function state_wait. When the condition in function state_wait is fulfilled I need to change my.state to 2, so that case 2 is active? Is that right? Is this script better? (obviously not, because it still doesn't work...)
#define state skill1
var movement;
var allow_fire;
var p_angle;
ENTITY* enemy = "enemy.mdl";
function state_wait ()
{
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;
}
function state_attack ()
{
{
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;
}
wait (1);
}
}
|
|
|
Re: Yet another question..
[Re: Panda_Dude]
#367184
04/10/11 17:58
04/10/11 17:58
|
Joined: Jun 2004
Posts: 2,234 Wisconsin USA
FoxHound
Expert
|
Expert
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
|
That first c_move is not needed because it does not move the player. I also see a missisg if in that second function and when do you even call the second function?
--------------------- There is no signature here.
QUIT LOOKING FOR ONE!
|
|
|
Re: Yet another question..
[Re: Panda_Dude]
#367189
04/10/11 18:29
04/10/11 18:29
|
Joined: Jun 2004
Posts: 2,234 Wisconsin USA
FoxHound
Expert
|
Expert
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
|
My iPhone didn't display that part so I never saw that code. Try removing that and using if else code and see what happens.
--------------------- There is no signature here.
QUIT LOOKING FOR ONE!
|
|
|
Re: Yet another question..
[Re: FoxHound]
#367200
04/10/11 19:26
04/10/11 19:26
|
Joined: Mar 2010
Posts: 56 Hertfordshire, England
Panda_Dude
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2010
Posts: 56
Hertfordshire, England
|
so something along the lines of
action player_act ()
{
if (my.state == 2)
{
state_attack () // call the action
}
}
And so on?
Last edited by Panda_Dude; 04/10/11 21:03.
|
|
|
Re: Yet another question..
[Re: Panda_Dude]
#367205
04/10/11 20:05
04/10/11 20:05
|
Joined: Jun 2004
Posts: 2,234 Wisconsin USA
FoxHound
Expert
|
Expert
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
|
Yes. The next one should just be else{. }. So you know the other option has to happen no matter what
--------------------- There is no signature here.
QUIT LOOKING FOR ONE!
|
|
|
Re: Yet another question..
[Re: FoxHound]
#367217
04/10/11 20:57
04/10/11 20:57
|
Joined: Mar 2010
Posts: 56 Hertfordshire, England
Panda_Dude
OP
Junior Member
|
OP
Junior Member
Joined: Mar 2010
Posts: 56
Hertfordshire, England
|
wow.. I got something right! That must be a sign I tried that. Doesn't work  .
action state_wait ()
{
c_scan ( my.x,my.pan, vector ( 360,0,1000 ), SCAN_ENTS | IGNORE_ME );
if (event_type ==EVENT_SCAN) my.state = 2;
}
action state_attack ()
{
c_move( me,vector( player.x,player.y,0 ), nullvector,GLIDE );
}
action enemy_act ()
{
enemy = my;
my.state = 1;
while( my )
{
if (my.state == 2)
{
state_attack ();
}
else
{
state_wait ();
}
wait (1);
}
}
To be honest, I'm not even sure if the action is attached to the entity properly...
Last edited by Panda_Dude; 04/10/11 21:05.
|
|
|
Re: Yet another question..
[Re: Panda_Dude]
#367221
04/10/11 21:12
04/10/11 21:12
|
Joined: Jun 2004
Posts: 2,234 Wisconsin USA
FoxHound
Expert
|
Expert
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
|
Put beep(); in the beginning of the while loop. You will know if it's running.
--------------------- There is no signature here.
QUIT LOOKING FOR ONE!
|
|
|
Re: Yet another question..
[Re: FoxHound]
#367222
04/10/11 21:16
04/10/11 21:16
|
Joined: Jun 2004
Posts: 2,234 Wisconsin USA
FoxHound
Expert
|
Expert
Joined: Jun 2004
Posts: 2,234
Wisconsin USA
|
Now that I have figured out how to use this iPhone a bit better I think you should learn how to use c_move a bit better. Put the players position in it will not make it go to the players position. Look up vec_to_angel while your at it.
--------------------- 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
|