Im making an Rpg game on interface 2, button 0 this is my script
{
if (interface == GUI2) {
if (button ==0) {
AnimateCharacter(EGO,0,5,0);
SetGlobalInt(5, GetGlobalInt(5)-10);
Display("You Caused 10 Damage.");
if (GetGlobalInt(5) <= 0) {
GUIOff(GUI2);
player.ChangeRoom(1, 205, 230);
SetCursorMode(0);
Display("You Defeated The Enemy.");
Wait(30);
GUIOn(STATUSLINE);
SetGlobalInt(3, GetGlobalInt(3)+20);
SetGlobalInt(2, GetGlobalInt(2)+20);
SetGlobalInt(5, 50);}
else {
if (GetGlobalInt(5) <= 0) {
GiveScore (-10);
Display("The Enemy Hit You Causing 10 Damage");}}}
//more script here
so my problem for AnimateCharacter
its goes to the first loop like it should but does not do the other frames in the loop only the first one - if i walked it would probably work but how do i make the second and third frame play without walking
The problem is because AnimateCharacter() is non-blocking, so the lines taht follows will be executed before the animation ends.
AnimateCharacter() was an old function, since you're mixing old script functions with new ones, it's advisable to update the old ones, so the line could be:
player.Animate(0, 5, 0, eBlock);
When i do that the wait sign comes up and wont leave so the game freezes - what else could be wrong
Did the character animate?
It goes to the loop but still only does the first frame then it freezes so that does not solve my problem (expecially the whole freezing thing)
Why do you have the same expression for your if statement and your else statement?
Quoteif (GetGlobalInt(5) <= 0) {
Quoteelse {
if (GetGlobalInt(5) <= 0)
I can't see the latter scenario ever being called.
As for your animation, I assume you have to abort the game if it freezes. When you do so the editor should give you a script line (i.e Game aborted Room 1, line 254). That should indicate
where exactly its freezing, and then we might be able to help you more.
i just click control alt delete where would i abort game, and when i click control alt delete it just sats the game is closing improperly if it continues contact ags
To abort the game press ALT X and it should give the script line. Don't forget to tell us which line that is, since we can't see the numbers.
problem line 104
this is it
player.Animate(0, 5, 0, eBlock);
its the same thing as i thought was screwin it up
There's nothing wrong with your player.Animate (0,5,0,eBlock), as far as I can tell. Try deleting line 104 (or using double slashes "//" to turn it into comments) and run the game again. If it works (without animation, obviously) then we'll know for sure that's the problem.
Another thing to consider: I don't notice a Lockview command before you call the animation. Something like player.Lockview (5); where five is the view you want to animate. You may also want to call the opposite unlock view command afterwards, depending on the nature of the animation.
Baron
So, did the character animate? That's what I asked.
I suspect that it may be possible that a popup-modal GUI is on. In that case the GUI may block the animation playing (I'm not sure). That's why I asked.
no but it went to the first frame of the loop it did not completely animate
it works fine without line 104 but it looks cheezy how no1 moves then they get hurt
* AHA the popup Gui was the problem it works now thank you