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

Big vehicles, can they be done?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Tue Feb 02, 2010 10:45 am    Post subject: Big vehicles, can they be done? Reply with quote

Hi, is it possible to make vehicles that are more than one npc size large? What about a vehicle that is 9 boxes square big?

also: can i get a script that allows opening the menu while riding a vehicle?
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

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




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

PostPosted: Tue Feb 02, 2010 11:54 am    Post subject: Reply with quote

You can open the menu while riding a vehicle without any scripting. In the vehicle editor, change "menu button" to "menu" and it should work just fine.

As for a large vehicle, you could attach a slice to the map and then move it to match the vehicle's position.

This script puts a slice on the map and starts it off on top of an NPC. Do this from the map autorun.

giant is a global variable

Code:

plotscript, setup giant NPC, begin
  variable(sl)
  sl := load large enemy sprite(16)
  set parent(sl, lookup slice(sl:map layer 1))
  set horiz anchor(sl, edge:center)
  set vert anchor(sl, edge:bottom)
  giant := sl
  update giant NPC
end


and this script runs over and over to update the position of the slice as the NPC moves.

Code:

script, update giant NPC, begin
  variable(sl, x, y)
  if(current map <> map:World Map) then(
    free slice(giant)
    giant := 0
    stop timer(1)
    exit script
  )
  if(giant) then(
    sl := giant
    set slice x(sl, NPC pixel x(5))
    set slice y(sl, NPC pixel y(5))
    set timer(1, 0, 1, @update giant NPC)
  )
end


EDIT: fixed "setup giant NPC" to be a plotscript instead of a script
Back to top
View user's profile Send private message Send e-mail Visit poster's website
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Tue Feb 02, 2010 6:32 pm    Post subject: Reply with quote

Oh no, I was going to try this then i think there's a bug... Going to 'edit screen layouts' exits the game without warning, what could be wrong?
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

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




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

PostPosted: Wed Feb 03, 2010 7:42 am    Post subject: Reply with quote

Oops! Yeah, that is definitely a bug. I see how to fix it too. EDIT: fixed, and I am forcing an early nightly

But you don't need to go into the edit screen layouts menu to be able to use this script.

(the Edit Screen Layouts menu still does nothing)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Wed Feb 03, 2010 8:02 am    Post subject: Reply with quote

ah, just a large enemy sprite, i think i'm getting it now, thanks!
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Wed Feb 03, 2010 10:31 pm    Post subject: Reply with quote

Hmmm, i can't make it work, i noticed they are called off as 'scripts' not 'plotscripts' so i changed the 'script' into 'plotscript' and as scripts they are not loaded in the game. But is there a special way to call them? I also thought it was my map layers that hid the slice so i tried a blank map but it's still not showing...
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

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: Wed Feb 03, 2010 10:47 pm    Post subject: Reply with quote

Right, 'setup giant NPC' is meant to be a plotscript, and it's meant to be set as the map autorun script. You don't call the other script directly (so it doesn't need to be a plotscript).

Make sure that you modify them as needed though - it's set to place large enemy sprite 16 on top of NPC ID 5.

Another possible problem is that it assumes that map layer 1 is enabled on that map. In fact, it'll draw the slice on top of map layer 1, but underneath NPCs and heroes, assuming that you haven't reordered the map layers. In order to draw them above NPCs and heroes, you'll need to add an extra blank layer above them to attach the slice to.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Thu Feb 04, 2010 12:15 am    Post subject: Reply with quote

Holy molemen in a kingdom of mirthful moonladies! That's so awesome! But how can i make the slice change direction when the transport looks left or right or up and down? Also, can i make the slice animate on each step? like a tank threading? Thank you very much :-)

edit:
I've finished my first big vehicle sprite, as an example, can I use all the images as slices with correspondence to direction and take an extra frame for each step just like a normal walkaby? Also: can slices be blocked by walls?


_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
mjkrzak




Joined: 24 Nov 2009
Posts: 43

PostPosted: Thu Feb 04, 2010 4:48 am    Post subject: Reply with quote

As far as vehicles go, that one is only slightly less terrifying than a Hummer. (Yes, I drive a small car.)
Back to top
View user's profile Send private message AIM Address
jabbercat
Composer




Joined: 04 Sep 2003
Posts: 823
Location: Oxford

PostPosted: Thu Feb 04, 2010 11:48 am    Post subject: Reply with quote

BlastedEarth wrote:




Hoy crap! I want to have ALL of your children!
_________________
Moogle no longer owes prizes.
Back to top
View user's profile Send private message MSN Messenger
Spoon Weaver




Joined: 18 Nov 2008
Posts: 421
Location: @home

PostPosted: Thu Feb 04, 2010 6:37 pm    Post subject: Reply with quote

I had the this idea right after slices came out but never really thought up a "good" game to put it in. I suppose I can post the script though.
( doctored up to be more relevant to you )

Code:

globalvariable,begin
1,car
2,stepper
end


Code:

plotscript, big car, begin

car:=load large enemy sprite(16)

  while(current map == 1) do(
 
    set slice x(car, NPC pixel x(5)--15)
    set slice y(car, NPC pixel y(5)--15)

if (NPC is walking (5)) then,begin
if (stepper==10) then (stepper:=0)
stepper:=stepper+1
end

If ( stepper==1 ,and, npc direction==right )
then( Replace large enemy sprite(car,16) )
If ( stepper==5 ,and, npc direction==right )
then( Replace large enemy sprite(car,17) )

If ( stepper==1 ,and, npc direction==up )
then( Replace large enemy sprite(car,18) )
If ( stepper==5 ,and, npc direction==up )
then( Replace large enemy sprite(car,19) )

If ( stepper==1 ,and, npc direction==down )
then( Replace large enemy sprite(car,20) )
If ( stepper==5 ,and, npc direction==down )
then( Replace large enemy sprite(car,21) )

If ( stepper==1 ,and, npc direction==left )
then( Replace large enemy sprite(car,16) )
If ( stepper==5 ,and, npc direction==left )
then( Replace large enemy sprite(car,16) )


wait (1)

  )
   free slice(car)

end



'Never tested this script and I, just now, added some stuff.

You can changed the pictures it uses, the npc, the map, and even the speed it moves by changing the various numbers in the script. I'd be glad to point out the right ones and explain them in more detail if need be.
I think making this as a "map autorun script" would be best, but it could easily be changed to be run in a different way if need be.

Quote:


Also: can slices be blocked by walls?


Yes and no....
With just this script, no. However...
There are a lot of ways to make this happen.
I'd suggest making a special kind of wall that the vehicle can't cross, and lining your walls with it. That should give the illusion of it being stopped by walls. Or at the very least, it won't be going through any.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Thu Feb 04, 2010 11:02 pm    Post subject: Reply with quote

I tested it, the slice moves even without entering the vehicle and all the npc scripts in the map don't work while this script is active. I was thinking, can this be used a step script and it calls the variable in the other script above for the slice? So it would be mainly for changing the graphics and checking if the npc moved...

edit: ah i forgot, only one script can be run at a time... I really can't make it work, the slice is there and it moves when the vehicle is mounted it's just that the graphics don't change. I've even tried combining the two scripts but it doesn't work, what's wrong with it?

plotscript, setup giant NPC, begin
sl := load large enemy sprite(19)
set parent(sl, lookup slice(sl:map layer 4))
set horiz anchor(sl, edge:center)
set vert anchor(sl, edge:bottom)
giant := sl
update giant NPC
end

script, update giant NPC, begin
variable(x, y)
if(current map <> map:Abrahassax Plains) then(
free slice(giant)
giant := 0
stop timer(1)
exit script
)
if(giant) then(
sl := giant
set slice x(sl, NPC pixel x(97))
set slice y(sl, NPC pixel y(97))
if (NPC is walking (97)) then,begin
if (stepper==10) then (stepper:=0)
stepper:=stepper+1
end

If ( stepper==1 ,and, npc direction==right )
then( Replace large enemy sprite(sl,19) )
If ( stepper==5 ,and, npc direction==right )
then( Replace large enemy sprite(sl,20) )

If ( stepper==1 ,and, npc direction==up )
then( Replace large enemy sprite(sl,15) )
If ( stepper==5 ,and, npc direction==up )
then( Replace large enemy sprite(sl,16) )

If ( stepper==1 ,and, npc direction==down )
then( Replace large enemy sprite(sl,13) )
If ( stepper==5 ,and, npc direction==down )
then( Replace large enemy sprite(sl,14) )

If ( stepper==1 ,and, npc direction==left )
then( Replace large enemy sprite(sl,17) )
If ( stepper==5 ,and, npc direction==left )
then( Replace large enemy sprite(sl,1Cool )
set timer(1, 0, 1, @update giant NPC)
)
end
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
Spoon Weaver




Joined: 18 Nov 2008
Posts: 421
Location: @home

PostPosted: Sat Feb 06, 2010 8:35 am    Post subject: Reply with quote

I noticed something while reviewing my own script.
npc direction
This isn't correct. It should be followed by (*vehicle's npc number*)
Which should look something like this:
npc direction (97)

I noticed you kinda picked and chose what to use from y script, that kinda cut and paste scripting won't end well.

The problem with your other scripts is a bit more difficult. This is a loop script, and I'm not really sure if there is an easy way to make this and your other scripts work correctly.
( I mean, You could always have this script launched by the vehicle, but if the vehicle is suppose to activate the scripts that's another story)
The only way I can think of would be to cram them all into the same script. Thus having them activated by the first loop script.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Sat Feb 06, 2010 12:04 pm    Post subject: Reply with quote

Using a 1 tick timer to make the script repeat is the best way to make sure it doesn't block other scripts (until real script multitasking gets implemented)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Sat Feb 06, 2010 1:12 pm    Post subject: Reply with quote

@Spoon Weaver: I've tried using your original script while putting the npc number when checking direction but it still doesn't change the graphics... Ah my head hurts^^

@James: What does this line mean, If(giant) ?

edit:
plotscript, setup giant NPC, begin
variable(sl)
sl := load large enemy sprite(19)
set parent(sl, lookup slice(sl:map layer 4))
set horiz anchor(sl, edge:center)
set vert anchor(sl, edge:bottom)
giant := sl
update giant NPC
end

ok so as i understand this, sl loads the large enemy sprite as a slice and it carries over to the script 'update giant npc'...
now is it realy possible to change the slice from the latter script? Or would the right thing to do is to make a bunch of slices (ex. sl1,sl2,sl3,sl4) and make a check in the first line of the second script and call a different slice while freeing another depending on direction, can this be done? I'm sorry to pester you guys I'm just confused...
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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