0 registered members (),
16,232
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Problem with the Kingdom Hearts Movement tutorial codes...
#218919
07/31/08 11:24
07/31/08 11:24
|
Joined: Jul 2008
Posts: 50 Finland
Vilde
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2008
Posts: 50
Finland
|
I don't have any idea what's wrong... I have done it from start already about 4 times and always get same results...  I got these in my main.wdl, player.wdl and animation.wdl: main.wdl: include <animation.wdl>;
include <player.wdl>;
FUNCTION main(){
level_load("level.wmb");
} player.wdl: DEFINE nullframe,-2;
DEFINE blend,-1;
DEFINE stand,0;
DEFINE run,1;
DEFINE walk,2;
DEFINE jump,3;
DEFINE fall,4;
DEFINE move_x,skill22; //movement skills
DEFINE move_y,skill23;
DEFINE move_z,skill24;
DEFINE force_x,skill25;
DEFINE force_y,skill26;
DEFINE force_z,skill27;
DEFINE velocity_x,skill28;
DEFINE velocity_y,skill29;
DEFINE velocity_z,skill30;
DEFINE animate,SKILL31; //animation skills
DEFINE animate2,SKILL32;
DEFINE animblend,SKILL33;
DEFINE currentframe,SKILL34;
DEFINE blendframe,SKILL35;
DEFINE z_offset,SKILL50; //gravity and jumping skills
DEFINE jumping_mode,SKILL51;
DEFINE gravity,SKILL52;
DEFINE movement_mode,SKILL53; //for various movement mainly combat
DEFINE moving,SKILL54;
DEFINE hit_by_player,SKILL55; //enemy skills
DEFINE entity_type,SKILL56;
ACTION player_action {
my.shadow = on;
WHILE (1) { //the main loop
handle_movement();
handle_camera();
handle_animation(1);
wait(1);
}
}
FUNCTION handle_movement() {
temp.x = -1000;
temp.y = 0;
IF (key_w == 1) { temp.x = camera.pan; }
IF (key_s == 1) { temp.x = camera.pan + 180; }
IF (key_a == 1) { temp.x = camera.pan + 90; }
IF (key_d == 1) { temp.x = camera.pan - 90; }
IF (temp.x != -1000) { temp.y = 15 * time; }
my.move_x = fcos(temp.x,temp.y);
my.move_y = fsin(temp.x,temp.y);
c_move(my,nullvector,my.move_x,use_aabb | ignore_passable | glide);
IF (my.move_x != 0 || my.move_y != 0) { //if we are moving
IF (my.animblend == stand) { //if our current animation is stand
IF (key_shift == 1) { my.blendframe = walk; } ELSE { my.blendframe = run; }
}
IF (my.animblend == run && key_shift == 1) { my.blendframe = walk; }
IF (my.animblend == walk && key_shift == 0) { my.blendframe = run; }
} ELSE {
IF (my.animblend > stand) { //if we aren't moving and our current animation is walk
or run, blend and cycle the stand animation
my.blendframe = stand;
}
}
}
FUNCTION handle_camera() {
vec_set(camera.x,vector(my.x + fcos(my.pan,-200),my.y + fsin(my.pan,-200),my.z +
80)); //place the camera behind the player
vec_diff(temp.x,my.x,camera.x); //make the camera look towards the player
vec_to_angle(camera.pan,temp.x);
}
wait(1);
} animation.wdl: FUNCTION handle_animation(animation_speed) {
IF (animation_speed <= 0) { animation_speed = 1; }
IF (my.animblend != blend && my.blendframe != nullframe) { my.animate2 = 0;
my.animblend = blend; }
IF (my.animblend == blend) {
IF (my.currentframe == stand)
{ ent_animate(my,"stand",my.animate,anm_cycle); }
IF (my.currentframe == run) { ent_animate(my,"run",my.animate,anm_cycle); }
IF (my.currentframe == walk) { ent_animate(my,"walk",my.animate,anm_cycle); }
IF (my.blendframe == stand) { ent_blend("stand",0,my.animate2); }
IF (my.blendframe == run) { ent_blend("run",0,my.animate2); }
IF (my.blendframe == walk) { ent_blend("walk",0,my.animate2); }
my.animate2 += 45 * time;
IF (my.animate2 >= 100) {
my.animate = 0;
my.animblend = my.blendframe;
my.blendframe = nullframe;
}
}
IF (my.animblend == stand) {
ent_animate(my,"stand",my.animate,anm_cycle);
my.animate += 5 * animation_speed * time;
my.animate %= 100;
my.currentframe = stand;
}
IF (my.animblend == run) {
ent_animate(my,"run",my.animate,anm_cycle);
my.animate += 6.8 * animation_speed * time;
my.animate %= 100;
my.currentframe = run;
}
IF (my.animblend == walk) {
ent_animate(my,"walk",my.animate,anm_cycle);
my.animate += 8 * animation_speed * time;
my.animate %= 100;
my.currentframe = walk;
}
}
|
|
|
Re: Problem with the Kingdom Hearts Movement tutorial codes...
[Re: Vilde]
#218945
07/31/08 13:27
07/31/08 13:27
|
Joined: Feb 2006
Posts: 2,185
mpdeveloper_B
Expert
|
Expert
Joined: Feb 2006
Posts: 2,185
|
try putting all the "DEFINE"s at the beginning of your animate script, if that doesn't work, put them back where they came from and switch the include lines to make player.wdl first and animation second.
- aka Manslayer101
|
|
|
Re: Problem with the Kingdom Hearts Movement tutorial codes...
[Re: mpdeveloper_B]
#218954
07/31/08 14:14
07/31/08 14:14
|
Joined: Jul 2008
Posts: 50 Finland
Vilde
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2008
Posts: 50
Finland
|
When I did the fist option you said (the define thing), I got this:  And when I changed the animation.wdl and player.wdl in main.wdl, i got this:  it's still getting closer to work as there are now only ?1 or 2? errors.. 
|
|
|
Re: Problem with the Kingdom Hearts Movement tutorial codes...
[Re: VeT]
#219030
07/31/08 18:05
07/31/08 18:05
|
Joined: Jul 2008
Posts: 50 Finland
Vilde
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2008
Posts: 50
Finland
|
looking horrable... "orrunblendandcyc..." omg  just comment string "or run, blend and cycle the stand animation" in player.wdl  4 strings upper the "FUNCTION handle_camera() {" Ok... I don't understand now... 
|
|
|
Re: Problem with the Kingdom Hearts Movement tutorial codes...
[Re: Vilde]
#219105
08/01/08 01:41
08/01/08 01:41
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
hey, you need to sort out your indentations, you'd of spotted the problem in no time... make sure you have all your defines 1st, then pump out your strings and vars go mad with your bmaps snd files etc... then your functions the problem you're having though in the instance is you've put a wait(1); outside of a function reading the error you can see on line 68 you've closed the function which would be more noticable with correct indentation, (there may be other mistakes, i'm just pointing out this one)
DEFINE nullframe,-2;
DEFINE blend,-1;
DEFINE stand,0;
DEFINE run,1;
DEFINE walk,2;
DEFINE jump,3;
DEFINE fall,4;
DEFINE move_x,skill22; //movement skills
DEFINE move_y,skill23;
DEFINE move_z,skill24;
DEFINE force_x,skill25;
DEFINE force_y,skill26;
DEFINE force_z,skill27;
DEFINE velocity_x,skill28;
DEFINE velocity_y,skill29;
DEFINE velocity_z,skill30;
DEFINE animate,SKILL31; //animation skills
DEFINE animate2,SKILL32;
DEFINE animblend,SKILL33;
DEFINE currentframe,SKILL34;
DEFINE blendframe,SKILL35;
DEFINE z_offset,SKILL50; //gravity and jumping skills
DEFINE jumping_mode,SKILL51;
DEFINE gravity,SKILL52;
DEFINE movement_mode,SKILL53; //for various movement mainly combat
DEFINE moving,SKILL54;
DEFINE hit_by_player,SKILL55; //enemy skills
DEFINE entity_type,SKILL56;
ACTION player_action {
my.shadow = on;
WHILE (1) { //the main loop
handle_movement();
handle_camera();
handle_animation(1);
wait(1);
}
}
FUNCTION handle_movement() {
temp.x = -1000;
temp.y = 0;
IF (key_w == 1) { temp.x = camera.pan; }
IF (key_s == 1) { temp.x = camera.pan + 180; }
IF (key_a == 1) { temp.x = camera.pan + 90; }
IF (key_d == 1) { temp.x = camera.pan - 90; }
IF (temp.x != -1000) { temp.y = 15 * time; }
my.move_x = fcos(temp.x,temp.y);
my.move_y = fsin(temp.x,temp.y);
c_move(my,nullvector,my.move_x,use_aabb | ignore_passable | glide);
IF (my.move_x != 0 || my.move_y != 0) { //if we are moving
IF (my.animblend == stand) { //if our current animation is stand
IF (key_shift == 1) { my.blendframe = walk; } ELSE { my.blendframe = run; }
}
IF (my.animblend == run && key_shift == 1) { my.blendframe = walk; }
IF (my.animblend == walk && key_shift == 0) { my.blendframe = run; }
} ELSE {
IF (my.animblend > stand) { //if we aren't moving and our current animation is walk or run, blend and cycle the stand animation
my.blendframe = stand;
}
}
}
FUNCTION handle_camera() {
vec_set(camera.x,vector(my.x + fcos(my.pan,-200),my.y + fsin(my.pan,-200),my.z + 80)); //place the camera behind the player
vec_diff(temp.x,my.x,camera.x); //make the camera look towards the player
vec_to_angle(camera.pan,temp.x);
//}
wait(1);
}
NB: i've only commented out the extra close bracket you have, put some indentation and put white spacing in Hope this helps!
|
|
|
Re: Problem with the Kingdom Hearts Movement tutorial codes...
[Re: MrGuest]
#219110
08/01/08 02:32
08/01/08 02:32
|
Joined: Jul 2008
Posts: 50 Finland
Vilde
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2008
Posts: 50
Finland
|
Well, it was some help but still there are lots of errors... I think I'll have to get some scripting information !To get this movement tutorial! working... I can't get it why it won't work even if i'm pretty sure i did everything as said in the tut... Maybe tomorrow I'll try once again.. Thanks.
Last edited by Vilde; 08/01/08 02:33.
|
|
|
|