Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: strazer on Wed 04/05/2005 04:07:17

Title: MODULE: CharacterControl v0.84b
Post by: strazer on Wed 04/05/2005 04:07:17
This is my CharacterControl script module for AGS v2.71/2.72.

To quote the CCS plugin by Scorpiorus (http://www.adventuregamestudio.co.uk/games.php?action=detail&id=186):

"Imagine you have a lot of characters in the game and want them to perform different tasks at the same time. Yep, a tons of scripting seems unavoidable. However, another way out is to use CCS which provides easy command control system so you define all needed character commands and then just call the execution function. The most powerful is the MOVE command as it works room-independently!"

I really like the idea, but as a Linux user I can't use plugins and I like to do things natively whenever possible. So I wrote the entire thing from scratch as a script module.

Features:

* NPCs can walk around in other rooms, talk, animate etc. _in the background_
* Compatible with CCS plugin command strings
(That may change at any time so you're encouraged to use this module's commands.)

Advantages to the CCS plugin:

+ Cross-platform compatibility
+ Additional and extended, more flexible control commands
+ No need for a dedicated blank view
+ Extensible & customizable

Note that this is still a BETA version.
I have only a simple test game to test this with so I need other users to report any bugs they may encounter.

Download here (http://www.strazer.net/ags/CharacterControl.zip) (Requires AGS v2.71 or higher!)
This download includes the script module(s), documentation and a small demo game.

Edit:

Check this post by monkey_05_06 for an AGS 3+ compatible version (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=28821.msg482601#msg482601)
Title: Re: strazer's CharacterControl script module
Post by: Pumaman on Wed 04/05/2005 18:27:44
Clever stuff strazer, good work :)
Title: Re: strazer's CharacterControl script module
Post by: Scorpiorus on Sat 28/05/2005 00:04:41
Nice work strazer!

It's cool to see this as a script module since the CCS plugin doesn't really use any of AGS plugin API specific functions. And it infact was made as an AGS script that was eventually converted into C. But that's because I just didn't want people to mess with "installing" it by copy and pasting portions of script code around the main global script. It's cool we have the module feature, indeed.

:)
Title: Re: MODULE: CharacterControl
Post by: strazer on Thu 14/07/2005 13:54:16
Version 0.81 now up:

  - Characters now play talking animation when talking*
  - Added check if character is .on before executing command
  - Renamed internal control command enums

See link above.

Edit:

*No lip-sync or voice speech though
Title: Re: MODULE: CharacterControl
Post by: Blitzerland on Fri 15/07/2005 11:50:35
Oh, just think what's possible with this. You could even make a game recreating the chaos of Wall Street.

*Shudder of geeky joy*

Or not. But you get the idea.

Awesomeness, Strazer. Pure awesomeness.
Title: Re: MODULE: CharacterControl (BROKEN!)
Post by: strazer on Tue 30/08/2005 05:43:59
Version 0.82 now up:

- Fixed problems with rooms > 21
- Fixed characters stuck speaking if not in current room

See download link above.

I'm still not quite satisfied with the internal workings of the module, but this will do for now. It's a Beta after all. ;)
Title: Re: MODULE: CharacterControl
Post by: Candle on Thu 27/10/2005 05:27:13
Thanks strazer, nice work and you sure do a lot .
Thanks again.
Title: Re: MODULE: CharacterControl v0.83
Post by: strazer on Tue 20/12/2005 22:58:58
Version 0.83 now up:

- Code rewrite and thus now requiring AGS v2.71!
- Added SAY control command for entering speech directly into command string
- RunScript add-on module now uses String parameters instead of Ints, so you
   may have to update your custom code and paste it into v0.83 of the RunScript
   module. Sorry for the inconvenience.
- Fixed characters occasionally getting stuck when changing rooms

See download link in first post.

(For AGS v2.70, here is v0.82a (http://www.strazer.net/ags/CharacterControl_082a.zip) that includes the bugfix above. This is the last version for AGS v2.70. All future versions including v0.83 will require at least AGS v2.71!)
Title: Re: AGS 2.71 *UPDATE* now released!
Post by: Kinoko on Fri 13/01/2006 14:15:01
I'm converting a lot of my script over, but now I get a Type Mismatch for the line in bold:

function charCharColDetectEx(int CharID1, int slot1, int CharID2, int slot2) {
int room1;
int room2;
if (CharID1 != GetPlayerCharacter()) room1 = CharacterControl.GetRoom(CharID1);
else room1 = character[CharID1].room;
if (CharID2 != GetPlayerCharacter()) room2 = CharacterControl.GetRoom(CharID2);
else room2 = character[CharID2].room;
if (room1 == room2) {

...etc

Cannot convert int to character. I'm honestly not sure what to change here. Can anyone help?
Title: Re: MODULE: CharacterControl v0.83
Post by: strazer on Fri 13/01/2006 15:36:16
Kinoko, in contrast to the plugin, this module uses new-style scripting exclusively and takes pointers as parameters, not numbers/IDs.
This allows you to use the new character pointers for functions, e.g.:
  int roomid = CharacterControl.GetRoom(cGeorge);

So change
  CharacterControl.GetRoom(CharID1)
to
  CharacterControl.GetRoom(character[CharID1])

(and the same for CharID2)
Title: Re: MODULE: CharacterControl v0.83
Post by: Kinoko on Wed 25/01/2006 10:43:23
Thanks. Another probem I have is that I have a longish cutscene that needs to start with various triggers and timers, so the code ends up in pieces in repeatedly_execute.

Now, what would really solve my problem would be the ability to call blocking functions from repeatedly_execute. The fact that AGS won't allow it is what's physically stopping me. I can prevent any problems myself, by triggering the code with a variable value and then immediately changing that value but letting the rest of the script run line by line, but AGS doesn't allow for this.
Title: Re: MODULE: CharacterControl v0.83
Post by: SSH on Wed 25/01/2006 11:03:02
I thought you can call blocking functions in rep_ex, but not rep_ex_always...


Title: Re: MODULE: CharacterControl v0.83
Post by: mchammer on Wed 12/04/2006 14:23:45
great module, its very useful to me. But last time I run the game, it crashed and I got this message:

ACI ver. 2,71,894
in CharacterControl(line 158)
from CharacterControl(line 372)

Error:Move Character: Character not in current room.

I dont know much about these things so im not sure is it either a bug or my own scripting error.
Title: Re: MODULE: CharacterControl v0.83
Post by: JD on Wed 12/04/2006 19:02:37
Nice work Strazer, will certainly play around with this at some point :)
Title: Re: MODULE: CharacterControl v0.84
Post by: strazer on Wed 12/04/2006 23:56:54
Version 0.84 now up:

- Fixed characters not fully initializing when not starting with ROOM command
- Fixed SAY command not working with characters that have no speech view set

mchammer: This should fix your problem. I (wrongly) assumed each chain starting off with a ROOM change command, so the character wasn't fully initialized yet.
Title: Problems with CCS and CharacterControl
Post by: on Tue 24/10/2006 14:37:19
Hi

I'm having trouble getting CCS103 or charactercontrol 0.84 to work. As far as I know, I've read through all the docs, searched through the forums etc, but still not closer to an answer. I'm trying to get 4 npc's to walk on set paths around 1 room in the background. First I tried charactercontrol, but as soon as I import them through modules, the game doeesn't compile any longer, I just get a tonne of "undefined symbol..." errors. Is there somewhere I need to add the scripts to a header? Tried (as a test) to comment out all instances of undefined symbols, but that, of course, broke the script  :)

Also tried CCS, all seems fine, but when, in game_start, I call ccCreateCommand(1, "WALK:1,1;"), I get an error stating it can't convert a const string to a string. Though all documentation states that this is the way to do it...

Both demo games don't run as well.

Am I missing something painly obvious???

using ags 2.72

thanks.
Title: Re: MODULE: CharacterControl v0.84b - Fixed to work with v2.72
Post by: strazer on Tue 24/10/2006 17:46:42
Version 0.84b now up. I have hopefully updated the module to work with both AGS v2.71 and v2.72.
Title: Re: MODULE: CharacterControl v0.84b
Post by: Oddysseus on Thu 19/07/2007 02:12:30
Sorry for digging up this old post, I just wanted to point out that the AGS Resource page still links to version 0.84, the version that doesn't work in AGS 2.72.
Title: Re: MODULE: CharacterControl v0.84b
Post by: GarageGothic on Thu 19/07/2007 12:47:37
I'm guessing he means this page (http://www.americangirlscouts.org/agsresources/modules.html).
Title: Re: MODULE: CharacterControl v0.84b
Post by: strazer on Thu 19/07/2007 16:50:55
Thanks, I've sent jasonkay (http://www.adventuregamestudio.co.uk/yabb/index.php?action=profile;u=3242) a pm, he maintains that site.
Title: Re: MODULE: CharacterControl v0.84b
Post by: Rocco on Sun 16/09/2007 17:48:34
thx for updating this great module.  :)

i have one question:
what is the easiest way, to change walkspeed between chain-commands?
i want to assign a random walkspeed after some walk commands in the chain.
Title: Re: MODULE: CharacterControl v0.84b
Post by: mchammer on Sun 16/09/2007 19:49:24
Quote from: Rocco on Sun 16/09/2007 17:48:34
thanks for updating this great module.  :)

i have one question:
what is the easiest way, to change walkspeed between chain-commands?
i want to assign a random walkspeed after some walk commands in the chain.


I think easiest way is to use RunScript module (comes with Character Control module).
Add RunScript module BEFORE CharacterControl module in your game.

Script you use inside RunScript module:

   if (parameter1.AsInt == ExampleValue) {
    int WalkingSpeed = Random(MaxWalkspeed - MinWalkspeed) + MinWalkspeed;
    thechar.SetWalkSpeed(WalkingSpeed,WalkingSpeed);
  return 0;


Then you add to chain a command 'RUN:ExampleValue;' when you want change the walking speed.

Replace ExampleValue with a number 1 or above.
Title: Re: MODULE: CharacterControl v0.84b
Post by: Rocco on Mon 17/09/2007 12:42:54
thanks mchammer, works perfect  :)
i will use this module in 2 of my upcoming games.
Title: Re: MODULE: CharacterControl v0.84b
Post by: strazer on Mon 17/09/2007 16:45:36
Thanks mchammer! :)
Title: Re: MODULE: CharacterControl v0.84b
Post by: Rocco on Thu 24/07/2008 18:22:38
i tried something like this

    CharacterControl.CreateChain(1, "ROOM:3, random(80)+250,270; RUN:1; WALK:Random(250)...

and get the error message that only numbers are allowed,

i need the whole values randomly all the time.
i know the example in the demo which sets the chain values randomly,
but the problem is, when the chain is finished one time and returns to the beginning, (GOTO 1 )
it should generate new random values again, and dont use the values generated one loop earlier.

the only solution i can imagine, is to make a new chain for every loop, but then i need a very huge ammount of chains.
is there another possible solution?
Title: Re: MODULE: CharacterControl v0.84b
Post by: Rocco on Thu 24/07/2008 23:22:53
sorry for doppelposting, i have another question.  :)

i noticed that the chars arent in the given position when i change room,
and come back to the room, where the CC module is running.

Can this happen, when the roomsize is different?
The main room with the Controled Chars is 4time bigger as the other room.
Title: Re: MODULE: CharacterControl v0.84b
Post by: Rocco on Fri 25/07/2008 17:19:32
Ok here i go again.  :)

The situation is as follow:
I have one character walking in one room with the CC-module, this character activates some events every few seconds when he steps on a specified region.
This is important for the game, regardless if the player is in the same room or not.
Ok so when im leaving the room with the CC controlled chars, the events doesnt occurs anymore.

My thought was, when all the CC-controlled chars are taken to the rooms where the player is,
and act invisible, i draw the same regions in another room and the events can go on.
But this approach doesnt work either.

strazer please help!!!  :),
MAGS deadline is coming very close now.
Title: Re: MODULE: CharacterControl v0.84b
Post by: strazer on Fri 25/07/2008 17:44:22
Rocco, I'd like to help but I'm totally out of the loop at the moment, haven't worked with AGS in months and am quite busy at work.
I'm sorry, I hope someone else will be able to help you out.
Title: Re: MODULE: CharacterControl v0.84b
Post by: Khris on Sun 27/07/2008 10:22:26
Quote from: Rocco on Thu 24/07/2008 18:22:38
i tried something like this

    CharacterControl.CreateChain(1, "ROOM:3, random(80)+250,270; RUN:1; WALK:Random(250)...

and get the error message that only numbers are allowed,

    CharacterControl.CreateChain(1, String.Format("ROOM:3, %d, 270; RUN:1; WALK:%d...",random(80)+250, Random(250)));
Title: Re: MODULE: CharacterControl v0.84b
Post by: Revonx on Sat 25/10/2008 00:15:17
Hi,

Having a problem with the module that I can't figure out. When I run the game it works fine except for sometimes at random removing either a character from the game entirely or incorrecly placing a character into a non designated room scrolling up and down the right side of the room itself, quite bizzare.
Hopefully its a simple explanation that I failed to acknowledge.

Heres the code:

function game_start() // called when the game starts, before the first room is loaded
  {
    CharacterControl.CreateChain(1, "ROOM:7,30,170; WALK:319,176;");
CharacterControl.AppendChain(1, "ROOM:3,0,175; WALK:319,174;");
CharacterControl.AppendChain(1, "ROOM:16,0,182; WALK:140,172; WAIT:100; WALK: 300,170; WAIT: 100; WALK:140,172; WAIT:100; WALK:0,179;");
CharacterControl.AppendChain(1, "ROOM:3,319,174; WALK:0,175;");
CharacterControl.AppendChain(1, "ROOM:7,319,176; WALK:30,170; GOTO:1;");
CharacterControl.StartExecuting(cGoliath, 1);
CharacterControl.CreateChain(2, "ROOM:11,165,152; WAIT: 100; LOOK: 160,160; WAIT: 100; ANIMATE:4,0,0; WAIT: 100; WALK: 274,153; WAIT: 200; WALK: 266,111; WAIT: 200; WAIT: 100;");
CharacterControl.AppendChain(2, "WALK:274,153; WAIT: 100; WALK:165,152; GOTO:1;");
CharacterControl.StartExecuting(cCop, 2);
}

Hoping someone knows whats going on.  ;D

Revonx.
Title: Re: MODULE: CharacterControl v0.84b
Post by: beomoud on Fri 30/01/2009 17:59:06
I can't get it to work.... i get this message:

CharacterControl_084b.asc(52): Error (line 52): Array size must be constant value
Title: Re: MODULE: CharacterControl v0.84b
Post by: strazer on Fri 30/01/2009 18:34:38
I don't think it works with AGS 3 at the moment. Aside from not having the time at the moment, I can't run the new editor so I'm unable to debug this.

Unless someone else is willing to step in, I'm afraid this module is orphaned for now...sorry.
Title: Re: MODULE: CharacterControl v0.84b
Post by: monkey0506 on Fri 30/01/2009 20:06:05
Hey strazer, no worries.

Download (http://monkey.05.06.googlepages.com/CharacterControl_085.rar) (Mirror (http://www.strazer.net/ags/CharacterControl_085.rar))

This is pretty much just a 1-to-1 conversion.

Changelog:



NOTE: The above download link only includes the SCM for the module. It does not include any documentation, the CharacterControl_RunScript module, demo game, etc., etc. You must download the 0.84 package for these files.

I did test the 0.84 demo game with 0.85 of the module and it appeared to function fine. I didn't do any extensive testing, but based on the minimal changes I made, none of the actual module functionality should have been affected anyway. All prior module commands (for the end-user) should work exactly the same.
Title: Re: MODULE: CharacterControl v0.84b
Post by: strazer on Fri 30/01/2009 20:12:11
Sweet! Thanks so much monkey!
Title: Re: MODULE: CharacterControl v0.84b
Post by: beomoud on Sat 31/01/2009 00:05:08
Thank you  :)
Title: Re: MODULE: CharacterControl v0.84b
Post by: monkey0506 on Sat 31/01/2009 00:23:28
You're both welcome. It was a simple fix really. :)

As a matter of fact...it wouldn't be that difficult to throw in some #ifdef-s to make the entire thing backwards compatible to 2.71...maybe on my next day off from work. ;)
Title: Re: MODULE: CharacterControl v0.84b
Post by: Dualnames on Tue 28/04/2009 21:11:40
Sorry for the bump, but downloaded and greatest of implementations so far Monkey..
Title: Re: MODULE: CharacterControl v0.84b
Post by: Matti on Tue 28/04/2009 23:49:57
Whoa, this Module could come in handy. Thanks in advance, strazer and monkey..
Title: Re: MODULE: CharacterControl v0.84b
Post by: Dualnames on Wed 29/04/2009 00:00:36
Quote from: Mr Matti on Tue 28/04/2009 23:49:57
Whoa, this Module could come in handy. Thanks in advance, strazer and monkey..

And dual, for bumping it up for no reason.
Title: Re: MODULE: CharacterControl v0.84b
Post by: Dualnames on Wed 06/05/2009 08:39:35
Can I ask if there's a license of any sort coming with this module? For from all I can see there's not.
Title: Re: MODULE: CharacterControl v0.84b
Post by: strazer on Wed 06/05/2009 12:38:28
From the readme coming with the original package:

Quote
You are free to use this for any game, free or commercial. A credit would be
nice but is not necessary.

So no license, you're free to do with it as you please. :)
Title: Re: MODULE: CharacterControl v0.84b
Post by: Dualnames on Thu 07/05/2009 11:52:03
Quote from: strazer on Wed 06/05/2009 12:38:28
From the readme coming with the original package:

Quote
You are free to use this for any game, free or commercial. A credit would be
nice but is not necessary.

So no license, you're free to do with it as you please. :)

So nothing? Like CharacterModule v0.84b is property of Strazer and revised by Monkeyo5o6 or something..?
Title: Re: MODULE: CharacterControl v0.84b
Post by: strazer on Thu 07/05/2009 16:35:47
Yep, I've written the module to help fellow AGSers and I expect nothing in return. :)
Title: Re: MODULE: CharacterControl v0.84b
Post by: Tanique on Mon 16/11/2009 01:02:06
Hi guys, first of all thanks in advance for such a great module.  This thing is FABULOUS.

I know this thread hasn't been used in a while but I think it makes more sense to post it here than start a new one.  I was playing with this module for my game (monkey's .85 version using AGS 3.1.2) and I've noticed what might be a bug in the WALK scripting.  If I ever program my background character to walk to any x,y coordinates with odd values, she'll walk there, but won't continue the rest of the script.  As long as her WALK coordinates are even numbers, the script runs smoothly.  Is this a known bug?  I'm thinking it may have something to do with AGS 3's ability to run high resolution coordinates in the script.....but I'm really not sure.  The project I'm having problems with is 640*400 resolution.

Just thought I'd bring this to your attention.  Thanks again for this magical piece of scripting, keep up the good work!
Title: Re: MODULE: CharacterControl v0.84b
Post by: placyd on Tue 10/08/2010 17:53:45
When I try to run my game with this module, it writes the following error message:
CharacterControl module error: This module requires at least v0.83 of the CharacterControl RunScript module.
I'm using AGS 3.1.2 SP1 with CharacterControl v0.85
What could be the problem?
Title: Re: MODULE: CharacterControl v0.84b
Post by: placyd on Tue 17/08/2010 12:35:35
Can anyone help me?  :'(
Title: Re: MODULE: CharacterControl v0.84b
Post by: Dualnames on Tue 17/08/2010 14:03:58
Quote from: placyd on Tue 10/08/2010 17:53:45
When I try to run my game with this module, it writes the following error message:
CharacterControl module error: This module requires at least v0.83 of the CharacterControl RunScript module.
I'm using AGS 3.1.2 SP1 with CharacterControl v0.85
What could be the problem?

I found that line on the header and I removed it. And the Character control seems to work fine with me. Even released a game with it. :D
Title: Re: MODULE: CharacterControl v0.84b
Post by: placyd on Fri 20/08/2010 08:22:21
Quote from: Dualnames on Tue 17/08/2010 14:03:58
I found that line on the header and I removed it. And the Character control seems to work fine with me. Even released a game with it. :D

Wow, I would have never thought that, but it's working! :D
Thanks!
Title: Re: MODULE: CharacterControl v0.84b
Post by: placyd on Fri 20/08/2010 08:59:08
I've run into another problem  :(

My code is:
CharacterControl.CreateChain(1, "ROOM:6,360,360; WALK:625,400; WAIT: 40,80; WALK:760,420; WALK:625,400;");
CharacterControl.StartExecuting(cSecur, 1);

The character does everything, except the last part - he stops at coordinates 760,420.
And I can't write anything after it, he always stops that point...
???

Edit:
I've read back and found this quote by Tanique, that he had the same problem, when not even numbers was used as coordinates.
If I use 624 instead of 625 in the script it works perfectly!  ;)
Title: Re: MODULE: CharacterControl v0.84b
Post by: monkey0506 on Fri 20/08/2010 09:11:00
Sorry I haven't responded yet, but I got a chance to look at this..from my previous post:

Quote from: monkey_05_06NOTE: The above download link only includes the SCM for the module. It does not include any documentation, the CharacterControl_RunScript module, demo game, etc., etc. You must download the 0.84 package for these files.

You should not simply be deleting the line in question, as the module does expect the RunScript module to be present. As noted, you must download both the 0.84 and 0.85 packages since I was too lazy to include all of the 0.84 files as required.

For any issues beyond that..well I didn't write the module, just the conversion for AGS 3.0+.. ::)
Title: Re: MODULE: CharacterControl v0.84b
Post by: placyd on Fri 20/08/2010 13:34:09
Ok, but I can't import both module. How shold I make it work?
Title: Re: MODULE: CharacterControl v0.84b
Post by: Pinback on Sat 21/08/2010 23:15:40
Quote from: placyd on Fri 20/08/2010 13:34:09
Ok, but I can't import both module. How shold I make it work?

Huh, I had this same problem too.
Title: Re: MODULE: CharacterControl v0.84b
Post by: monkey0506 on Mon 23/08/2010 01:30:08
Just replace the CC module v0.84 with the v0.85 one..but the CC RunScript module still needs to be imported.
Title: Re: MODULE: CharacterControl v0.84b
Post by: Dualnames on Mon 23/08/2010 02:14:50
I only use one module.  :D
Title: Re: MODULE: CharacterControl v0.84b
Post by: Rocco on Fri 25/05/2012 23:49:33
I'm trying to use this module, but the ChainId and ChainPosition values gets screwed somehow.
The first chainposition is executed and the NPC(s) walks to the first waypoint, but when they reaches the first chain position they are stucked and don't execute the next chainpositions.
When i trace the ChainId i get values like 105466709 and for the ChainPosition similar ones like 106843457, and all CC_controlled have the same values for ChainID and Chainposition.
Dont know what causes this bug.  :cry:
I have 33 chars, and try to use the Module for Char 27 and 28, maybe this causes the strange behavior?

EDIT;
Quote from: placyd on Fri 20/08/2010 08:59:08
I've read back and found this quote by Tanique, that he had the same problem, when not even numbers was used as coordinates.
If I use 624 instead of 625 in the script it works perfectly!  ;)

Quote from: Tanique on Mon 16/11/2009 01:02:06
I know this thread hasn't been used in a while but I think it makes more sense to post it here than start a new one.  I was playing with this module for my game (monkey's .85 version using AGS 3.1.2) and I've noticed what might be a bug in the WALK scripting.  If I ever program my background character to walk to any x,y coordinates with odd values, she'll walk there, but won't continue the rest of the script.  As long as her WALK coordinates are even numbers, the script runs smoothly.  Is this a known bug?  I'm thinking it may have something to do with AGS 3's ability to run high resolution coordinates in the script.....but I'm really not sure. 

Oh man, cost me a sleepless night (and day) to figure that out bymself.  :P
It works fine with even values, maybe a hint in Monkeys posting could prevent others from the same scenario....