Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : Conditional Halph (Can someone help me script this?)
New Topic New Poll Post Reply
Poster Message
averagemoe
Level: Smiter
Avatar
Rank Points: 487
Registered: 03-22-2012
IP: Logged
icon Conditional Halph (0)  
I'm attempting to create a custom monster-ish thing but I need some advice scripting it. What I'm trying to create is a Halph that will follow the player into the room exactly like a normal Halph, but only if a particular variable is in a particular state. (Let's call it "halphenter" = 1) Otherwise it doesnt appear. I also want it to only follow from particular entrances, perferably ones marked by placing an invisible NPC on them running the default script.

In case you need a refresher on how Halph entrances work, If on turn 0 the player is on a tile that is marked for Halph to follow, he will wait until turn 5, and then appear on that tile as soon as it's open. No need to help with following the player a few steps, it will do that automatically when executing the "turn into monster" command.

____________________________
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-20-2015 at 08:29 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
disoriented
Level: Smitemaster
Avatar
Rank Points: 2379
Registered: 08-07-2007
IP: Logged
icon Re: Conditional Halph (0)  
Maybe you could put a character on the square that halph would appear at, blocking him from showing up unless the var is set correctly.

____________________________
34th Skywatcher

Best to PM me, since I might miss your message on CaravelNet chat.
10-20-2015 at 08:56 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
Someone Else
Level: Smitemaster
Avatar
Rank Points: 1299
Registered: 06-14-2005
IP: Logged
icon Re: Conditional Halph (0)  
Or, easier, just have the character ask:
Is it the first turn?
If so, is the player on my space?
If so, is the flag set?
If so, wait 5 then appear and turn into monster.
10-20-2015 at 09:03 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
Xindaris
Level: Smitemaster
Avatar
Rank Points: 1527
Registered: 06-13-2015
IP: Logged
icon Re: Conditional Halph (0)  
The way I'd be inclined to handle the problem is to use a single NPC in each room whose first command is to check whether the player is "at" one of the entrances Halph should enter from and then exactly which tile he's in, and then run a 5-turn loop where it tries to either teleport itself there and "Turn into monster" or use Generate Entity Halph.

If you're saying you want to put an NPC at each tile Halph could possibly appear at (for your own map-visibility purposes I presume?) then you could put a simple script on each of those NPCs that essentially says "Is the player on top of me?" at turn 0, and if the answer is yes they can set a variable to say which tile the generating/halph-becoming NPC should go to, which would eliminate the need for said NPC to "find" the right tile in any way and allow it to only be the 5-turn loop of "trying" to appear.

____________________________
109th Skywatcher

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

10-20-2015 at 09:05 PM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
averagemoe
Level: Smiter
Avatar
Rank Points: 487
Registered: 03-22-2012
IP: Logged
icon Re: Conditional Halph (0)  
I tried setting "_MyscriptX" and "_MyscriptY" to "_MyX" and "_MyY" respectively, but he only appears if the square in question is 0,0. I think I read bout a bug with those variables in the patch notes for 5.0.2 though, so I'll see if I can pull it off after that.

____________________________
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-20-2015 10:43 PM]
10-20-2015 at 10:40 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Conditional Halph (0)  
averagemoe wrote:
I tried setting "_MyscriptX" and "_MyscriptY" to "_MyX" and "_MyY" respectively, but he only appears if the square in question is 0,0. I think I read bout a bug with those variables in the patch notes for 5.0.2 though, so I'll see if I can pull it off after that.
This isn't a bug. You can't set the position of a character to player's position because monster and player can't occupy the same square. Well, it might yet work incorrectly somehow in 5.0.1 but in the update it will just ignore the move. It may change one of the coordinates (the first you set) but not the other.
Nevermind :P.

____________________________
My website | Facebook | Twitter

[Last edited by skell at 10-21-2015 08:44 AM]
10-20-2015 at 11:21 PM
View Profile Send Private Message to User Send Email to User Visit Homepage 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: Conditional Halph (0)  
skell wrote:
averagemoe wrote:
I tried setting "_MyscriptX" and "_MyscriptY" to "_MyX" and "_MyY" respectively, but he only appears if the square in question is 0,0. I think I read bout a bug with those variables in the patch notes for 5.0.2 though, so I'll see if I can pull it off after that.
This isn't a bug. You can't set the position of a character to player's position because monster and player can't occupy the same square. Well, it might yet work incorrectly somehow in 5.0.1 but in the update it will just ignore the move. It may change one of the coordinates (the first you set) but not the other.
I think the problem here might be a mixup between _MyX and _X. The former refers to the NPCs location, the latter refers to the player's location. The variables _MyScriptX and _MyScriptY should be set to _X and _Y before attempting an AppearAt.

____________________________
http://beepsandbloops.wordpress.com/
10-20-2015 at 11:43 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: Conditional Halph (0)  
My flow for this problem:

-On turn zero, is player on valid Halph Spawn tile? If yes, grab the player's coordinates (from _X and _Y) and save to temporary variables. Else, go to label at end of script (but don't call "End").
-Wait 5
-Is HalphFlag true? If yes, set _MyScriptX and _MyScriptY and attempt AppearAt until successful. Else, go to label at end of script (but don't call "End").

____________________________
http://beepsandbloops.wordpress.com/
10-20-2015 at 11:50 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3734
Registered: 12-28-2004
IP: Logged
icon Re: Conditional Halph (+1)  
RoboBob3000 wrote:
skell wrote:
averagemoe wrote:
I tried setting "_MyscriptX" and "_MyscriptY" to "_MyX" and "_MyY" respectively, but he only appears if the square in question is 0,0. I think I read bout a bug with those variables in the patch notes for 5.0.2 though, so I'll see if I can pull it off after that.
This isn't a bug. You can't set the position of a character to player's position because monster and player can't occupy the same square. Well, it might yet work incorrectly somehow in 5.0.1 but in the update it will just ignore the move. It may change one of the coordinates (the first you set) but not the other.
I think the problem here might be a mixup between _MyX and _X. The former refers to the NPCs location, the latter refers to the player's location. The variables _MyScriptX and _MyScriptY should be set to _X and _Y before attempting an AppearAt.
Bah, you are right. Note to self: don't multitask.

____________________________
My website | Facebook | Twitter
10-21-2015 at 08:43 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
averagemoe
Level: Smiter
Avatar
Rank Points: 487
Registered: 03-22-2012
IP: Logged
icon Re: Conditional Halph (0)  
An update, I got it working. I'm not entirely sure the hold will ever actually be published, but at least I know how to make one of these things.

____________________________
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.
06-07-2016 at 05:50 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : Conditional Halph (Can someone help me script this?)
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.