Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : Custom character script/texture issues (I'm having troubles with custom characters. Anyone out there who could help me out?)
New Topic New Poll Post Reply
Poster Message
JustSomeDude
Level: Goblin
Avatar
Rank Points: 21
Registered: 11-08-2018
IP: Logged

File: Screen Shot 2018-11-07 at 10.10.47 PM.png (327.9 KB)
Downloaded 9 times.
License: Public Domain
icon Custom character script/texture issues (+4)  
Hello, good people of the CaravelNet forums!

I am new to this site. Just created my account like an hour ago, actually. However, as my mom has been a fan of the DRoD series, I have been playing for a long time. Because of this, I am familiar with many editor features. Unfortunately, custom characters are not one of these features.

I am having issues with my custom character. It is intended to be a key fragment that shines on the floor. When touched, it adds one value to a variable called "keyFragmentsCollected." ...At least, that's what was intended.

First issue: the texture
The key fragment texture is meant to be a small beige lump on the floor with a transparent glow that alternates between blue and purple every 750 milliseconds. The animation works fine and the texture renders, but it renders with no transparency to speak of, thus making a white square background with a solid blob of color that was meant to be the soft glow. The texture is a .png file, so I would assume it would tolerate transparency. I've attempted differently-sized tilesets (9x4) with the texture in both the north position and the "no orientation" position, but nothing seems to work.

Second issue: the global script
I don't have much experience with custom character global scripts, so I expected to have some problems, but I didn't expect the global script to not run at all! The script begins with a "wait for player to touch me" command, but for some reason, it does not activate at all. I've tried setting up said command outside of the global script to ensure it works as intended, and it does, but whenever I try to run the global script, it decides it doesn't want to run. I have tried putting a speech command directly after the wait command to see if the error was somewhere else, and I can confirm that, due to the speech command not firing, it is an issue with the wait command. The global script is attached if anyone would like to take a look at it to see if I screwed up somewhere.

Thank you!

____________________________
Raised by one who knew the roach well
And was well-acquainted with the dungeon way.
Now I live on, my story to tell,
To ensure our legacy surely will stay.

[Last edited by JustSomeDude at 11-08-2018 03:30 AM]
11-08-2018 at 03:27 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Insoluble
Level: Smitemaster
Avatar
Rank Points: 1603
Registered: 09-04-2014
IP: Logged
icon Re: Custom character script/texture issues (+3)  
Welcome to the forum! Good to see some new architects trying out scripting. It's hard to say exactly what the issue is without downloading an example of what you've done so far. Would you be willing to attach a small sample hold with your script?

It looks like when you say "Global Script", you're talking about what the game calls the "default script". The "default script" will only run if you don't have any other commands on the "customize character" page (the one that loads up when you first click on your custom character) so make sure that's completely blank. Otherwise the script you posted looks like it should at least be printing the speech text. Also, just so you know, you should be able to implement the script you want in the "customize character" screen and not rely on the "default script" at all. Variables default to global, so the KeyFragmentsCollected variable you created will actually be shared across any characters you create. If you want multiple instances of the key fragments, you can just copy and paste the whole character and they'll all update the variable.

Other architects have placed collectibles like that in holds before, so you may want to take a look at what they've done. For example, I made something similar in the hold "Delay" which is anyone edit, so feel free to download it and copy the script for the "time key" directly. (Warning: I had no idea what I was doing at the time so the scripting, while functional, is pretty bad.) http://forum.caravelgames.com/viewtopic.php?TopicID=40444

I've also worked with custom image files before and transparency has worked for me in png files, but there may be some differences between different builds and on different platforms. Are you running on Windows or Mac? Do you have the latest build.
EDIT: Right, as Xindaris mentions below it looks like I actually ended up using image overlays to make transparency happen. Again, feel free to check the scripting in "Delay" linked above to see if that helps

____________________________
Links to neat forum tools that I always have trouble finding:
Click here to view the secret text


[Last edited by Insoluble at 11-08-2018 04:14 AM]
11-08-2018 at 04:01 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 902
Registered: 06-13-2015
IP: Logged

File: InvisDoor.PNG (135 bytes)
Downloaded 4 times.
License: Public Domain
icon Re: Custom character script/texture issues (+4)  
Hi, welcome to the forum. As someone who's got some experience making DRODscript do what I want it to, let me warn you to be prepared for madness if your wishes get sufficiently complex. Anyway, I'll try and answer your queries:

First question:
in DROD, character graphics assign a specific shade of gray to "transparent"; png "actual transparency" doesn't count. If you want some kind of gradient of transparency then I think you'll have to venture into the lands of Image Overlay, and I can't help you there. But if you just want parts of your sprite to be invisible, I've attached an image consisting of the "invisible gray" color to this post.

Second question:
What "global script" does is basically generate a copy of whatever character you're assigning to be the "global script" every time the player walks into a room from then on, including making one when the command is first issued. If what you want is a character with a specific location that changes from one room to another, then global script is not what you want at all. When a character has a default script (as it appears that yours does), just place a character with that appearance assigned in the room itself, right where you want it to be, and don't edit anything at all into the individual instance's script. It'll use the default script then.

EDIT:
Whoops, I got some kind of error when trying to post my reply and it looks like Insoluble beat me to the punch as a result. Ah well.

EDIT 2:
If you do want slightly more complex scripting at some later point, this information may prove useful to you.

EDIT 3:
When you want to post your code here on the forum, instead of an image it's often more helpful to others if you select your code, press ctrl+B on the keyboard to copy it, and then paste it in here within {code} tags (brackets instead of curly braces, as with all bbcode).

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text


[Last edited by Xindaris at 11-08-2018 04:12 AM]
11-08-2018 at 04:06 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
navithmastero
Level: Smiter
Avatar
Rank Points: 390
Registered: 01-03-2012
IP: Logged
icon Re: Custom character script/texture issues (+2)  
Interestingly, when it comes to image overlays, actual transparency *does* count.

Also, welcome!

____________________________
Member of the Snake Appreciation Society

My stuff:
Click here to view the secret text


[Last edited by navithmastero at 11-08-2018 02:04 PM]
11-08-2018 at 01:59 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
JustSomeDude
Level: Goblin
Avatar
Rank Points: 21
Registered: 11-08-2018
IP: Logged
icon Re: Custom character script/texture issues (+1)  
Thank you all for replying so quickly!

Concerning the texture, I did not even consider image overlays as a possibility. However, I have been told transparent tilesets are possible. Xindaris, does the game automatically make grey pixels such as the ones that make up InvisDoor.png transparent, or do I basically need to make the area behind the key fragment the same texture as the floor it is on top of?

Concerning the script, I did actually write my "global script" under the default script section. :facepalm: Now I need the "start global script" command explained to me. Can someone do that please?

____________________________
Raised by one who knew the roach well
And was well-acquainted with the dungeon way.
Now I live on, my story to tell,
To ensure our legacy surely will stay.
11-08-2018 at 05:29 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
hyperme
Level: Smitemaster
Avatar
Rank Points: 566
Registered: 06-23-2006
IP: Logged
icon Re: Custom character script/texture issues (+2)  
Transparency: DROD automatically treats each pixel that's a specific shade of grey as transparent. That specific shade's RGB values are (192, 192, 192). Note that DROD RPG uses a different colour for transparency for no particular reason.

Start Global Script adds the script to the list of 'Global Scripts'. Each Global Script runs at the start of every room. They aren't that useful unless you need to track something in literally every room.

Default scripts run for custom characters if that character has no commands in it's script. There is currently no way to have a character run commands, and then run it's default script.

Image Overlays are explained in the help files. You can do various things with them, such the fancy whirlpools/vortices that appear in The Second Sky.

____________________________
[Insert witty comment here]
Qzvlkx?
11-08-2018 at 09:04 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
JustSomeDude
Level: Goblin
Avatar
Rank Points: 21
Registered: 11-08-2018
IP: Logged
icon Re: Custom character script/texture issues (+1)  
Thank you, hyperme, for explaining transparency and scripts. I am already educated in the ways of image overlays and have used some in my hold already, but I acknowledge you took time to define those too. Again, thank you. :thumbsup

____________________________
Raised by one who knew the roach well
And was well-acquainted with the dungeon way.
Now I live on, my story to tell,
To ensure our legacy surely will stay.
11-08-2018 at 09:08 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 902
Registered: 06-13-2015
IP: Logged
icon Re: Custom character script/texture issues (+1)  
quote:
hyperme wrote: There is currently no way to have a character run commands, and then run it's default script.

Well--it's not TOO hard to make a workaround that has the same effect. Just put an invisible entity in the spot you want, have it run whatever initial commands, followed by Generate Entity [whatever default script you want] [whatever location you want it in] and then an Imperative Die if you feel like getting rid of the "initializer".

____________________________
109th Skywatcher

Here are some links to Things!
Click here to view the secret text

11-09-2018 at 02:29 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : Custom character script/texture issues (I'm having troubles with custom characters. Anyone out there who could help me out?)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.