[Solved] Always animate character issue.

Started by SestunaShadow, Wed 30/12/2015 14:11:34

Previous topic - Next topic

SestunaShadow

Hello all of you,

Sorry for the inconvinience, i tried to look through the help file, tutorials and the wiki, but i can't make this function to work, the game launches normally but the character i want to always animate doenst do it. So as a last resort Im going to ask here for help.

Code: ags

function game_start()
{
  cChar1.LockView(4);
  cChar1.Animate(1, 3, eRepeat, eBlock, eForwards);
  cChar1.UnlockView();
}


So, where i failed?

Thanks

Slasher

i think this may need to go in Room Load plus cChar1.UnlockView(); will never happen because animation is eRepeat and eBlock.

SestunaShadow

Oh, thanks, Room_Load seems more logical. but still doesn't work. the main character can move freely but the npc is still unanimated.

I tried the following functions.

Code: ags

function Room_Load()
{
  cChar1.LockView(4);
  cChar1.Animate(1, 3, eRepeat, eBlock, eForwards);
}


Code: ags

function Room_Load()
{
  cChar1.Animate(1, 3);
}


Code: ags

function Room_Load()
{
  cChar1.Animate(1, 3, eRepeat, eBlock, eForwards);
}


the View is well put, if i change the main character to that one, when i move the animation works. But maybe its a propietries issue.

Slasher

#3
if the npc is an object try Setview rather than Lockview else Changeview and it should be eRepeat eNoBlock.

SestunaShadow

It isn't an object i made him a character, I tested the lines on an interact with the character and there it works, i still cannot make it work auto though, the room_Load function doesnt work if it's the first room or maybe because the npc is a character the function has to go in the global script?

Sorry for asking so much :embarrassed:

NickyNyce

Try using frame 0 instead of 1. Perhaps you're using the wrong frame?

Place your code in Before fade in of the rooms script. And if the character is always animating, use eNoBlock.

Slasher

Quotemaybe because the npc is a character the function has to go in the global script?
only if you interact with him like: look, talk, use inv..

SestunaShadow

Ok, i feel so dumb now.

I don't know why when i write the code directly to the room script it doesn't work, but when i use the ags inteface and make an event before fade in then it works and the code is the same i think.

Code: ags

function room_Load()
{
  cChar1.Animate(1, 3, eRepeat, eNoBlock, eForwards);
}


With this one now it works fine.

Welp, thank you all

Slasher

Quotedon't know why when i write the code directly to the room script it doesn't work, but when i use the ags inteface and make an event before fade in then it works and the code is the same i think.
Let that be a lesson for you.. Glad you got it sorted ;)

if you make your own functions then you write them directly into the script.

Khris

Quote from: SestunaShadow on Wed 30/12/2015 17:57:11I don't know why when i write the code directly to the room script it doesn't work, but when i use the ags inteface and make an event before fade in then it works and the code is the same i think.

Easy: because AGS doesn't care about the function unless you actually link to it. There are exceptions* to this rule, but all the events listed in the respective event panels need to be linked to the functions for the functions to be called.

Using the "correct" name while adding the function yourself will not work. Plus, you used Room_Load instead of room_Load, which to AGS are two separate functions. So even if AGS worked that way, which (as the manual's tutorial explains) it doesn't, it wouldn't have worked due to the capital "R".
Btw, you can use completely custom names, or link multiple events to the same functions. Since AGS simply calls the function stated next to the event, the name used by default is just that, but not binding.

*Since I mentioned them, exceptions for room scripts are: on_call, on_mouse_click, on_key_press, repeatedly_execute_always.

SMF spam blocked by CleanTalk