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? ???
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.
i want my guy to move through rooms in a path.
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:
// 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
}
//...
// 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
}
//...
i ment a npc. for ex. a npc that moves around rooms and you are trying to avoid him
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.
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 (http://geocities.com/scorpiorus82/), that's quite easy to use.
i did but i cant get that one to work :'(
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?
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
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..."?
ya i did and i slected it in the manager
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.
for ex.
ccCreateCommand(1, "ROOM:2,200,110;MOVE:325,110;ROOM:1,0,110;MOVE:200,110;");
ccExecuteCommand(PERSON,1);
Hm, looks ok to me.
Can you play the demo that is included with the plugin?
ya i can
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.
k. thx ill try to look into it. :-\
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. ;)
k thanks for the help ill try it.
i was trying ccs again and i got the error mesages to stop comming up but the ccExecuteCommand wont work.
Ok, let's figure out what's wrong...
What do you mean by "ccExecuteCommand wont work"? Doesn't the character move? Does it display some kind of an error message?
What CCS code do you have? And where did you put it?
Try the following code to test:
function game_start() {
ccDebug(1);
ccSetBlankView(SOME_BLANK_VIEW_HERE);
character[PERSON].room = character[GetPlayerCharacter()].room;
ccCreateCommand(1, "MOVE: 200, 100; MOVE: 100, 100; GOTO:1;");
ccExecuteCommand(PERSON, 1);
}
Take a look at the debug info when running the game. It tells NPC's room, current CCS action, frame, etc.
Wow it worked! :o
i dont know why, i had the ccSetBlankView and the ccCreateCommand and the ccExecuteCommand and the ccDebug
but i dident have the
character[PERSON].room = character[GetPlayerCharacter()].room;
was that why my probraming dident work?
Quotebut i dident have the
character[PERSON].room = character[GetPlayerCharacter()].room;
was that why my probraming dident work?
This piece of code places PERSON into the current room. You probably had him in another room (maybe room -1) and thus didn't see his moving.
But do put ccDebug(1) at game_start. This way you should at least see a debug text line shuttling around the room. :)
lol ya i put the blank view as a blue cup top see what would happen and there was a blue cup moving in the next room.
thanks for all the help :) :)
um also do you need the spaces before the comands??
No, it's just for organization.
Quote from: mport2004 on Fri 14/01/2005 02:24:50
lol ya i put the blank view as a blue cup top see what would happen and there was a blue cup moving in the next room.
Yeah, that's a good idea to use a non-transparent sprite to have some kind of a radar. ;)
As for spaces, as TerranRich has already pointed out, that's not necessarily (but preferable for readability), and in fact in the first versions of the plugin it was required to type a command line with no spaces at all. Currently, the plugin reference also states that you can't have spaces between command parameters but in reality it seems to parse them fine as well.
A colon, however, is a part of the command therefore it's not allowed to separate, say, 'MOVE' and ':'