|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Doug, if you answer this you could save a potentially great new game.
#6185
07/27/01 12:56
07/27/01 12:56
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
I have been developing a totally different new game whos gameplay should be as addicting as the old game Lemmings. I am having a major problem though and I can't seem to get an answer from anyone. I am trying to assign an action to multiple different entities, however, when I try to add a synonym to define the entity action, then I can only assign the action to one entity. If I assign to more than one, than only the most recently created and assigned entity functions the way it should. How can I assign the action with the same synonym to more than one entity. Both me and AcidCrow have been battling this problem for around a week or so and we can't find the problem. Any help would be much appreciated. Thank you. Oh, and you can read about this new game at my website: http://warewolfstudios.netfirms.com (check it out. You should be pleasantly surprised.)
|
|
|
Re: Doug, if you answer this you could save a potentially great new game.
#6186
07/27/01 15:12
07/27/01 15:12
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Are you using any Variables in your action, remember all entities assigned to your action will use the one set of variables, always use the Entities MY.skills if you can, this will allow all entities to keep track of themselves, not just the last one. Hope this makes sence. Jethro.
|
|
|
Re: Doug, if you answer this you could save a potentially great new game.
#6187
07/27/01 15:57
07/27/01 15:57
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
No, I'm using skills already. Variables just get reset all the time. I'm also only using maybe one skill. I'm using my._state most of the time for the entities.
|
|
|
Re: Doug, if you answer this you could save a potentially great new game.
#6188
07/27/01 16:07
07/27/01 16:07
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Heres the code if it helps you find an answer: function bucky_stand() { while(my._state == _bucky_stand){ ent_cycle("stand",my.skill14); my.skill14 += animation_speed *TIME; if(my.skill14>100){my.skill14 = 0;} wait(1); } bucky_pop(); } function bucky_pop() { while(my._state == _bucky_pop){ ent_cycle("attack",my.skill14); my.skill14 +=animation_speed *TIME; if(my.skill14>100){my.skill14 = 0;} wait(1); } bucky_stand(); } function mystate_spook() { while(my._state == _cow_spook){ if(vec_dist(my.x,ent3_syn.x)>400){ent3_syn._state = _bucky_stand;my._state = _cow_look;} temp.x = my.x - ent3_syn.x; temp.y = my.y - ent3_syn.y; temp.z = my.z - ent3_syn.z; vec_to_angle(my_angle,temp); actor_turn(); force = 2; actor_move(); wait(1); } mystate_look(); } function mystate_flee() { while(cow._state == _cow_flee){ temp.x = my.x - player.x; temp.y = my.y - player.y; temp.z = my.z - player.z; vec_to_angle(my_angle,temp); actor_turn(); if(vec_dist(my.pos,player.pos)>150){mystate = _cow_look;break;} // walk away force = 1.4; actor_move(); wait(1); } mystate_look(); } function mystate_look() { while(cow._state == _cow_look){ if(ent3_syn == null){wait(1);} if(ent2_syn == null){wait(1);} if(cow == null){wait(1);} if(vec_dist(my.x,ent3_syn.x)<=100){my._state = _cow_spook;ent3_syn._state = _bucky_pop;mystate_spook();} if(vec_dist(my,player.x)<=150){mystate = _cow_flee;mystate_flee();} if(vec_dist(my.x,ent2_syn.x)<=300{beep;} wait(1); } } action cow_move { exclusive_entity(); my._walkframes = 1; my._entforce = 0.7; my._health = 10; my.enable_scan = on; my.enable_click = on; drop_shadow(); my.event = event_detect; my._state = _cow_look; mystate_look(); //look function } action bucky_trap { exclusive_entity(); my._walkframes = 1; my._entforce = 0.7; my._health = 10; ent3_syn = me; //1=monster 2=food 3=trap my.enable_scan = on; my._state = _bucky_stand; bucky_pop(); my.skill14 = 0; } action food { ent2_syn = me; // 1=monster 2=food 3=trap }
|
|
|
Re: Doug, if you answer this you could save a potentially great new game.
#6189
07/28/01 07:24
07/28/01 07:24
|
Joined: Mar 2001
Posts: 1,825 London, England
Keith B [Ambit]
Expert
|
Expert
Joined: Mar 2001
Posts: 1,825
London, England
|
Hi, I could see you might have a problem if more than one entity is assigned to ent2_syn, ent3_syn etc, because before you do the vec_dist checks you don't define *which* ent2_syne etc you are referring to. For instance, in this line: if(vec_dist(my.x,ent3_syn.x)>400){ent3_syn._state = _bucky_stand;my._state = _cow_look;} ent3_syn's state is being altered, but as you don't define which ent3_syn, the engine would probably set the last assigned ent3_syn to _bucky_stand rather than the one to which you are nearest... If this is your problem the way around it is to do a scan or a trace - probably a scan if you want 360 degrees of being noticed - so that you can use the more specific "you" synonym when referring to the nearest entity. You could also use a skill instead of a synonym, such as my._type = ent3_syn, and then you could have something like: if(vec_dist(my.x,you.x)>400)&&(you._type==ent3_syn)... Hope that helps - I could be totally wrong, but that's just from first glance. Cheers, Keith
|
|
|
Re: Doug, if you answer this you could save a potentially great new game.
#6190
07/28/01 11:02
07/28/01 11:02
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
damn. . . i had a nice long reply for you, then i lost it. not willing to retype it. basically, use the my.entity1 rather than a synonym, this way with multiple instances of the same entity, it will store the 'synonym' locally, rather than globablly, so that each entity can have stored a different synonym.
|
|
|
Re: Doug, if you answer this you could save a potentially great new game.
#6191
07/31/01 05:42
07/31/01 05:42
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Hey, guys. I totally rewrote the code. I haven't tried it yet so let me know if it's going to work for what I want: //variables, state, and skill definitions var animation_speed = 6; define _cow_look,1; //cow_move states define _cow_spook,2; define _cow_flee,3; define ent1_syn,4; // ent1 = monster, ent2 = food, ent3 = trap define ent2_syn,5; define ent3_syn,6; define _bucky_stand,7; //bucky_trap states define _bucky_pop,8; //functions for bucky_trap function bucky_stand { //bucky "stand" animation while(my._state == _bucky_stand){ ent_cycle("stand",my.skill14); my.skill14 += animation_speed *TIME; if(my.skill14>100){my.skill14 = 0;} wait(1); } bucky_pop(); } function bucky_pop() { //bucky "attack" animation while(my._state == _bucky_pop){ ent_cycle("attack",my.skill14); my.skill14 +=animation_speed *TIME; if(my.skill14>100){my.skill14 = 0;} wait(1); } bucky_stand(); } //functions for cow_move function mystate_spook() { //if the cow is in _cow_spook state then run away from bucky_trap. If more than 400 away than return to _cow_look state. while(my._state == _cow_spook){ if((you._type == ent3_syn)&&(vec_dist(my.pos,you.pos)>400)){you._state = _bucky_stand;my._state = _cow_look;} temp.x = my.x - you.x; temp.y = my.y - you.y; temp.z = my.z - you.z; vec_to_angle(my_angle,temp); actor_turn(); force = 2; actor_move(); wait(1); } mystate_look(); } function mystate_flee() { //if cow is in _cow_flee state then walk away from player until 150 or more away. while(my._state == _cow_flee){ temp.x = my.x - player.x; temp.y = my.y - player.y; temp.z = my.z - player.z; vec_to_angle(my_angle,temp); actor_turn(); if(vec_dist(my.pos,player.pos)>150){my._state = _cow_look;} // walk away force = 1.4; actor_move(); wait(1); } mystate_look(); //return to mystate_look() } function mystate_look() { while(my._state == _cow_look){ //if within 100 of bucky_trap then change state to _cow_spook and execute mystate_spook() if((you._type == ent3_syn)&&(vec_dist(my.pos,you.pos)<=100)){you._state = _bucky_pop;my._state = _cow_spook;mystate_spook();} //if within 150 of player than change state to _cow_flee and execute mystate_flee() if(vec_dist(my.pos,player.pos)<=150){my._state = _cow_flee;mystate_flee();} //if withing 300 of food then beep (for testing) if((you._type == ent2_syn)&&(vec_dist(my.pos,you.pos)<=300)){beep;} wait(1) } } action cow_move { my._walkframes = 1; my._entforce = 0.7; my._health = 10; my.enable_click = on; //cows can be clicked my._state = _cow_look; //put cow in look state mystate_look(); //execute mystate_look() function } action bucky_trap { my._type = ent3_syn; // ent1 = monster, ent2 = food, ent3 = trap my._walkframes = 1; my._state = _bucky_stand; //put bucky in stand position my.skill14 = 0; bucky_stand(); //execute bucky_stand() function } action food { my._type = ent2_syn; // ent1 = monster, ent2 = food, ent3 = trap } 
|
|
|
Re: Doug, if you answer this you could save a potentially great new game.
#6192
08/02/01 06:52
08/02/01 06:52
|
Joined: Mar 2001
Posts: 3,298 Beverly, Massachusetts
Rhuarc
Expert
|
Expert
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
|
I havent read the code yet, but I'm pretty sure you can't assign a synonym to more than 1 entity, if you want to be able to detect what "type" of entity it is (i.e. a health pack or a trap) then assign a certain # to those of the same type always being in say... skill8, then check skill8 of the scanned entity to determine what it is. I may be way off, but I'm in a hurry. I'll read through it more later. -NizZy
|
|
|
|