noob lite-c question

Posted By: Albedo

noob lite-c question - 03/06/09 01:18

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?
Posted By: GamerX

Re: noob lite-c question - 03/06/09 02:44

why do you have 99 at the end it should be 0 or ANM_CYCLE.
Posted By: Albedo

Re: noob lite-c question - 03/07/09 06:49

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.
Posted By: Pappenheimer

Re: noob lite-c question - 03/07/09 08:45

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);
Posted By: Albedo

Re: noob lite-c question - 03/07/09 10:47

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?
Posted By: George

Re: noob lite-c question - 03/07/09 12:44

Did you attach the action to the model in Wed?
Posted By: Pappenheimer

Re: noob lite-c question - 03/07/09 16:24

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);
}
Posted By: George

Re: noob lite-c question - 03/07/09 19:49

I should know about it; it happens to me from time to time as well smile
Posted By: Pappenheimer

Re: noob lite-c question - 03/07/09 19:55

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
Posted By: George

Re: noob lite-c question - 03/07/09 20:54

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.
Posted By: Albedo

Re: noob lite-c question - 03/08/09 10:07

I tried the ent_create idea but got a script error...
How do you attach an action to a model in MED? I am not sure whether or not I have done that.
Posted By: Pappenheimer

Re: noob lite-c question - 03/08/09 11:58

MED and WED are two different shoes! smile
But, I suppose that you don't have WED, because you are using Lite-C.

So, we need the ent_create way to go.

What are the error messages do you get, and do you mind to copy paste the code here? Its not that long for now, right?


OT, @ George, I'm a big fan of checklists, I need a list to find my lists though! wink But, I know that's not the fault of the system of making lists, but my own fault of organization.
Posted By: Albedo

Re: noob lite-c question - 03/10/09 21:18

I actually am using WED, I misread that thing about attaching actions to entities and thought it was something I had missed in MED. So far, my code remains exactly the same as it does in the previous page, except for that instead of "99" it has "ANM_CYCLE".
As this whole excercise is just a test to see if I can make a model move in some way, would it be best if I just used a completely different model with a completely different action? This way I may be able to pinpoint exactly where I went wrong. Also, it may be as one other poster said, it may be causing errors for seemingly random reasons (or I missed some small step in the procedure).
© 2024 lite-C Forums