Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: KANDYMAN-IAC on Wed 24/08/2016 03:40:20

Title: Character transparency - Basic Scripting Help
Post by: KANDYMAN-IAC on Wed 24/08/2016 03:40:20
Guys, Girls, Non-binaries,

I AM GOING INSANE! Ok, I've got a conversation going on with a character behind a door, I placed them in the scene so that the position of the dialog text is correct. But trying to call the variables for the character to define visibility JUST AREN'T working... I've tried setting visibility = false I've tried setting transparency I am getting no where... I also attempted to scale the character smaller and hide them behind a nonwalkable area... nothing... nothing is affecting the fucking character, it remains...

Code (ags) Select

function room_Load()
{
cEgo.Transparency = 100;



My biggest problem is I don't understand when and how I define variables for characters. Or Functions for interactions, I get half of it, but my syntax is wrong. Is there a set of tutorials for the new engine that can help, the ones written directly by Chris on the main page don't give me enough understanding WHY certain phrases and pieces are called and used together... Are there any scripting tutorials that can help me understand the formatting and procedure to make some headway and context for programming in general?
Title: Re: Character transparency - Basic Scripting Help
Post by: Mandle on Wed 24/08/2016 04:08:32
What colour option did you set for your game?

"NOTE: Transparency only works in 16-bit and 32-bit colour games."
Title: Re: Character transparency - Basic Scripting Help
Post by: KANDYMAN-IAC on Wed 24/08/2016 05:13:10
Thank you Mandle. It's 256. So.... what are my other options to achieve the same result?

Also my question still stands. What should I do about coding... what tutorials and complete beginners guide do you recommend?
Title: Re: Character transparency - Basic Scripting Help
Post by: Scavenger on Wed 24/08/2016 05:46:30
I believe you can use:

Code (ags) Select

cEgo.on = false;


To hide characters in the same manner as objects.
Title: Re: Character transparency - Basic Scripting Help
Post by: Danvzare on Wed 24/08/2016 09:54:36
Quote from: Scavenger on Wed 24/08/2016 05:46:30
I believe you can use:

Code (ags) Select

cEgo.on = false;


To hide characters in the same manner as objects.
Woah, that's an actual function in the game engine?!? 8-0
I thought you could only do that to objects.
That will be useful in the future.
Title: Re: Character transparency - Basic Scripting Help
Post by: KANDYMAN-IAC on Wed 24/08/2016 10:59:30
So how and where would I use that code? Do I call a function and then put it between the curly brackets?

This is my issue, I can look up necessary attributes in the manual, but I don't know how to connect them, or place them to be called or accessed. :/

(Last time I used AGS the Attribute editor was just being phased out >:( )
Title: Re: Character transparency - Basic Scripting Help
Post by: Slasher on Wed 24/08/2016 11:10:39
So, the character being spoken to is behind a door.... Why not make the door baseline large than the character so he is hidden behind it and not seen?

That's if I understand you correctly...

Learn stuff from wherever you can find it. The biggest learning curve is actually doing it..

You can define variables in the global variables pane in the editor, and in some cases in the global script.

You can call them from within your room scripts.. etc

Good luck

Title: Re: Character transparency - Basic Scripting Help
Post by: Khris on Wed 24/08/2016 12:21:15
The question where to put code is the big one.

In general, AGS is event based. Which means whenever an event happens (player clicks "look at" cursor on inv item) the engine checks whether a script function is linked to the event and if so, calls it.
It also calls various built-in functions at various times (e.g. on_mouse_click), and to control what happens in the game, you fill those functions with code.

You already had the line in the proper place, namely in "room_Load", which is a function that is called after AGS loads the room, before the room is turned visible / faded in.
The code will run as long as you didn't just manually add that function to the script but also properly linked it (i.e. it also says "room_Load" in the room's event panel).

function room_Load()
{
  cEgo.on = false;
}
Title: Re: Character transparency - Basic Scripting Help
Post by: NickyNyce on Wed 24/08/2016 12:38:08
These videos are really helpful when you get started.

https://youtu.be/_lghOGrET2A
Title: Re: Character transparency - Basic Scripting Help
Post by: Cassiebsg on Wed 24/08/2016 18:18:30
I would have just done like slasher suggested... but that's only cause I didn't know better. Now I do! :-D
Title: Re: Character transparency - Basic Scripting Help
Post by: dayowlron on Wed 24/08/2016 19:58:43
There is so many ways to do this. all of the above can work or you can make the room larger than resolution and place the character off screen beyond what would show up based on walkable areas. I did that once before. I had walkable areas on the entire left side and across the bottom then placed a character I wanted in the room but not to show up on the screen in the upper right corner.
Title: Re: Character transparency - Basic Scripting Help
Post by: Khris on Wed 24/08/2016 23:42:25
This is about being able to just let the other character .Say() stuff, without having to worry about where the text is going to appear. Moving them off screen means you can no longer use standard dialog scripts since you'd have to use SayAt().
(Also, you don't have to make the room bigger than the screen to be able to place characters off screen, setting their .y to -1 or -1000 is always fine, regardless of room size.)

slasher's solution is fine in principle, _if_ the door is either an object or a walkbehind.
Still, the simplest way is to not render the character in the first place.
Title: Re: Character transparency - Basic Scripting Help
Post by: KANDYMAN-IAC on Thu 25/08/2016 06:02:21
Ugh... Khris, yeah I've been manually adding code cause I didn't/don't know how to add things through the editor. :(
Title: Re: Character transparency - Basic Scripting Help
Post by: KANDYMAN-IAC on Thu 25/08/2016 06:51:31
NICKY NYCE THANK YOU!
Title: Re: Character transparency - Basic Scripting Help
Post by: Khris on Thu 25/08/2016 12:26:22
Just for reference, here's the section that explains events: http://www.adventuregamestudio.co.uk/manual/index.html?page=acintro3.htm