One OBJECT... Two directions... [disSOLVED]

Started by I<3Pindorama!, Mon 12/01/2015 19:24:47

Previous topic - Next topic

I<3Pindorama!

Hi, AGS MASTER
                        (or not so Master)
...

Please could you help me to move one object in
different areas, using the Power of AGS Script?

If not abuse, you could share a way for the object take a slight pause before moving to another area too?


I try use this logic...
Code: ags
object[3].Animate(0, 1, eRepeat, eNoBlock, eForwards);
object[3].Move(747, 576, 4, eNoBlock, eAnywhere);
object[3].Move(747, 876, 4, eNoBlock, eAnywhere);


This...
Code: ags
object[3].Animate(0, 1, eRepeat, eNoBlock, eForwards);
object[3].Move(747, 576, 4, eNoBlock, eAnywhere);
object[3].Animate(0, 1, eRepeat, eNoBlock, eForwards);
object[3].Move(747, 876, 4, eNoBlock, eAnywhere);


And this...
Code: ags
object[3].Animate(0, 1, eRepeat, eNoBlock, eForwards);
object[3].Move(747, 576, 4, eNoBlock, eAnywhere);
if (object[3].y==576){object[3].Move(747, 876, 4, eNoBlock, eAnywhere);
}


But i...
Spoiler
[close]

My compliments to you my honorable friend
You that i hope will share yours
AGS's Punches and Kicks Codes
with me!

Dômo Arigatô Gozaimas

Gurok

Quote from: I<3Pindorama! on Mon 12/01/2015 19:24:47

And this...
Code: ags
object[3].Animate(0, 1, eRepeat, eNoBlock, eForwards);
object[3].Move(747, 576, 4, eNoBlock, eAnywhere);
if (object[3].y==576){object[3].Move(747, 876, 4, eNoBlock, eAnywhere);
}



This last one is probably closest to correct, but you want to put the coordinate check inside a repeatedly execute function. Assuming this is inside a room, something like:

Code: ags

function room_RepExec()
{
    if (object[3].y==576 && object[3].x==747){object[3].Move(747, 876, 4, eNoBlock, eAnywhere);
    }
}


Should work (haven't tested).

You could alternatively use a character. There's a function that lets you add subsequent destination points after issuing a .Walk command:

Code: ags

cFakeObject.Walk(747, 576, eNoBlock, eAnywhere);
cFakeObject.AddWaypoint(747, 876);


Look up AddWaypoint for more information.

I wrote a module a while ago to handle these kinds of situations. I haven't properly released it yet, but the basic principle is that you can "queue up" a bunch of activities, (e.g. Walking somewhere, animating, talking to someone, walking back again) and execute them as a batch. It again only works with characters for now, but the characters can be told to control objects. http://goo.gl/0iyMcU
[img]http://7d4iqnx.gif;rWRLUuw.gi

I<3Pindorama!

#2
Gurok once again I am grateful for your generosity.

Unfortunately this command for some purpose unknown to me is not read by the AGS.

Code: ags
object[3].Animate(0, 1, eRepeat, eNoBlock, eForwards);
object[3].Move(747, 576, 4, eNoBlock, eAnywhere);
if (object[3].y==576){object[3].Move(747, 876, 4, eNoBlock, eAnywhere);
}


I did a test using the command to make it invisible as soon as stayed in the
indicated area...


Code: ags
object[3].Animate(0, 1, eRepeat, eNoBlock, eForwards);
object[3].Move(747, 576, 4, eNoBlock, eAnywhere);
if (object[3].y==576){object[3].visible=false;
}


...but there was no effect.

If there is a way to make the object invisible as soon as stayed in the
specified area I could then immediately activate a new object from the point
where the old object stagnates and so could perform the second movement in a
new direction.

I tried to use a character instead of an object, seemed to work but strangely
when I take the mouse to the TOP GUI an error message appears.



Apparently this error only occurs when I use two characters in the same scene
even if I specify that only one of them is the player.

I have no idea why this is happening ... would love to use your module, but I
suspect that to use it would barring the same type of error, considering that
it is something that occurs within the AGS ... or am I wrong? I will take this
opportunity and ask for an explanation about another question: I remember having
read somewhere here in the forum that the use of modules limits the game to just
one platform which in this case would be the Windows ... it really proceeds?

Gurok

Plugins might limit you to one platform if there isn't an open source version of that plugin. A plugin is a .dll file that accompanies AGS (or your distributed game) and provides functionality in the editor or engine. A module on the other hand is just a collection of code that's been exported from an AGS game. You can export your own modules by right clicking on a module in the Scripts area and choosing "Export...". Modules are perfectly usable across different platforms.

There shouldn't be any problem with having multiple characters in the same room. Here are a few things you can try:

1. Create a brand new default game with a single object in the same room as Roger. Script this object to move in two directions as outlined above and see if there are still problems.
2. Break your code down into smaller chunks. For instance, does the first move command work correctly by itself?
3. Perhaps PM me a .zip of your project. I can take a further look at it. I don't promise anything though. I suspect there might be something else interfering with the movement.
[img]http://7d4iqnx.gif;rWRLUuw.gi

I<3Pindorama!

#4
Quote1. Create a brand new default game with a single object in the same room as Roger.
Script this object to move in two directions as outlined above and see if there are still
problems.

Adopting your advice I created a new default and this time there was no problem using two
characters in the same scene. This left me very intrigued and I compare the same proprieties
and I have found the reason for the conflict.

HISTORY:

In order to use sprite alpha i enable the choice of colors to 32 bits. It made the game
and slow so I activated the hardware acceleration of 3D ... later I would discover that
the game was slow was not because of AGS but a little problem with my windows.
Because that i undidn't the setting.

The TOP GUI was showing up like this:



I did not give much importance because I assumed it
was a conflict with the graphics of the default mode
and how I will replace them later with images created
by me... so i preferred just as they were left.

Everything was going well until I try to put the two
characters in the same scene and then that came the
CRASH that I mentioned earlier.

Spoiler
[close]

Now... comparing the properties of old and new game, I noticed that the difference between
them was in the Default Graphics Driver option. I switched the Direct 3D option for DirectDraw
and...

Voila! I can already put two characters in the same scene without giving conflict in the TOP GUI.



As they say here in Brazil:
"O que o cu tem a ver com as calças?"

I really do not know why add one more character to a scene results in a conflict with
the TOP GUI when the DIRECT 3D option is selected... but I'm glad the problem has been
remedied.

I hope that this experience could help other white belt like me.  :-D

I will return to perform the tests with the previous
commands and will download the module.

Rà ! I will use this new technique ...



Thank you very much, Master Gurok!  ;)



SMF spam blocked by CleanTalk