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

Side Scroller Help
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Tue Mar 17, 2009 2:32 pm    Post subject: Reply with quote

Okay, working on using the npc extra's and thought I finally had it.
Apparently not Sad...

The first part does as it says to set the healths of the enemies.
However, afterwards all of them have 'extra 1' set to True, for some reason. It is usually only true when they're on the screen.
This results in quite a few enemies moving before they're supposed to.

However, after adding that little bit at the end, "set npc extra (npc, extra 1, false) ", to let the main loop assign the 'extra 1' data as intended, all of the enemies had their healths turned to '1'.

Code:
plotscript, enemy health start, begin
   # Iterate through all enemy NPCs and give them their max health
     variable(i, j, npc, count)
     for (i, first enemy id, last enemy id) do (
      count := npc copy count(i) -- 1 # count goes from 0..n-1
      for (j, 0, count) do (
        npc := npc reference(i, j)
               
        if(i==0)
        then(
        set npc extra (npc, extra 3, Health:Goomba)
        )
       
        if(i==1)
        then(
        set npc extra (npc, extra 3, Health:Batter)
        )
       
        #set npc extra (npc, extra 1, false)
      )
      )
   end


This script is activated as each map's autorun.
Health:Goomba and Health:Batter are defined as constants.
Back to top
View user's profile Send private message Send e-mail AIM Address
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



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

PostPosted: Tue Mar 17, 2009 2:52 pm    Post subject: Reply with quote

Are you using the latest nightly for GAME? Bad things will happen if you're using a more recent Hspeak than you are GAME.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Tue Mar 17, 2009 2:58 pm    Post subject: Reply with quote

Moogle1 wrote:
Are you using the latest nightly for GAME? Bad things will happen if you're using a more recent Hspeak than you are GAME.


Lesson learned :O
Back to top
View user's profile Send private message Send e-mail AIM Address
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



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

PostPosted: Tue Mar 17, 2009 3:17 pm    Post subject: Reply with quote

I don't know how you thought that would work, but..!

You should also use the latest CUSTOM for good measure.
_________________
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: Thu Mar 19, 2009 5:54 am    Post subject: Reply with quote

We've got to add version info to plotscr.hsd, include it in the .HS header, and make both Game and HSpeak check it.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Fri Mar 20, 2009 1:11 pm    Post subject: Reply with quote

So I've been playing around with an enemy that's a container holding a medium-enemy-sprite and he animates just fine.

However, I can't seem to get rid of slice after I'm done with him.

After the enemy runs out of health, I use:

Code:
free slice (holder)


Where holder is a global variable previously defined as:

Code:
holder := create container(50,50)


After getting the enemy below 1 health, the game closes.
G_debug.txt gives me a bunch of:
Code:
get sprite set number: slice handle 2 has already been deleted


I can post the entire script if it's necessary.

Thanks
Back to top
View user's profile Send private message Send e-mail AIM Address
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



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

PostPosted: Fri Mar 20, 2009 1:31 pm    Post subject: Reply with quote

If GAME is crashing hard like you say, that's an engine bug Sad...

Why are you using a container, out of curiosity? There's no reason to do it unless you're containing multiple slices inside it.

There doesn't seem to be a "slice exists" function, but you might try changing this
Code:
free slice (holder)


to this
Code:
if (holder <> 0) then (
 free slice (holder)
 holder := 0
)


Still, I'd expect better error handling Sad... Sad...

As an aside, using a single variable will get you into trouble if multiple copies of that enemy can possibly appear onscreen simultaneously. You might consider using an NPC extra to store the slice handle instead.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Fri Mar 20, 2009 1:39 pm    Post subject: Reply with quote

Moogle1 wrote:
If GAME is crashing hard like you say, that's an engine bug Sad...

Why are you using a container, out of curiosity? There's no reason to do it unless you're containing multiple slices inside it.

There doesn't seem to be a "slice exists" function, but you might try changing this
Code:
free slice (holder)


to this
Code:
if (holder <> 0) then (
 free slice (holder)
 holder := 0
)


Still, I'd expect better error handling Sad... Sad...

As an aside, using a single variable will get you into trouble if multiple copies of that enemy can possibly appear onscreen simultaneously. You might consider using an NPC extra to store the slice handle instead.


Thanks for the fix, but the bug's still there Sad...

The enemy has multiple frames of animation, so I figured the frame would be the best way to reference all of them (the sprite is freed and a new frame is added for each animation)
He's a miniboss, so there should *hopefully* only be one at a single time.
Back to top
View user's profile Send private message Send e-mail AIM Address
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



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

PostPosted: Fri Mar 20, 2009 1:45 pm    Post subject: Reply with quote

Yikes, that's not a great way to do that.

Try replace medium enemy sprite rather than containing and showing/hiding.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Fri Mar 20, 2009 1:51 pm    Post subject: Reply with quote

Moogle1 wrote:
replace medium enemy sprite


I hurried over to the dictionary to look at sprite functions and also found 'horiz flip sprite (handle, flip)' :O

I'm sold, but is there a way to check for a sprite's current position?
I can't seem to find it.
Back to top
View user's profile Send private message Send e-mail AIM Address
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



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

PostPosted: Fri Mar 20, 2009 1:54 pm    Post subject: Reply with quote

slice x, slice y

Same with your container, unless you're doing it some fancypants way I don't know about. You'll want to subtract camera pixel x/y from your slice x/y, but I'm guessing you were already doing that.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Fri Mar 20, 2009 1:57 pm    Post subject: Reply with quote

I just filed '' . bug_title('715') . ''

Twinhamster, before you go and work around this bug, can you send me a copy of the game with a sav right before the crashy boss?

Although the method you were using might be a little less efficient than using "replace medium sprite", it *definitely* should not have crashed like that.

Moogle1 wrote:
slice x, slice y

Same with your container, unless you're doing it some fancypants way I don't know about. You'll want to subtract camera pixel x/y from your slice x/y, but I'm guessing you were already doing that.


Or use "slice screen x" and "slice screen y"

EDIT: Oh, d'oh! I forgot that those commands are only minimally useful because attaching slices to map layers is not implemented yet!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Fri Mar 20, 2009 2:07 pm    Post subject: Reply with quote

Moogle1 wrote:
slice x, slice y

Same with your container, unless you're doing it some fancypants way I don't know about. You'll want to subtract camera pixel x/y from your slice x/y, but I'm guessing you were already doing that.


Fantastic!

I didn't quite figure out that camera pixel bit, so I just had the battle take place in a map that took up a single screen.

James wrote:
Twinhamster, before you go and work around this bug, can you send me a copy of the game with a sav right before the crashy boss?

Although the method you were using might be a little less efficient than using "replace medium sprite", it *definitely* should not have crashed like that.


Sent you an e-mail, starting it straight from Game should get you to the right place.
Instructions inside.
Back to top
View user's profile Send private message Send e-mail AIM Address
TwinHamster
♫ Furious souls, burn eternally! ♫




Joined: 07 Mar 2004
Posts: 1352

PostPosted: Sat Mar 21, 2009 4:59 pm    Post subject: Reply with quote

A game-freezing bug has appeared and I'm trying to read the script-debug, but can't quite interpret very well due to its outdated wiki page.



It looks like there's a bad 'wait for npc' somewhere, and that (-300) is kind of scary-look'n.

A little insight would be great.
Back to top
View user's profile Send private message Send e-mail AIM Address
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Mar 22, 2009 12:04 am    Post subject: Reply with quote

Try pressing ctrl+11 while not in the script debugger to see which NPC has reference 300

The script debugger was never officially mentioned or documented because it's too hard to use, even with the documentation. It needs rewriting. There's too much information to cram in 320x200, it needs a pop out window.

The garbage at the bottom of the screen tells you exactly which waitfornpc command is being executed. You need to refer to your script to make sense of it. You can see that in processenemy switch(0) is being executed, containing a chain of if's, and it's the 4th out of 5 commands in a then() block.

Press v once or twice. This is usually far more helpful, you can see the values of local and global variables. Press + and - to scroll the globals.

Edit: Also, press page up/page down to select the script. I've updated the page with this meagre amount of documentation.
_________________
"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
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
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