Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
4 registered members (AndrewAMD, fogman, Grant, juanex), 972 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
strange error message #350777
12/19/10 01:02
12/19/10 01:02
Joined: Dec 2010
Posts: 100
D
Dega Offline OP
Member
Dega  Offline OP
Member
D

Joined: Dec 2010
Posts: 100
Thank you for reading this. My problem is that I can't figure out how to make an entity (the monster bad guy) turn to the player entity and run forward until colliding and if the player moves back the entity moves to the player again. I would like to have a suggestion on code please and if you want me to post my code just say so.I have tried several codes that all don't seem to work. I am working on a school project over the break so I need a bunch of help which any is appreciated.

Re: strange error message [Re: Dega] #350782
12/19/10 01:19
12/19/10 01:19
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
Quad Online
Senior Expert
Quad  Online
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
so what about that error message? what kind of error do you get?

Last edited by Quadraxas; 12/19/10 01:19.

3333333333
Re: strange error message [Re: Quad] #350783
12/19/10 01:26
12/19/10 01:26
Joined: Dec 2010
Posts: 100
D
Dega Offline OP
Member
Dega  Offline OP
Member
D

Joined: Dec 2010
Posts: 100
That was an error message that appeared on the game screen and then somehow let the game start anyways when i entered this code for trying to get my problem solved. I apologize for not posting it earlier. Here it is and let me know if u need to see more code or if u can tell what should be done:


action monster_ai()
{
c_scan(me.x,360,vector(360,360,0),IGNORE_ME);
}

action operate_monsters_act()
{
grav_rule_act();
monster_ai();
}

action operate_player_act()
{
stand_player_act();
grav_rule_act();
move_forward_act();
turnl_act();
turnr_act();
camera_folo_func();
move_back_act();
}

function main()
{
level_load("prototype.wmb");
ent_create("player.mdl",vector(150,400,-400),operate_player_act);
ent_create("demon.mdl",vector(300,-1500,-395),operate_monsters_act);
}


boolean my.awesomeness = so true;
Re: strange error message [Re: Dega] #350785
12/19/10 01:57
12/19/10 01:57
Joined: Dec 2010
Posts: 100
D
Dega Offline OP
Member
Dega  Offline OP
Member
D

Joined: Dec 2010
Posts: 100
Also it said:SYS_CRASH:monster_ai();


boolean my.awesomeness = so true;
Re: strange error message [Re: Dega] #350786
12/19/10 02:27
12/19/10 02:27
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
at a guess you've got an empty pointer in monster_ai(), post the code for that function and the function that calls it too

Re: strange error message [Re: MrGuest] #350792
12/19/10 10:04
12/19/10 10:04
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
set
while(!me) wait(1);
at the beginning of your action.

Re: strange error message [Re: Widi] #350797
12/19/10 10:46
12/19/10 10:46
Joined: Sep 2003
Posts: 928
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 928
That obviously wont help because the wait is never executed.

Maybe you havent posted the whole code here, when your c_scan triggers an event on the player and the player is not set up yet that will cause a crash? Check your scan event function.

Or, insert a wait(1) - without the while(!me) - before the scanning, to be sure that the player is set up.

Re: strange error message [Re: Spirit] #350834
12/19/10 15:52
12/19/10 15:52
Joined: Dec 2010
Posts: 100
D
Dega Offline OP
Member
Dega  Offline OP
Member
D

Joined: Dec 2010
Posts: 100
Thank you for that piece of code it got rid of the error message and game works fine however I have a new question. How would you get the monster entity to face my player? I'm trying to get it to where he always runs to the player until colliding. I would appreciate any suggestions and here is all my code:

var walk_perc_var;
var max_hp_var = 100;
var health_var = max_hp_var;

STRING* health_str = "HP - ";

TEXT* health_txt =
{
pos_x = 0;
pos_y = 0;
string(health_str);
font = "ARIAL#18";
flags = SHOW;
}

PANEL* health_pan =
{
digits(32,0,4,"ARIAL#18",1,health_var);
flags = SHOW;
}



action grav_rule_act()
{
while(1)
{
c_move(me,vector(0,0,-2),NULL,GLIDE);
wait(1);
}
}

function camera_folo_func()
{
while(1)
{
vec_set(camera.x,vector(-150,0,150));
vec_rotate(camera.x,me.pan);
vec_add(camera.x,me.x);
vec_set(camera.pan,vector(me.pan,-20,0));
wait(1);
}
}

action stand_player_act()
{
while(1)
{
while(!on_anykey)
{
ent_animate(me,"stand 0",walk_perc_var,ANM_CYCLE);
walk_perc_var += 10 * time_step;
wait(1);
}
}
}

action turnr_act()
{
while(1)
{
while(key_cur)
{
my.pan -= 10*time_step;
wait(1);
}

wait(1);
}
}

action turnl_act()
{
while(1)
{
while(key_cul)
{
my.pan += 10*time_step;
wait(1);
}

wait(1);
}
}

action move_back_act()
{
while(1)
{
while(key_cud)
{
ent_animate(me,"walk",walk_perc_var,ANM_CYCLE);
walk_perc_var += 10 * time_step;
c_move(me,vector(-15*time_step,0,0),NULL,GLIDE);
wait(1);
}
wait(1);
}
}


action move_forward_act()
{
while(1)
{
while(key_cuu)
{
ent_animate(me,"walk",walk_perc_var,ANM_CYCLE);
walk_perc_var += 10 * time_step;
c_move(me,vector(15*time_step,0,0),NULL,GLIDE);
wait(1);
}
wait(1);
}
}

action monster_ai()
{
while(!me)
{
c_scan(me.x,360,vector(360,360,0),IGNORE_ME);
}
}

action operate_monsters_act()
{
grav_rule_act();
monster_ai();
}

action operate_player_act()
{
stand_player_act();
grav_rule_act();
move_forward_act();
turnl_act();
turnr_act();
camera_folo_func();
move_back_act();
}

function main()
{
level_load("prototype.wmb");
ent_create("player.mdl",vector(150,400,-400),operate_player_act);
ent_create("demon.mdl",vector(300,-1500,-395),operate_monsters_act);
}


boolean my.awesomeness = so true;
Re: strange error message [Re: Dega] #350960
12/20/10 16:42
12/20/10 16:42
Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
Nowherebrain Offline
Serious User
Nowherebrain  Offline
Serious User

Joined: Jul 2005
Posts: 1,002
Trier, Deutschland
that is a bunch of actions...try using only 2 actions....

1 for the player, and one for the enemy. if you are going to call on piece of code repeatedly by different entities, like gravity for instance. You can set that in a separate "function" and then call that from the entity actions. If you do not understand what I mean, than you should go through the workshops again....also read the AUM's starting from around 67 or so....I think that is when lite-c was launched...correct me if I am wrong.

Last edited by Nowherebrain; 12/20/10 16:51.

Everybody Poops.
here are some tutorials I made.
http://www.acknexturk.com/blender/

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