function game_start comand [SOLVED]

Started by , Tue 11/01/2005 01:13:46

Previous topic - Next topic

function gamestart comand

for a function game_start comand it keeps telling me my character is not in the room. how do you set it to a room? ???

strazer

The game_start function is run before the first room is loaded, so there's no room any player could currently be in.

What command do you use, what do you want to do?
You probably want to put the code in the "Player enters screen" interaction of the room.

mport2004

i want my guy to move through rooms in a path.

strazer

Do you mean the player character? For a cutscene for example?

Ok, here's an example, assuming player is in room 1 and should move to room 2:

Code: ags

// script for interaction that triggers cutscene (e.g. interact with object in room 1)
//...

  if (GetGlobalInt(77) == 0) { // if cutscene hasn't run already
    MoveCharacterBlocking(GetPlayerCharacter(), 320, 150); // walk to right edge of room 1
    SetGlobalInt(77, 1); // set flag to 1, so cutscene will be continued in room 2
    NewRoomEx(2, 50, 150); // change to room 2, left edge
  }

//...


Code: ags

// script for room 2: Player enters screen (after fadein)
//...

  if (GetGlobalInt(77) == 1) { // if flag is set to 1, i.e. cutscene should be continued
    MoveCharacterBlocking(GetPlayerCharacter(), 160, 160); // move player to middle of room 2
    DisplaySpeech(GetPlayerCharacter(), "Phew, that was quite a walk!");
    SetGlobalInt(77, 2); // set flag to 2 so cutscene doesn't run next time you enter this room and object interaction in room 1 can't be done again
  }

//...

mport2004

#4
i ment a npc. for ex. a npc that moves around rooms and you are trying to avoid him

Gilbert

What did you do there? Did you move or animate a character in game_start()?
Since no room file and game data was loaded during game_start() you shall not do that. The game_start() function is only used for initializations such as turning on/off GUIs, assigning values to variables, etc.

If you want to do something with a character upon start of the game, do that in the "Player enter screen" (before or after fadein, depending on your needs) event of that room.

strazer

Oh my, that's tricky.
Only one room can be loaded at a time, so you can't directly move NPCs in other rooms since they are not in memory.
There are workarounds, but they are quite complex.
You might want to take a look at the CCS plugin, that's quite easy to use.

mport2004

i did but i cant get that one to work :'(

strazer

Please, you have to provide more information.

What specifically are you having problems with? What doesn't work?
What error messages do you get?
What SHOULD happen and what DOES happen?

mport2004

#9
it keeps saying that it cant recognize the commands


ive told it to use the plugin and ive even tried to copy the demo game to check if I'm entering it wrong but it wont let me get into the tester

strazer

Have you put ags_CCS102.dll in both the AGS editor folder and the game's Compiled folder?
Have you checked the plugin in menu "Game" -> "Plugin editor..."?

mport2004

ya i did and i slected it in the manager

strazer

Quoteit keeps saying that it cant reconise the comands

What are the commands?
The error messages give you the line number or take you directly to the part of the code that's wrong. Please post these lines here.

mport2004

for ex.

ccCreateCommand(1, "ROOM:2,200,110;MOVE:325,110;ROOM:1,0,110;MOVE:200,110;");
ccExecuteCommand(PERSON,1);

strazer

Hm, looks ok to me.
Can you play the demo that is included with the plugin?


strazer

If you have the dll in the right places and have the plugin activated, it should work fine.
If all else fails, you could upload your game for us to take a look at.

mport2004

k. thx ill try to look into it. :-\

Scorpiorus

Quote from: mport2004 on Tue 11/01/2005 03:00:03ccCreateCommand(1, "ROOM:2,200,110;MOVE:325,110;ROOM:1,0,110;MOVE:200,110;");
ccExecuteCommand(PERSON,1);

Hmm, I tried this command and it's parsed fine for me.

There was a bug in the plugin which I've just fixed. I don't, however, see how it could affect ccExecuteCommand not recognizing commands since it was about a read-access issue.

Anyway, try dowloading a new version (1.03) from here: http://geocities.com/scorpiorus82/

Let us know how does it turn out. ;)

mport2004

k thanks for the help ill try it.

SMF spam blocked by CleanTalk