I've noticed the following weird behaviour.
My sprite has a wide area under him:

...so to make him walk back and forth on the path set out, I need to either:
a) export, change, and re-import all the masks for every room (not happening, too complex, will take 3 months, plus I have to resize paths with continuous scaling, and just editing a mask .bmp is paint.net or paint.exe results in it saving wrong)
OR
b) make his z coords good for "lowering" him to the path
I've already come up with an equation which seems to work 100% of the time depending on his scaling:
cJulius.z = 0 - ( FloatToInt( (Z_FACT / 100.0) * IntToFloat(cJulius.Scaling), eRoundDown ) );
Where cJulius is my sprite
Z_FACT is a floating point constant of 72.0 (about the distance his feet are from the bottom of his frame, 72pixels)
The final result for cJulius.z is always a negative number.
I have a usual interact function: walk to object, face object, say something, pickup object (play an animation of him bending down to get it).
The pickup animation is the same size exactly as the standard walk animations; it goes seemlesly.
HOWEVER
When I have a .Walk() anywhere near to the .PickupUp() animation, it 'resets' itself after I've done this -- in other words, it seems to jump a random amount in height, for no known reason:
https://bluekeystudios.com/img/julius reset.webm
When I take out the walking line, no reset:
https://bluekeystudios.com/img/julius no reset.webm
The code is:
Code: ags
Also, here's the .PickUp() code:
Code: ags
Now - obvious questions:
Have you tried setting Julius' loop to the same each time, even when you don't include the .FaceObject() function call? Yes - still happens.
Have you tried peppering Wait(1); between each line of code, and the .PickUp animation code? Yes - still happens.
Have you created a new room, with all the same objects, paths, masks and scaling, and see if it does this still? Yes - still happens.
Have you tried making a generic room with only the Walk,Speak,Pickup code in it? Yes - still happens.
Have you tried deleting the line to do with the .FaceObject() function, so it's walk,speak,pickup; or for that matter walk,pickup; or walk/wait/speak/wait/pickup; or walk,wait,pickup; or...? Yes - still happens as long as .Walk() is there.
What about when Julius walks to an object by guidance of the mouse, not a Walk() command It works when I send him to a point, but not the command .Walk(). However, don't really see how I can get rid of this.
Is the .z variable the same before, after and during? Yes, tested thoroughly, but .z is miss-set when I pickup something, as opposed to the clone rooms. When set .z based on scaling alone eg. if .scaling=5 then .z=-16 or whatevs -- it sets the .z different to other rooms, and the 'reset' still happens. However, the .z it's set to is always the same mis-set number.
What's the function for the setting Julius' .z variable?
Code: ags
Have you tried writing it walk/say/nothing You mean leave out the PickUp() animation? Or the .SayBubble()? It still does the reset wherever there's a Walk() command.
Is it something to do with the .SpeechBubble() code? Perhaps - I've got 0.8 but made a few minor changes to integrate it. Anyone wanting to see it I'll PM it to.
Am I missing something here? Does walk always do this, reset graphics somehow? Does walk() do something which the standard code for getting a character to walk somewhere based on a mouse-click in eModeWalk doesn't?
Am I insane, or as usual overthinking?
Plz help
My sprite has a wide area under him:

...so to make him walk back and forth on the path set out, I need to either:
a) export, change, and re-import all the masks for every room (not happening, too complex, will take 3 months, plus I have to resize paths with continuous scaling, and just editing a mask .bmp is paint.net or paint.exe results in it saving wrong)
OR
b) make his z coords good for "lowering" him to the path
I've already come up with an equation which seems to work 100% of the time depending on his scaling:
cJulius.z = 0 - ( FloatToInt( (Z_FACT / 100.0) * IntToFloat(cJulius.Scaling), eRoundDown ) );
Where cJulius is my sprite
Z_FACT is a floating point constant of 72.0 (about the distance his feet are from the bottom of his frame, 72pixels)
The final result for cJulius.z is always a negative number.
I have a usual interact function: walk to object, face object, say something, pickup object (play an animation of him bending down to get it).
The pickup animation is the same size exactly as the standard walk animations; it goes seemlesly.
HOWEVER
When I have a .Walk() anywhere near to the .PickupUp() animation, it 'resets' itself after I've done this -- in other words, it seems to jump a random amount in height, for no known reason:
https://bluekeystudios.com/img/julius reset.webm
When I take out the walking line, no reset:
https://bluekeystudios.com/img/julius no reset.webm
The code is:
function oWallet_Interact()
{
cJulius.Walk(587, 396, eBlock, eWalkableAreas); <-- THIS LINE CAUSES RESET; if I comment it out, no reset occurs.
cJulius.FaceObject(oWallet);
cJulius.SayBubble("My wallet! Something survived the time-travel. Oh... it's got all the money missing.");
cJulius.PickUp(eLow, iWallet, oWallet, false, 8, player.Room);
}
Also, here's the .PickUp() code:
function PickUp (this Character*, PickUpHeight height, InventoryItem *i, Object *o, bool visibility, int obj, int room)
{
int _loop_down=0;
int _loop_up=0;
if (height == eLow) {
_loop_down=138; //low
_loop_up=140;
}
... //other heights, this just sets the view number for the pickup down, pickup up views
int cur_loop=this.Loop;
this.LockView(_loop_down);
this.Animate(cur_loop, 1, eOnce, eBlock);
this.UnlockView();
this.AddInventory(i);
o.Visible = visibility;
this.LockView(_loop_up);
this.Animate(cur_loop, 1, eOnce, eBlock);
this.UnlockView();
}
Now - obvious questions:
Have you tried setting Julius' loop to the same each time, even when you don't include the .FaceObject() function call? Yes - still happens.
Have you tried peppering Wait(1); between each line of code, and the .PickUp animation code? Yes - still happens.
Have you created a new room, with all the same objects, paths, masks and scaling, and see if it does this still? Yes - still happens.
Have you tried making a generic room with only the Walk,Speak,Pickup code in it? Yes - still happens.
Have you tried deleting the line to do with the .FaceObject() function, so it's walk,speak,pickup; or for that matter walk,pickup; or walk/wait/speak/wait/pickup; or walk,wait,pickup; or...? Yes - still happens as long as .Walk() is there.
What about when Julius walks to an object by guidance of the mouse, not a Walk() command It works when I send him to a point, but not the command .Walk(). However, don't really see how I can get rid of this.
Is the .z variable the same before, after and during? Yes, tested thoroughly, but .z is miss-set when I pickup something, as opposed to the clone rooms. When set .z based on scaling alone eg. if .scaling=5 then .z=-16 or whatevs -- it sets the .z different to other rooms, and the 'reset' still happens. However, the .z it's set to is always the same mis-set number.
What's the function for the setting Julius' .z variable?
function repeatedly_execute()
{
cJulius.z = 0 - ( FloatToInt( (Z_FACT / 100.0) * IntToFloat(cJulius.Scaling), eRoundDown ) );
....
}
Have you tried writing it walk/say/nothing You mean leave out the PickUp() animation? Or the .SayBubble()? It still does the reset wherever there's a Walk() command.
Is it something to do with the .SpeechBubble() code? Perhaps - I've got 0.8 but made a few minor changes to integrate it. Anyone wanting to see it I'll PM it to.
Am I missing something here? Does walk always do this, reset graphics somehow? Does walk() do something which the standard code for getting a character to walk somewhere based on a mouse-click in eModeWalk doesn't?
Am I insane, or as usual overthinking?
Plz help
