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,649 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 3 of 5 1 2 3 4 5
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 Offline OP
Junior Member
Panda_Dude  Offline 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...) frown
Code:
#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 Offline
Expert
FoxHound  Offline
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: FoxHound] #367186
04/10/11 18:10
04/10/11 18:10
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
I thought that was what the 'switch (my.state)' bit was for. When the enemy is created I give it the function state_wait. When the if condition of that function is fulfilled, surely it would change to case 2 - function state_attack?

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 Offline
Expert
FoxHound  Offline
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 Offline OP
Junior Member
Panda_Dude  Offline OP
Junior Member

Joined: Mar 2010
Posts: 56
Hertfordshire, England
so something along the lines of
Code:
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 Offline
Expert
FoxHound  Offline
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 Offline OP
Junior Member
Panda_Dude  Offline OP
Junior Member

Joined: Mar 2010
Posts: 56
Hertfordshire, England
wow.. I got something right! That must be a sign tongue
I tried that. Doesn't work confused .
Code:
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 Offline
Expert
FoxHound  Offline
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 Offline
Expert
FoxHound  Offline
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!
Re: Yet another question.. [Re: FoxHound] #367245
04/11/11 07:39
04/11/11 07:39
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 I use vec_to_angle to change the angle of the enemy and then give the enemy a relative speed forwards. That makes sense, but I don't quite understand vec_to_angle. The manual doesn't explain it enough. Would you explain? laugh

Last edited by Panda_Dude; 04/11/11 08:01.
Page 3 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