Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Isegrim on Thu 23/10/2003 12:26:11

Title: know an EASY way to make a character apperar in different forms?
Post by: Isegrim on Thu 23/10/2003 12:26:11
Hi there!

I want to make a Game character which changes his appearance several times in the game,
e.g. unarmored, battle gear, tournament gear, monk's robe, etc.
My first idea was to use multiple characters. Then I realized that I always have to check for the current character in the script, have to meddle with the Inventories whenever I change etc.
I know how to do it the way described above. But since QFG 4 1/2 does similar things with the cloaks, I hope there is an easier way to achieve my goal....
Title: Re:know an EASY way to make a character apperar in different forms?
Post by: Timosity on Thu 23/10/2003 12:49:14
SetCharacterView(EGO,5); //will set character 'EGO' to view 5

you can use this to set all the characters views

just remember "ReleaseCharacterView(EGO);" will return the character to its original view, if it needs to return to a different view just use the SetCharacterView again

It goes in the script where you want it to change.

Note: it's probably a good idea to keep track of which view you are in using global ints, as you may only be able to interact with certain objects/hotspots in a certain view, or if you run an animation that can occur in different views.

eg. If you press a button when you have armor on, the animation might use the characters normal view for pressing the button, instead of the armor view. (note: you'd have to make a view that contains the animation in each of the characters costumes)

eg2.
SetGlobalInt(10,0); //unarmored (set to this when he/she returns to normal view)
SetGlobalInt(10,1); //battle gear (set to this when he/she is set to battle gear view)
SetGlobalInt(10,2); // tournament gear
SetGlobalInt(10,3); //monk's robe
etc

Hope that helps

~Tim
Title: Re:know an EASY way to make a character apperar in different forms?
Post by: Isegrim on Thu 23/10/2003 13:29:23
Thanks a lot! ;D
Title: Re:know an EASY way to make a character apperar in different forms?
Post by: Ishmael on Thu 23/10/2003 13:53:22
Using ChangeCharacterView, SetCharacterSpeech and maybe SetCharacterIdle might do the job better, since then the character could be able to walkalk in the right appearance for sure...
Title: Re:know an EASY way to make a character apperar in different forms?
Post by: RickJ on Thu 23/10/2003 22:57:01
You may want to reconsider using multiple characters.  You can use the GetPlayerCharacter() function to  return the player character ID in place of a constant such as EGO.  So, for example you would do this:

character[GetPlayerCharacter()].room = 42;

instead of this:

character[EGO].room = 42;


Title: Re:know an EASY way to make a character apperar in different forms?
Post by: Isegrim on Fri 24/10/2003 11:57:19
RickJ, what you suggest is just what I used to do.
As I said, it works, but the greatest problem is the inventory.
Multiple characters each have their own inventory, which means I have to use a global array to keep track of the inventory and update each character's inventory every time I change. This, however, is more difficult and error-prone than using just diferent views.
Title: Re:know an EASY way to make a character apperar in different forms?
Post by: Pumaman on Fri 24/10/2003 22:05:58
ChangeCharacterView is the easiest solution for this problem, and is in fact designed for this very scenario.
Title: Re:know an EASY way to make a character apperar in different forms?
Post by: RickJ on Sat 25/10/2003 02:47:51
I hadn't thought about the inventory.  Good point.  
Title: Re:know an EASY way to make a character apperar in different forms?
Post by: Timosity on Sun 26/10/2003 03:48:33
Cool, I wasn't aware of ChangeCharacterView, I've been using the method I mentioned and never thought of looking for any other solution, and I've never noticed anyone mentioning it before.

I guess it's one of those things that I'll see being mentioned all the time now.

It'll save a little bit of scripting from now on, thanks Tk and CJ, It's those little things you pick up all the time that can help save time in the future.
Title: Re:know an EASY way to make a character apperar in different forms?
Post by: Hollister Man on Sun 26/10/2003 19:11:03
I've forgotten the command like that before.  :-) that's why we're here.  All of us miss a command, occasionally.