Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, alibaba, VoroneTZ), 916 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
noob lite-c question #254868
03/06/09 01:18
03/06/09 01:18
Joined: Dec 2008
Posts: 15
A
Albedo Offline OP
Newbie
Albedo  Offline OP
Newbie
A

Joined: Dec 2008
Posts: 15
I've been working through the lite-c workshops and decided to make an animated entity. I found something like this in the 21st workshop, so I copy and pasted it into my script and changed the names of variables, actions etc for my project.

The problem is that when I ran it the model wouldn't do the action, it would just stay stationary. So, does anyone know if there is something I may be doing wrong? This is the script:

///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////
var move_percentage;
function main()
{
level_load ("testlevel.wmb");
wait (2);
camera.z = 120;
camera.tilt = -15;
}
action move_entity()
{
while (1)
{ent_animate(my,"move",move_percentage, 99);
move_percentage += 5 * time_step;
wait (1);
}
}
I have also tried many variations of this code with many different action and model names (just in case of any similar names conflicting with each other or the engine or something) but nothing seems to work. Does anyone know what I am doing wrong?

Re: noob lite-c question [Re: Albedo] #254872
03/06/09 02:44
03/06/09 02:44
Joined: Aug 2008
Posts: 218
U.S.
GamerX Offline
Member
GamerX  Offline
Member

Joined: Aug 2008
Posts: 218
U.S.
why do you have 99 at the end it should be 0 or ANM_CYCLE.


"You may never know what results come of your action, but if you do nothing there will be no result."
-Mahatma Gandhi
Re: noob lite-c question [Re: GamerX] #255033
03/07/09 06:49
03/07/09 06:49
Joined: Dec 2008
Posts: 15
A
Albedo Offline OP
Newbie
Albedo  Offline OP
Newbie
A

Joined: Dec 2008
Posts: 15
I had that, I changed it to 99 just as a test (while I was clutching at straws) and forgot to change it back, it was aum cycle before though, and that still didn't make it work.

Re: noob lite-c question [Re: Albedo] #255043
03/07/09 08:45
03/07/09 08: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
There's nothing wrong in the code except the thing the GamerX mentioned, but you have to make sure that your model actually has frames with the name "move" when you use this name in your code to address them, try to leave just the mere "" instead of a name, this should play all of the frames of the model.

ent_animate(my,"",move_percentage, ANM_CYCLE);

Re: noob lite-c question [Re: Pappenheimer] #255055
03/07/09 10:47
03/07/09 10:47
Joined: Dec 2008
Posts: 15
A
Albedo Offline OP
Newbie
Albedo  Offline OP
Newbie
A

Joined: Dec 2008
Posts: 15
I tried your idea Pappenheimer but it still isn't moving.
Does that mean that there is something wrong in MED? In MED I am able to watch the model do its animation, but is there something else in MED I have to do before it will do it during gameplay?

Re: noob lite-c question [Re: Albedo] #255069
03/07/09 12:44
03/07/09 12:44
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
Did you attach the action to the model in Wed?

Re: noob lite-c question [Re: George] #255104
03/07/09 16:24
03/07/09 16:24
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Originally Posted By: George
Did you attach the action to the model in Wed?


Uuh! Good question! That's right. Never forget to mention the easiest part, because in 60 % of all situations it might be the problem. smile

You can 'connect' the action to the model with an ent_create as well.

///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////
var move_percentage;

action move_entity()
{
while (1)
{ent_animate(my,"move",move_percentage, 99);
move_percentage += 5 * time_step;
wait (1);
}
}

function main()
{
level_load ("testlevel.wmb");
wait (2);
camera.z = 120;
camera.tilt = -15;
ent_create("place_your_models_name_here", vector(200,0,0), move_entity);
}

Re: noob lite-c question [Re: Pappenheimer] #255125
03/07/09 19:49
03/07/09 19:49
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
I should know about it; it happens to me from time to time as well smile

Re: noob lite-c question [Re: George] #255128
03/07/09 19:55
03/07/09 19:55
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
I can't count what I tend to forget: just as an example: changing variables at the wrong place in script always wondering why they don't have any effect! wink

Re: noob lite-c question [Re: Pappenheimer] #255133
03/07/09 20:54
03/07/09 20:54
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
I actually have a list with the mistakes that I tend to make and I consult it when my code doesn't behave as expected. I have learned that GameStudio is almost bug-free a long time ago.

Page 1 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