Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

noob problem with plotscripting

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
hmv9999




Joined: 01 May 2011
Posts: 4

PostPosted: Sun May 22, 2011 12:05 pm    Post subject: noob problem with plotscripting Reply with quote

Hello. I'm new to the whole 'plotscripting' thing, and I've got something of a silly question. I'm trying to make a puzzle where you have to push a minecart full of dynamite next to a cracked wall and detonate it to create a path. I've only started playing with plotscripting today, and I was wondering if anyone could tell me why this doesn't work:

Quote:
define script(1,Explosive1,none)
plotscript,Explosive1,begin

if (npc at spot(22,Cool) then
(
set tag(2,on)
)
end


Any help/tips/anything would be most appreciated!
Back to top
View user's profile Send private message Send e-mail
Voltire
Yep.




Joined: 16 Oct 2010
Posts: 87
Location: A nice man's big, white van.

PostPosted: Sun May 22, 2011 5:54 pm    Post subject: Reply with quote

First you don't have to define the script. Try:
Code:
plotscript, Explosive1, begin

instead of
Code:
define script(1,Explosive1,none)
plotscript,Explosive1,begin


And I'm not 100% sure on this, but I think you may have to define which npc you're talking about.
Back to top
View user's profile Send private message Send e-mail
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Sun May 22, 2011 7:40 pm    Post subject: Reply with quote

Were you following an old tutorial or example that used "define script"? That command has been obsolete for years, so if there is still an example out there somewhere that uses it, I would love to update it to use the new style.

I suspect the problem is when the script is being run.

Your script looks like it is checking the minecart's position correctly, and setting the tag correctly. However, if you run this script when the map loads, it will only check the mine cart's location on that ONE INSTANT that the map loads, before you ever get a chance to move your hero around and push the cart.

To make this script work like you expect it to work, you should use it as the "each step" script for the map. Then it will be run over again each time the hero walks a step. That way, each time you push the mine cart, the script will re-check the position, and set the tag if appropriate.

I suggest modifying your script like this:

Code:

plotscript, Explosive 1, begin
  if (npc at spot(22,8)) then
    set tag(2,on)
  )else(
    set tag(2, off)
  )
end


That way, if you push the mine cart onto the spot, the tag will be turned on... but if you push the mine cart off the spot again before detonating it, the tag will be turned back off.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hmv9999




Joined: 01 May 2011
Posts: 4

PostPosted: Mon May 23, 2011 2:33 am    Post subject: Reply with quote

Thank you thank you thank you!

I'm sure you know how much you've helped me out! I must have been looking at some old resources... no wonder I was having so much trouble with syntax.

Anyway, after a little tweaking, this is what I came up with:

Quote:
plotscript, Explosive 1, begin
if(npc at spot(22,Cool)
then(show text box(6))
else()
end


It seems to work a little smoother than the tag mumbo jumbo. Thanks again!
Back to top
View user's profile Send private message Send e-mail
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Mon May 23, 2011 7:14 am    Post subject: Reply with quote

Excellent!

When you post a script here, you can use the code instead of the quote to make sure it formats the script correctly, and it prevents it from inserting smileys like 8)

Code:
plotscript, Explosive 1, begin
  if(npc at spot(22,8))
  then(show text box(6))
  else()
end
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hmv9999




Joined: 01 May 2011
Posts: 4

PostPosted: Tue May 24, 2011 12:00 pm    Post subject: Reply with quote

Aha! Thank you some more! :)

Now, I've got another silly question: if I had two destructible rocks on one map, but only one cart full of TNT, what would the script look like? It didn't work, but my first attempt went something like this:

Code:
plotscript, Explosive 2, begin

  if(npc at spot(61,16))
  then(show text box(17))
  else()

  if(npc at spot(54,28))
  then(show text box(18))
  else()

end
Back to top
View user's profile Send private message Send e-mail
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Tue May 24, 2011 12:39 pm    Post subject: Reply with quote

You are missing the first argument to "npc at spot". So instead of checking if the npc is at position 61,16 you are checking if NPC 61 is at position 16,0

Actually, I guess you had that problem all along, i just didn't notice it in the first post.

Also, a minor point: there is no reason to include the empty "else"

The example below assumes that the explosive cart is NPC 5. You can adjust it to have the real NPC id number of the cart.

Code:
plotscript, Explosive 2, begin

  if(npc at spot(5, 61,16))
  then(show text box(17))

  if(npc at spot(5, 54,28))
  then(show text box(18))

end
Back to top
View user's profile Send private message Send e-mail Visit poster's website
hmv9999




Joined: 01 May 2011
Posts: 4

PostPosted: Tue May 24, 2011 12:53 pm    Post subject: Reply with quote

Awesome! I was actually starting to wonder about identifying which NPC I was trying to script; it's nice to see that my worries were merited. :)

BTW: I'm new (noob) to everything here, so the extra 'else' has been helping to keep me organized. Will it cause problems to keep putting it there, or should I ween myself of that ASAP?

BTW2: Seriously, thank you for all the help! You rock!
Back to top
View user's profile Send private message Send e-mail
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Tue May 24, 2011 1:43 pm    Post subject: Reply with quote

hmv9999 wrote:
BTW: I'm new (noob) to everything here, so the extra 'else' has been helping to keep me organized. Will it cause problems to keep putting it there, or should I ween myself of that ASAP?

BTW2: Seriously, thank you for all the help! You rock!


The extra else is harmless. If it helps you organize, then by all means keep it.

Glad to help :)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group