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

Suspend NPC

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Sun Nov 01, 2009 6:04 pm    Post subject: Suspend NPC Reply with quote

When I use "suspend NPCs", does this also suspend NPC use?

That is to say, if I walk up to a suspended NPC and hit space, what will happen?

If "suspend NPCs" doesn't work, is there a way to suspend NPC use?
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
Baconlabs
PURPLE IS MANLY




Joined: 15 Mar 2009
Posts: 335
Location: Tennessee

PostPosted: Sun Nov 01, 2009 6:17 pm    Post subject: Reply with quote

I don't think so.
What you're thinking of can be accomplished with a (large) list of Alter NPC commands, varying based on just what you don't want the player to do with certain NPCs. To my knowledge there is no catch-all "stop NPC interaction" command, but don't take my word for it.

This page lists about all you can do with Alter NPC commands, ranging from NPC pictures to move types to what happens when activated to how it's activated.
Back to top
View user's profile Send private message
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Sun Nov 01, 2009 7:00 pm    Post subject: Reply with quote

Ok thanks.

Shoot.
Makes things harder than I anticipated :-)
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Sun Nov 01, 2009 7:25 pm    Post subject: Reply with quote

Loops make tedious stuff like this a bit easier ;)
This example only works with text boxes, but the same idea would function for virtually every other NPC stat.

Code:

script, Erase all Speech, begin
variable (counter)

while (counter << 100)
do(

#Back up, explained below.
write global (100 + Counter, read NPC (Counter,NPCstat:display text)

#Sets all text boxes as 0
Alter NPC (counter, NPCstat:display text, 0)

#The loop never ends without this!
Increment (counter)
)

end


However, if you want this to be a toggle-effect, you'll probably need a bunch of global variables to record the text boxes for when you want them back.

If this is the case, the reverse of the above script would be:

Code:


#Global variables 100-199 have been reserved, theoretically.
#Feel free to use much fewer if you don't have that many NPC's.

script, Return all Speech, begin
variable (counter)

while (counter << 100)
do(

#Sets all text boxes to the back-ups.
Alter NPC (counter, NPCstat:display text, read global (100 + Counter))

#The loop never ends without this!
Increment (counter)
)

end
Back to top
View user's profile Send private message Send e-mail AIM Address
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Sun Nov 01, 2009 7:28 pm    Post subject: Reply with quote

Where's TMC? He'd tell you that it's easy - have a tag named "No Using NPCs" or something like this, and then have an on keypress script:

Code:

if(checktag(tag:No Using NPCs), and,
               (key is pressed (spacebar), or, key is pressed (enter))
  ), then

  begin
    suspend player
    wait(1)
    resume player
  end



Two things to note:
1. "spacebar" and "enter" won't actually work there, but I'm guessing you get the idea
2. This is untested and just a guess as to what TMC would say, so hopefully he doesn't come in here, see something wrong, and hate me, haha
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Nov 01, 2009 8:55 pm    Post subject: Reply with quote

Hahah!

Maybe it's not usually mentioned, but you ought to use a while loop to wait until the player stops holding down the key. The 'Permit double triggering of scripts' bitset is off by default, which will prevent the keypress handler from running again next tick, because it'll still be running (cleaning up with resumeplayer). Turning on the bitset solves the problem, but then the interpreter overflows if you hold down the key for several seconds.

Enough theory:
Code:
if(checktag(tag:No Using NPCs)) then, begin
  while(key is pressed (key:space) || key is pressed (key:enter)) do, begin
    suspend player
    wait(1)
    resume player
  end
end

_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Mon Nov 02, 2009 4:24 am    Post subject: Reply with quote

Ooh ....

Are you suggesting that instead of suspending the NPCs, I suspend the player, and let him/her move around with an "on keypress" script for each direction?

That could work.

I was thinking of letting the player cast a sort of "ethereal" spell.
It suspends everything, and you can't interact with anything, but you can walk ahead and see what's there without triggering any battles, traps, etc.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon Nov 02, 2009 5:24 am    Post subject: Reply with quote

No, that's not how it works. You'll want to suspend NPCs as well. You don't suspend the player totally, the script only blocks attempts to use the use keys by suspending the player just when they are pressed. Also, I just realised that msw made the mistake Wink of forgetting the ctrl key.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Mon Nov 02, 2009 6:15 am    Post subject: Reply with quote

Ooh oh.

Weird.
Ok, It think I get it.

Wait, no I don't.
The computer's checking the "suspend NPCs tag" every time I hit space, so why do I need to suspend the player?

Is it because the keypress script isn't wrapping the-stuff-that-normally-happens-when-I-hit-space?
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon Nov 02, 2009 6:28 am    Post subject: Reply with quote

You do sound really confused. 'Suspend NPCs' only prevents NPCs from moving automatically. The script prevents the space and enter keys from activating npcs.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Bagne
ALL YOUR NUDIBRANCH ARE BELONG TO GASTROPODA




Joined: 19 Feb 2003
Posts: 518
Location: Halifax

PostPosted: Mon Nov 02, 2009 8:01 am    Post subject: Reply with quote

Right.

What I've been wondering is why the player is suspended for a tick.

I was confused because I was under the impression that the key-press script is triggered *instead* of the normal space/enter NPC activation.

But now I'm guessing that's not the case: both are triggered, and so the key-press script has to suppress the NPC activation of the other.

If I'm still sounding completely confused, don't worry about it :-)
I'll just shut up and try out the scripts.

Thanks for your help.
_________________
Working on rain and cloud formation
Back to top
View user's profile Send private message
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Mon Nov 02, 2009 11:34 am    Post subject: Reply with quote

You've got it Bagne - on-keypress scripts do not replace the effect of the keypress, they are just initiated first, and then the normal effect of the keypress is done as well. This is why you do not need to script in the movement keys, you only need to block the 'using' keys.

And yeah, I forgot about Ctrl, even though I use that the most when I'm actually playing an Ohr game.
_________________
My first completed OHR game, Tales of the New World:
http://castleparadox.com/gamelist-display.php?game=161

This website link is for my funk/rock band, Euphonic Brew:
www.euphonicbrew.com
Back to top
View user's profile Send private message Visit poster's website
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Mon Nov 02, 2009 1:17 pm    Post subject: Reply with quote

The only problem with that script is that the player will be unable to move if he holds down space. Also, problems if your main menu has background scripts enabled (this is not the case by default).
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Nov 03, 2009 2:39 am    Post subject: Reply with quote

Yes, you are no longer allowed to lean on your spacebar without reason.

I'm pretty sure that suspending player doesn't affect menus or anything else besides movement, npc activation, and opening the menu.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
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