Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (henrybane), 1,246 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: problem with script, please help. [Re: Pappenheimer] #314440
03/08/10 17:21
03/08/10 17:21
Joined: Mar 2010
Posts: 29
L
lollollollollol Offline OP
Newbie
lollollollollol  Offline OP
Newbie
L

Joined: Mar 2010
Posts: 29
Well the level will load, and the zombies i called up do fight against eachother... but im not playing as the character with the arrowkeys(or awsd). So i cant control any character, as the zombie_fight_against_eachother, just calls up two zombies, which fight against eachother and then loop their animations. So im not controlling the fighting zombies.

Short: How can i move a character with arrow keys (or awsd) while the camera follows me, as i thought the initial post was covering this?

Last edited by lollollollollol; 03/08/10 17:38.
Re: problem with script, please help. [Re: lollollollollol] #314452
03/08/10 18:13
03/08/10 18:13
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Changed my post, please read it again carefully.

Re: problem with script, please help. [Re: Pappenheimer] #314456
03/08/10 18:28
03/08/10 18:28
Joined: Mar 2010
Posts: 29
L
lollollollollol Offline OP
Newbie
lollollollollol  Offline OP
Newbie
L

Joined: Mar 2010
Posts: 29
ok so know i have :

Code:
#include <acknex.h>
#include <default.c>
#define walk_percentage skill11
#define STATE     skill1
#define STATE     skill1
#define ANIMATION skill2


////////////////////////////////////////////////////////////////////

BMAP* cursor_pcx = "cursor.pcx";
BMAP* crosshair_pcx = "crosshair.pcx";

////////////////////////////////////////////////////////////////////

function camera_follow(ENTITY* ent)
{
	while(1) 
	{
		vec_set(camera.x,vector(-150,10,50));  // camera position relative to the player      
		vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
		vec_add(camera.x,ent.x);      // add player position
		vec_set(camera.pan,vector(ent.pan,-10,0)); // look in player direction, slighty down      
		wait(1);
	}
}


action character_walking()
{ 
  camera_follow(me);
 
  VECTOR vFeet;
  vec_for_min(vFeet,me); // vFeet.z = distance from player origin to lowest vertex
  
  my.STATE = 1; 
  while (1)
  {
// state 1: walking ////////////////////////////////////////////
    if (my.STATE == 1)
    {
// rotate the entity with the arrow keys     
      my.pan += (key_cul-key_cur)*5*time_step;   

// move the entity forward/backward with the arrow keys
      var distance = (key_cuu-key_cud)*5*time_step;
      c_move(me, vector(distance,0,0), NULL, GLIDE);

// animate the entity    
      my.ANIMATION += 2*distance;
      ent_animate(me,"walk",my.ANIMATION,ANM_CYCLE);

// adjust entity to the ground height, using a downwards trace
      c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_ME | IGNORE_PASSABLE);
      my.z = hit.z - vFeet.z; // always place player's feet on the ground

    }
  }
}

    


function change_mouse_mode()
{
	mouse_mode += 1;
	mouse_mode %= 3;
	if (1 == mouse_mode)
		mouse_map = crosshair_pcx;
	if (2 == mouse_mode)
		mouse_map = cursor_pcx;
}

action zombie_bars()
{
	while (1)
	{
		my.walk_percentage += 2 * time_step; // 3 = animation speed 
		ent_animate(me, "attack", my.walk_percentage, ANM_CYCLE); // "attack" animation loop
		wait (1);
	}
}

action zombie_fight_against_eachother()
{
	while (1)
	{
		my.walk_percentage += 3 * time_step; // 3 = animation speed 
		ent_animate(me, "hit", my.walk_percentage, ANM_CYCLE); // "attack" animation loop
		wait (1);
	}
}
	action zombie_fight_against_eachotherr()
{
	while (1)
	{
		my.walk_percentage += 2.5 * time_step; // 3 = animation speed 
		ent_animate(me, "hit", my.walk_percentage, ANM_CYCLE); // "attack" animation loop
		wait (1);
	}
}

function main()
{
	video_mode = 7;
	level_load ("Huis.wmb");
	ent_create("zombiek.mdl",vector(293,-107,-55), zombie_bars);
   you = ent_create("zombiek.mdl",vector(0,0,0), character_walking);
	you = ent_create("zombiek.mdl",vector(425,106,-47), zombie_fight_against_eachother);
	you.pan= 60;
	you = ent_create("zombiek.mdl",vector(530,106,-47), zombie_fight_against_eachotherr);
	you.pan= 240;
	on_m = change_mouse_mode;
	while (1)
	{
		mouse_pos.x = mouse_cursor.x;
		mouse_pos.y = mouse_cursor.y;
		camera.pan -= mouse_force.x;
		camera.tilt += mouse_force.y;
		 
		wait (1);
	}
	camera.z = 120; // choose a convenient height
	camera.tilt = -15; // and tilt angle for the camera
}



And it will pass the compiling, but know it will fade to black, instead of shwowing my map. Any idea why?

Re: problem with script, please help. [Re: lollollollollol] #314459
03/08/10 18:45
03/08/10 18:45
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
In the while loop of the action 'character_walking', there was a 'wait(1);' missing, look at the following corrected code, please have a close look to place the 'wait(1);' within the curly brackets of the while loop, but not within the curly brackets of the if instruction.


Code:
action character_walking()
{ 
  camera_follow(me);
 
  VECTOR vFeet;
  vec_for_min(vFeet,me); // vFeet.z = distance from player origin to lowest vertex
  
  my.STATE = 1; 
  while (1)
  {
// state 1: walking ////////////////////////////////////////////
    if (my.STATE == 1)
    {
// rotate the entity with the arrow keys     
      my.pan += (key_cul-key_cur)*5*time_step;   

// move the entity forward/backward with the arrow keys
      var distance = (key_cuu-key_cud)*5*time_step;
      c_move(me, vector(distance,0,0), NULL, GLIDE);

// animate the entity    
      my.ANIMATION += 2*distance;
      ent_animate(me,"walk",my.ANIMATION,ANM_CYCLE);

// adjust entity to the ground height, using a downwards trace
      c_trace(my.x,vector(my.x,my.y,my.z-1000),IGNORE_ME | IGNORE_PASSABLE);
      my.z = hit.z - vFeet.z; // always place player's feet on the ground
    }

wait(1);

  }
}



Re: problem with script, please help. [Re: Pappenheimer] #314461
03/08/10 18:55
03/08/10 18:55
Joined: Mar 2010
Posts: 29
L
lollollollollol Offline OP
Newbie
lollollollollol  Offline OP
Newbie
L

Joined: Mar 2010
Posts: 29
Ahhh just found it out myself tongue thanks telling though... damn what a nooby mistake... thanks for your help !!!! really great!

Re: problem with script, please help. [Re: lollollollollol] #314462
03/08/10 18:55
03/08/10 18:55
Joined: Mar 2010
Posts: 29
L
lollollollollol Offline OP
Newbie
lollollollollol  Offline OP
Newbie
L

Joined: Mar 2010
Posts: 29
SOLVED!

Re: problem with script, please help. [Re: lollollollollol] #314470
03/08/10 20:00
03/08/10 20:00
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Phew! laugh

Page 2 of 2 1 2

Gamestudio download | chip programmers | 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