Suggestion and question

The board for the generell stuff about the PaC-DK Adventure Creator
Post Reply
trq
PaC-DK Newby
Posts: 3
Joined: 23 Jun 2009, 10:36

Suggestion and question

Post: # 73822Post trq
23 Jun 2009, 11:06

Hello, I have a little question for Zimond...
Do you plan to add «on collision»› event to the scripts? I think it will be very useful for mini-games creating, also for adding action-elements to adventure games.
____________________________________
Also, i have some problems with creating sequence of actions without special game commands. for example:
«
on (click)
{
walkto ( zb; 35;28; )
setobj ( en; 0 )
}
»
There's character must go to object, and next command must be executed AFTER his ariving (after «walkto» command). But they all executes at the same time, object changes it’s state before character comes closer to it. So, now i use «minicut()» command on the first part of script, but it's not what i want, because player loses control during cutscene...

P.S. excuse me my english, if it's terrible :)

Baelavay
PaC-DK God
Posts: 1168
Joined: 04 Jun 2006, 19:24
Contact:

Post: # 73823Post Baelavay
23 Jun 2009, 11:34

Solutions that I regard as possible:

Solution A:

Code: Select all

on (click)
{
minicut(donthide)
walkto ( zb; 35;28; )
setobj ( en; 0 )
} 
You said that you don't want the player to lose control about the character, but if you use the code you posted, the script won't wait for the walkto() to end.

Solution B:
First, count the seconds of how long the walkto() takes. Let's call it <W> for instance.

Code: Select all

on (click)
{
walkto ( zb; 35;28; )
timer(<W>)
setobj ( en; 0 )
} 
I'm not sure if the timer() works without a cutscene though.

Solution C (probably the best one):

Code: Select all

on (click)
{
walkto ( zb; 35;28; )
setbool (walking; true)
} 
Doubleclick on the walkmap field (35;28 ) in the room window and enter the followig code:

Code: Select all

if_bool (walking; true)
  {
  setobj ( en; 0 )
  setbool(walking;false)
  }

trq
PaC-DK Newby
Posts: 3
Joined: 23 Jun 2009, 10:36

Post: # 73824Post trq
23 Jun 2009, 18:02

Thanks for your reply.
So, «solution B» is not suitable, because a time for which a character comes to the object may be different.
«Solution C» has two disadvantages: 1. If player don’t reach walkmap field (35, 28) (clicks to another place) bool remain «true». 2. Have to create bool variables for each object in the game.
So, I will still use «solution A». Control loss, I think, is not such important =\

Schiman
PaC-DK God
Posts: 1177
Joined: 20 Dec 2006, 21:48
Contact:

Post: # 73825Post Schiman
23 Jun 2009, 18:22

trq wrote:Control loss, I think, is not such important =\
Sometimes it's annoying. In Jimmy the Squatter it's implemented in the doors. If you use a door you loose the control of your character and you can't abort the event by clicking somewhere else.
It's not that bad, but sometimes it's just annoying.

trq
PaC-DK Newby
Posts: 3
Joined: 23 Jun 2009, 10:36

Post: # 73826Post trq
23 Jun 2009, 19:17

Yes, I agree. I'd like to avoid it in my game, but seems it's impossible..

Schiman
PaC-DK God
Posts: 1177
Joined: 20 Dec 2006, 21:48
Contact:

Post: # 73827Post Schiman
23 Jun 2009, 21:37

I have an idea of another solution...
It's quite circumstantial... but it would work.

In your object-Script you should write:

Code: Select all

on(click)
 {
  setnum(x;something)
  setnum(y;something)
  setstring(object;objectname)
  walkto(self;[x];[y])
  function(checkifarrived;infinit)
 }
The function "checkifarrived" should contain:

Code: Select all

setnum (WalkmapX ; [charx:yourchar]/Z)
setnum (WalkmapY ; [chary:yourchar]/Z)
setnum (WalkmapX ; +1)
setnum (WalkmapY ; +1)
if_num(WalkmapX;[x])
  if_num(WalkmapY;[y])
    {
      setobj([objectname];0)
      stopfunction(checkifarrived)
    }

wait(0,01)   (* optional, if you want to keep performance when a lot of different functions are running *)
I don't know what Z is in your game, this depends on your game-resolution. But you have to figure that out and it would work ;).

Have fun ^^

Post Reply