Announcement: Why not try our official idea generator for inspiration when making puzzles?


Caravel Forum : DROD Boards : Architecture : Scripting question for a silly idea
New Topic New Poll Post Reply
Poster Message
Camwoodstock
Level: Master Delver
Avatar
Rank Points: 115
Registered: 07-02-2014
IP: Logged
icon Scripting question for a silly idea (+1)  
I want to make a hold that has one gimmick. All the enemies are roaches, but you have no sword. Instead, pressing the . key will have the special effect of making every roach in a radius (I wanna get 5x5 if I can, with the player in the center) flee like a roach queen does.

Now you may say "this is just the scared roaches in BM with extra steps"--and you're right. But the thing is, I can't figure out how to code it so the radius is both:
1) not always around--it's only present for the 1 turn you press . and then leaves
2) is a 5x5 radius around the player instead of the cone that it is in BM
3) play a sound effect when . is pressed (need this for a secret motive)

If someone here knows how to tweak the code, please help. I have a very, very dumb idea for a hold. And I need it.

____________________________
Camwoodstock - The Epic Blunder, Dugan's Best Janitor, Rooted Hold Runner, Lowest Point Watcher, and 132nd Skywatcher (and 13th Gel Authority)
Mastered all of GatEB, KDD 2.0, JtRH, and TCB! | Saw The Second Sky! (lots of secrets left!)

Her/him | & | Steam | Backloggery
10-01-2019 at 12:21 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
averagemoe
Level: Smiter
Avatar
Rank Points: 487
Registered: 03-22-2012
IP: Logged
icon Re: Scripting question for a silly idea (0)  
Put this in the script for the individual roaches as a way to figure out if they're in the 5X5 radius.

Click here to view the secret text


The result of a Wait for entity Player query should then determine if it's in range.

And remember to set all four of those _MyScript variables to -9999 immediately after asking, regardless of the result.

____________________________
There are two types of sheep in the world. Those who jump off a bridge when told to, and those who jump off a bridge when told not to. Don't be either.
10-01-2019 at 02:35 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1531
Registered: 06-13-2015
IP: Logged
icon Re: Scripting question for a silly idea (0)  
The answer to some of your questions depends on exactly what behavior you're after. Do you want the player activating special command to cause the roaches in the radius to "turn into running away roaches" in the sense that they keep running away until they hit a wall or something, but the radius changing roaches only lasts one turn? Or: Do you want each use of the special command key to cause roaches within the radius to make one move only as though they were queens?

____________________________
109th Skywatcher

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

10-01-2019 at 02:52 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Camwoodstock
Level: Master Delver
Avatar
Rank Points: 115
Registered: 07-02-2014
IP: Logged
icon Re: Scripting question for a silly idea (0)  
Xindaris wrote:
The answer to some of your questions depends on exactly what behavior you're after. Do you want the player activating special command to cause the roaches in the radius to "turn into running away roaches" in the sense that they keep running away until they hit a wall or something, but the radius changing roaches only lasts one turn? Or: Do you want each use of the special command key to cause roaches within the radius to make one move only as though they were queens?

I want their movement to have them keep running away until they hit a wall.

____________________________
Camwoodstock - The Epic Blunder, Dugan's Best Janitor, Rooted Hold Runner, Lowest Point Watcher, and 132nd Skywatcher (and 13th Gel Authority)
Mastered all of GatEB, KDD 2.0, JtRH, and TCB! | Saw The Second Sky! (lots of secrets left!)

Her/him | & | Steam | Backloggery
10-01-2019 at 06:22 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Dying Flutchman
Level: Smiter
Avatar
Rank Points: 406
Registered: 01-27-2017
IP: Logged
icon Re: Scripting question for a silly idea (0)  
I don't have an editor right now, so I can't give you exact give details, but here's what I'd start out with:

1. Make a custom monster, based on a roach queen. Give it custom graphics from a normal roach.
2. Set up a loop for the custom roach/queenie-thing
2a. Check if special command used, and if it is, check if within 5 tiles.
2b. Depending inn the check, use 'turn into monster' to make a roach queen, or use 'move to player' to behave like a normal roach.

Note: you might need to tweek the imperative for movement time, I'm not sure.
Also: once the roach has turned into a queen, it status a queen in this setup.

If you need fully dynamic behaviour, where the queen can also turn back into a roach, you'll had to completely script the behaviour during the queen-fase, which I expect to be more difficult.
Also also: this procedure would turn the monster into a real queen, so it would also start laying eggs.

Hmmm, probably not really what you'd like, but perhaps it helps you get going.

____________________________
Autocorrect is not my friend. Apologies for the typos.
10-01-2019 at 07:05 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
mauvebutterfly
Level: Smitemaster
Avatar
Rank Points: 720
Registered: 05-03-2015
IP: Logged
icon Re: Scripting question for a silly idea (+1)  
You could probably save yourself some work by getting the "Scared Roach" script from the TSS custom elements pack and using that as the basis for your monster.

____________________________
106th Skywatcher
10-01-2019 at 09:29 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Dying Flutchman
Level: Smiter
Avatar
Rank Points: 406
Registered: 01-27-2017
IP: Logged
icon Re: Scripting question for a silly idea (0)  
mauvebutterfly wrote:
You could probably save yourself some work by getting the "Scared Roach" script from the TSS custom elements pack and using that as the basis for your monster.

Wait! What did I miss?! Is all that stuff out there for us to enjoy and abuse?

I knew about the graphics, but not about all the scripting.

Great.

____________________________
Autocorrect is not my friend. Apologies for the typos.

[Last edited by Dying Flutchman at 10-01-2019 12:05 PM]
10-01-2019 at 11:40 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
mauvebutterfly
Level: Smitemaster
Avatar
Rank Points: 720
Registered: 05-03-2015
IP: Logged
icon Re: Scripting question for a silly idea (0)  
Yes, it contains the full scripts for the custom monsters, the custom weapons (including the flashlight and scared roach) and even some of the "minigames" or whatever you want to call them.

Massive spoilers for people who haven't completed The Second Sky yet, obviously, so I'd recommend doing that first if you haven't yet, but I think most people reading this will probably have played through that hold a long time ago by now.

____________________________
106th Skywatcher
10-01-2019 at 01:22 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1531
Registered: 06-13-2015
IP: Logged
icon Re: Scripting question for a silly idea (0)  
Sight unseen, I would guess that you can just change the conditions for the "scared roach" to go into run away mode into "am I in the 5x5 near beethro" (something like what averagemoe posted above) + "wait for player input special command".

____________________________
109th Skywatcher

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


[Last edited by Xindaris at 10-01-2019 03:37 PM]
10-01-2019 at 03:36 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
mauvebutterfly
Level: Smitemaster
Avatar
Rank Points: 720
Registered: 05-03-2015
IP: Logged
icon Re: Scripting question for a silly idea (0)  
Yeah, that should work. It'd probably also be relatively simple to modify the flashlight area and to have it toggle on for a turn whenever you use the special command. In fact, if you do that, you might not need to touch the scared roach script at all.

____________________________
106th Skywatcher
10-01-2019 at 03:43 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
RoboBob3000
Level: Smitemaster
Avatar
Rank Points: 1978
Registered: 10-23-2003
IP: Logged
icon Re: Scripting question for a silly idea (0)  
I outline details of the BM scripting in this post: http://forum.caravelgames.com/viewtopic.php?TopicID=38640&page=0#387104

FlashlightManager sets coordinate values for each ScaredRoach to check based on the direction the player is facing. That's the first big piece you'd need to modify.

The ScaredRoach script performs its coordinate checks under the label titled CheckPointForFlashlight. You'll need to add lines of code to account for each new flashlight coordinate variable you create.

Your interest in my scripts delights me! :D



____________________________
http://beepsandbloops.wordpress.com/
10-01-2019 at 05:48 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
RoboBob3000
Level: Smitemaster
Avatar
Rank Points: 1978
Registered: 10-23-2003
IP: Logged
icon Re: Scripting question for a silly idea (+6)  
Here's a quick modification of FlashlightManager that might meet your needs (with pseudocode in a couple places because I'm away from my DROD PC right now)

Click here to view the secret text


And ScaredRoach:
Click here to view the secret text


____________________________
http://beepsandbloops.wordpress.com/
10-01-2019 at 06:18 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
averagemoe
Level: Smiter
Avatar
Rank Points: 487
Registered: 03-22-2012
IP: Logged
icon Re: Scripting question for a silly idea (0)  
RoboBob3000 wrote:
Here's a quick modification of FlashlightManager that might meet your needs (with pseudocode in a couple places because I'm away from my DROD PC right now)

Click here to view the secret text


And ScaredRoach:
Click here to view the secret text

Eh, that's a flexible method, but in this specific case my way's more efficient. You don't even need a flashlight manager, or whatever passes. The "hitbox" geometry is simple enough that the roaches can make the calculation themselves.

____________________________
There are two types of sheep in the world. Those who jump off a bridge when told to, and those who jump off a bridge when told not to. Don't be either.

[Last edited by averagemoe at 10-01-2019 09:29 PM]
10-01-2019 at 09:27 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Camwoodstock
Level: Master Delver
Avatar
Rank Points: 115
Registered: 07-02-2014
IP: Logged
icon Re: Scripting question for a silly idea (0)  
RoboBob3000 wrote:
Here's a quick modification of FlashlightManager that might meet your needs (with pseudocode in a couple places because I'm away from my DROD PC right now)

Click here to view the secret text


And ScaredRoach:
Click here to view the secret text

Almost there... I can get them to repel, but it's a permanent radius--not activated for one turn on pressing the . key.

____________________________
Camwoodstock - The Epic Blunder, Dugan's Best Janitor, Rooted Hold Runner, Lowest Point Watcher, and 132nd Skywatcher (and 13th Gel Authority)
Mastered all of GatEB, KDD 2.0, JtRH, and TCB! | Saw The Second Sky! (lots of secrets left!)

Her/him | & | Steam | Backloggery
10-03-2019 at 06:01 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
RoboBob3000
Level: Smitemaster
Avatar
Rank Points: 1978
Registered: 10-23-2003
IP: Logged
icon Re: Scripting question for a silly idea (0)  
Could you share your code?

____________________________
http://beepsandbloops.wordpress.com/
10-03-2019 at 08:11 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Camwoodstock
Level: Master Delver
Avatar
Rank Points: 115
Registered: 07-02-2014
IP: Logged
icon Re: Scripting question for a silly idea (0)  
RoboBob3000 wrote:
Could you share your code?

Well, it's the exact same as your code as you sent it to me. I have the Flashlight Manager set to none and the Scared Roach set to a Roach, however. If you insist, though...

Manager
Click here to view the secret text


Roach
Click here to view the secret text


____________________________
Camwoodstock - The Epic Blunder, Dugan's Best Janitor, Rooted Hold Runner, Lowest Point Watcher, and 132nd Skywatcher (and 13th Gel Authority)
Mastered all of GatEB, KDD 2.0, JtRH, and TCB! | Saw The Second Sky! (lots of secrets left!)

Her/him | & | Steam | Backloggery
10-03-2019 at 08:36 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
RoboBob3000
Level: Smitemaster
Avatar
Rank Points: 1978
Registered: 10-23-2003
IP: Logged
icon Re: Scripting question for a silly idea (0)  
Camwoodstock wrote:
RoboBob3000 wrote:
Could you share your code?

Well, it's the exact same as your code as you sent it to me. I have the Flashlight Manager set to none and the Scared Roach set to a Roach, however. If you insist, though...
Ah, therein lies the problem. I put in a couple of incomplete lines in asterisks in the FlashlightManager for the things you need to fill in yourself (because I couldn't remember the syntax for those things off the top of my head). Under the "if", you'll need to add "wait for player input special command" (or whatever that command is). Immediately under that, you'll need to add a script line to play your sound.

Edit: A forum search suggests that the syntax in question is "Wait for player to input Special command"

____________________________
http://beepsandbloops.wordpress.com/

[Last edited by RoboBob3000 at 10-03-2019 09:32 PM]
10-03-2019 at 09:27 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Camwoodstock
Level: Master Delver
Avatar
Rank Points: 115
Registered: 07-02-2014
IP: Logged
icon Re: Scripting question for a silly idea (+1)  
It works! Only thing I can think of is maybe a particle effect at the player's spot.

____________________________
Camwoodstock - The Epic Blunder, Dugan's Best Janitor, Rooted Hold Runner, Lowest Point Watcher, and 132nd Skywatcher (and 13th Gel Authority)
Mastered all of GatEB, KDD 2.0, JtRH, and TCB! | Saw The Second Sky! (lots of secrets left!)

Her/him | & | Steam | Backloggery
10-04-2019 at 02:01 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Architecture : Scripting question for a silly idea
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.