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

Never plotscripted before, looking for a little help

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




Joined: 20 Oct 2008
Posts: 72

PostPosted: Mon Oct 20, 2008 6:14 am    Post subject: Never plotscripted before, looking for a little help Reply with quote

Hey guys, I'm making a game, and I need to be able to do the following things with plotscripting.

I have an item called "Heart"

Upon activation...

1. If the player has 0 Hearts, GAME OVER, and a game over screen.
2. Otherwise, Make an NPC take away 1 Heart

Hearts function as life.

This game doesn't have an RPG battle system btw, but I am using OHRRPGCE.

Thanks in advance for any help!

Also, is it possible to create an intro in .bmps and have it display only on starting a new game?
_________________
---
8bitcity.blogspot.com
Back to top
View user's profile Send private message Visit poster's website
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Mon Oct 20, 2008 6:52 am    Post subject: Reply with quote

On activation of the 'Heart' item, or upon activation of the script?
I'll assume the latter.

You will want to make use of the 'inventory()' command.
So your script might look something like:

Code:
Plotscript, Heart Checker, begin

if( inventory(#Heart) >>0)

then(
#Something happens
delete item(#Heart, 1)
)

else(
Gameover
)

end


You may also want to consider taking a look at global variables, which can do the same job in a nicer fashion.

Regarding your second request, there's a command that lets you load scripts instead of the load screen or something? which would probably fit your needs.

Unfortunately, I can't seem to access the online Plotscripting Dictionary at the moment.
Back to top
View user's profile Send private message Send e-mail AIM Address
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Mon Oct 20, 2008 8:31 am    Post subject: Re: Never plotscripted before, looking for a little help Reply with quote

Robot wrote:
Also, is it possible to create an intro in .bmps and have it display only on starting a new game?


You want a script something like this:

Code:

plotscript, intro screens, begin
  show backdrop(0)
  wait for key
  show backdrop(1)
  wait for key
  show backdrop(2)
  wait for key
  show backdrop(3)
  wait for key
  show backdrop(4)
  wait for key
end


You will have to adjust that to use the actual backdrop numbers that you see when you import your BMP files into custom.

Also, if you want the screens to advance without waiting for keypresses, then you want something like this:

Code:

plotscript, intro screens, begin
  show backdrop(0)
  wait(90)
  show backdrop(1)
  wait(90)
  show backdrop(2)
  wait(90)
  show backdrop(3)
  wait(90)
  show backdrop(4)
  wait(90)
end


"wait(90)" waits for 90 game ticks. There are about 18 ticks in a second, so wait(90) would wait about 5 seconds.

Anyway, to make your script run only for a new game, you just go into the "Edit General Game Data..." menu, and then to the "Special Plotscripts" menu, and choose your script as the "New Game Script"
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Raekuul
Delicious!




Joined: 31 Mar 2004
Posts: 641
Location: Nowhere

PostPosted: Mon Oct 20, 2008 10:54 am    Post subject: Reply with quote

Code:

include, plotscr.hsd
include, oldschool.hsi

define script(1, newgame, none)
define script(2, RaekuulIsOldFashioned, none)
define script(autonumber, TakeAHike, none)

define global variable(1, hearts)

script, newgame, begin
hearts == #whatever number you want it to be, I'm assuming three
#whatever the rest of the introduction script is, I just find that setting globals ASAP makes it easier on me
end

script, RaekuulIsOldFashioned, begin # This can actually be any name you choose, I'm just giving an example
#This is however you do the Hit Detection, but make sure it calls TakeAHike inside of an if statement
end

script, TakeAHike, begin
if hearts == 0, then begin
#dead hero stuff
game over
end
else, begin
decrement hearts
end end

Amidoinitrite?
_________________
A broken clock is still right twice a day.
Back to top
View user's profile Send private message Visit poster's website
Robot
Skeleton King




Joined: 20 Oct 2008
Posts: 72

PostPosted: Mon Oct 20, 2008 11:37 am    Post subject: Reply with quote

Holy crap that was fast! Wow guys, thanks a lot, this is a huge help and should give me a little practice implementing plotscripts.

With this, I should even be able to set it up so that you get a different game over screen depending upon the enemy that kills you.

Thanks again!
_________________
---
8bitcity.blogspot.com
Back to top
View user's profile Send private message Visit poster's website
Raekuul
Delicious!




Joined: 31 Mar 2004
Posts: 641
Location: Nowhere

PostPosted: Mon Oct 20, 2008 4:42 pm    Post subject: Reply with quote

Robot wrote:
Holy crap that was fast! Wow guys, thanks a lot, this is a huge help and should give me a little practice implementing plotscripts.

With this, I should even be able to set it up so that you get a different game over screen depending upon the enemy that kills you.

Thanks again!


Well now, wait a minute. I'm not even sure I did that right!
_________________
A broken clock is still right twice a day.
Back to top
View user's profile Send private message Visit poster's website
Robot
Skeleton King




Joined: 20 Oct 2008
Posts: 72

PostPosted: Mon Oct 20, 2008 5:06 pm    Post subject: Reply with quote

s'alright if its not. I've got enough compsci experience to take it from here. And if it doesn't work I'll just post the code here :)

Not in any rush to crank out this game.
_________________
---
8bitcity.blogspot.com
Back to top
View user's profile Send private message Visit poster's website
Robot
Skeleton King




Joined: 20 Oct 2008
Posts: 72

PostPosted: Sat Oct 25, 2008 1:33 pm    Post subject: Reply with quote

How does this look?

Code:
include, plotscr.hsd
include, oldschool.hsi

define script(1, NewGame, none)
define script(2, GetHit, none)

define global variable(1, Hearts)

script, NewGame, begin
Hearts == 1000
#whatever number you want it to be, I'm assuming three
  show backdrop(0)
  wait for key
 # show backdrop(1)
 # wait for key
  #show backdrop(2)
  #wait for key
  #show backdrop(3)
  #wait for key
  #show backdrop(4)
  #wait for key
end


script, GetHit, begin

if
  (
  inventory(#Heart) >> 0
  )
  then
    (
      delete item(#Heart, 1)
    )

else
  (
    Gameover
  )

end

_________________
---
8bitcity.blogspot.com
Back to top
View user's profile Send private message Visit poster's website
Robot
Skeleton King




Joined: 20 Oct 2008
Posts: 72

PostPosted: Sat Oct 25, 2008 1:51 pm    Post subject: Reply with quote

Code:
include, plotscr.hsd
include, skeletronic.hsi

define script(1, NewGame, none)
define script(2, TakeDamage, none)

script, NewGame, begin
  (
  add item(#Heart, 1000)
  show backdrop(0)
  wait for key
  )
end


script, TakeDamage, begin
(

if
  (
  inventory(#Heart) >> 0
  )
  then
    (
      delete item(#Heart, 1)
    )

else
  (
    Gameover
  )

)

end
end


That's what I have, and its not compiling. It says the error is line 16 (script, TakeDamage, begin) and that declaration script is not permitted inside a script. Perhaps newgame has an extra Begin or (

Any ideas?
_________________
---
8bitcity.blogspot.com
Back to top
View user's profile Send private message Visit poster's website
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Sat Oct 25, 2008 1:52 pm    Post subject: Reply with quote

Looks fine, except you'll want to replace #Heart with the Heart's item ID or you'll get a game over the moment you get hit.
Back to top
View user's profile Send private message Send e-mail AIM Address
Robot
Skeleton King




Joined: 20 Oct 2008
Posts: 72

PostPosted: Sat Oct 25, 2008 1:54 pm    Post subject: Reply with quote

see my last post.... is no compile
_________________
---
8bitcity.blogspot.com
Back to top
View user's profile Send private message Visit poster's website
Robot
Skeleton King




Joined: 20 Oct 2008
Posts: 72

PostPosted: Sat Oct 25, 2008 2:06 pm    Post subject: Reply with quote

This error is making no fucking sense, grrrrr
_________________
---
8bitcity.blogspot.com
Back to top
View user's profile Send private message Visit poster's website
Robot
Skeleton King




Joined: 20 Oct 2008
Posts: 72

PostPosted: Sat Oct 25, 2008 2:14 pm    Post subject: Reply with quote

I figured it out, those #'s signs were messing it up, duh, lol.
_________________
---
8bitcity.blogspot.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: Sat Oct 25, 2008 4:56 pm    Post subject: Reply with quote

# means it's a comment; the rest of the line is ignored. Instead, you want something like "item:heart" or whatever. Check your HSI file.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
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