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

A little help with a bit complex Script

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Misac
Lone Game Dev




Joined: 09 Aug 2005
Posts: 27
Location: São Paulo, Brazil

PostPosted: Fri Dec 12, 2008 3:19 am    Post subject: A little help with a bit complex Script Reply with quote

i need a Script that when you run it will consume your MP (or stamina)
and a script that make a layer apears after a brief period (i will make Weather efects whit this), some one know how?

I almost Forgot! make the player shot and damege NPC's and then make Some NPC's shot too and the Player Take demage, I am Resuming The "GTA conected" Project and so it will take a lot of scripts...

Thanks for the attention!
_________________

"Live and Inoperative"
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Calehay
...yeah.
Class B Minstrel



Joined: 07 Jul 2004
Posts: 549

PostPosted: Fri Dec 12, 2008 6:40 pm    Post subject: Re: A little help with a bit complex Script Reply with quote

Misac wrote:
i need a Script that when you run it will consume your MP (or stamina)


As in run on the map, or from a battle?

Quote:
and a script that make a layer apears after a brief period (i will make Weather efects whit this), some one know how?


I'm assuming you're talking about layer 2. If you want all the effect to pop up simulatneously all across the map, it's easy. Just place the layer 2 tiles on the map as if you would see if during the effect, make sure you have an empty tileset, then do a script something like this: (ran as a auto run script on the map)

Code:
plotscript, weathereffect, begin
variable (done)
done := false
load tileset (x, 2) #Where "x" is the number of the blank tileset

while (done == false) do
    (
    wait (120) #Or however long you want the effect off the screen
    load tileset (y, 2) #Where "y" is the number of your weather tileset
    wait (30) #Or however long you want the effect on the screen
    load tileset (x, 2)
   
    #Now, insert a condition that makes the weather stop if needed.
    If (blargh) then #blargh should be replaced with approriate condition
        (            #such as "if (tag:stoprain == on) then"
        done := true
        )
    )

end


If you want something more complex, like effects appearing on different parts of the screen at once, it gets a bit more difficult.
_________________
Calehay
Back to top
View user's profile Send private message AIM Address
Misac
Lone Game Dev




Joined: 09 Aug 2005
Posts: 27
Location: São Paulo, Brazil

PostPosted: Sun Dec 14, 2008 12:31 pm    Post subject: Reply with quote

yep this what i want And the "runing script" is for the map

but about the shoting? someone Know how to?
_________________

"Live and Inoperative"
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Gizmog1
Don't Lurk In The Bushes!




Joined: 05 Mar 2003
Posts: 2257
Location: Lurking In The Bushes!

PostPosted: Mon Dec 15, 2008 8:22 am    Post subject: Reply with quote

Why don't you try writing it on your own, and then if you get stuck, post the script and we can help point you in the right direction?
Back to top
View user's profile Send private message Send e-mail AIM Address
Misac
Lone Game Dev




Joined: 09 Aug 2005
Posts: 27
Location: São Paulo, Brazil

PostPosted: Mon Dec 15, 2008 11:04 am    Post subject: Reply with quote

Well this is the point! i don't know how to do some of them

see


Code:
include, plotscr.hsd

define script(1,night,0)

script,night,begin
wait (25920)
load tileset (4,0)
wait (25920)
load tileset (0,0)

end


i don't know how to make it loop and using variables like calehay do only gives me a black screen

and the runing script and shoting script i dont know Even how to start it, i'm not good whit plotscripts like this but i understand whit some observation
_________________

"Live and Inoperative"
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



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

PostPosted: Mon Dec 15, 2008 1:12 pm    Post subject: Reply with quote

That's why there are resources for people in your situation.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Calehay
...yeah.
Class B Minstrel



Joined: 07 Jul 2004
Posts: 549

PostPosted: Mon Dec 15, 2008 9:10 pm    Post subject: Reply with quote

Misac wrote:

i don't know how to make it loop and using variables like calehay do only gives me a black screen


I just tested it and it worked perfectly. Can you post the script the way you put it in yours?

Quote:
Code:
include, plotscr.hsd

define script(1,night,0)

script,night,begin
wait (25920)
load tileset (4,0)
wait (25920)
load tileset (0,0)

end


This would not work because you're loading your weather tileset as layer 0. The second argument in the load tileset command is the layer you want that tileset to be loaded to. You also have to make sure that you've enabled the second layer on that map in custom. (Also, remember that, for the second layer, the top left corner tile will be transparent, even if there's graphics there. I've made that mistake far too often.)

The effect would also only run once, and then finish. Flow control commands are very useful, and I suggest learning them before trying to tackle these other massive scripts, because you will definitely need them.

Also, wait (25920) is around 24 minutes. One tick is roughly 1/18th of a second.
_________________
Calehay
Back to top
View user's profile Send private message AIM Address
Misac
Lone Game Dev




Joined: 09 Aug 2005
Posts: 27
Location: São Paulo, Brazil

PostPosted: Tue Dec 16, 2008 8:15 am    Post subject: Reply with quote

Yep 24 minutes, is the time between day and night on most games, but for the weather i was using this one


Code:
script,Rain,begin
variable (done)
done := false
load tileset (2, 2)

while (done == False) do
(
wait (180)
load tileset (3, 2)
wait (100)
load tileset (2, 2)
end)


i see i figured out what was Causing the problem i was forgoten the "()"and well, i need these scripts to load on Map auto run, it is posible to use 2 in 1?

and how about the shoting script?
_________________

"Live and Inoperative"


Last edited by Misac on Tue Dec 16, 2008 8:41 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Tue Dec 16, 2008 8:39 am    Post subject: Reply with quote

Only one script at a time can run, so you might be better of using timers rather than big long wait() commands.

Code:

include, plotscr.hsd

plotscript, become day, begin
  load tileset(0,0)
  set timer(0, 1, 25920, @become night)
end

plotscript, become night, begin
  load tileset(4,0)
  set timer(0, 1, 25920, @become day)
end



Just run "become day" at the beginning. It will load the daytime tileset into map layer 0, and then it will start timer 0 counting down for 24 minutes. After timer 0 runs out it will trigger "become night" and reset the timer for another 24 minutes. When that runs out, it triggers "become day", and so-on.

There are no "wait" commands involved, so this will not interfere with any other scripts, nor will any other scripts interfere with it.

Your rain script can be approached the same way, but you will need a different timer.

Code:

plotscript, start rain, begin
  load tileset (2, 2)
  set timer (1, 1, 180, @slow rain)
end

plotscript, slow rain, begin
  load tileset (3, 2)
  set timer (1, 1, 100, @stop rain)
end

plotscript, stop rain, begin
  load tileset (2, 2)
end


See? This one uses timer number 1. You run "start rain" in your map autorun script. It sets the timer for "slow rain", and that sets the timer for "stop rain"

You can have up to 16 different timers going at any time (numbered 0 to 15)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Misac
Lone Game Dev




Joined: 09 Aug 2005
Posts: 27
Location: São Paulo, Brazil

PostPosted: Tue Dec 16, 2008 8:59 am    Post subject: Reply with quote

well based on what you show, i see that is posible to trigger a script whit a comand, so i tried this


Code:
define script(1,rain,0)
define Script(2,night,0)

script,rain,begin
@night
variable (done)
done := false
load tileset (2, 2)

while (done == False) do
(
wait (180)
load tileset (3, 2)
wait (100)
load tileset (2, 2)
end)

script,night,begin
variable (var1)
var1 := false

while (var1 == false) do
(
wait (36)
load tileset (4,0)
wait (36)
load tileset (0,0)
end)


i'm not sure if it's correct but i think i'm losing something
_________________

"Live and Inoperative"
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Tue Dec 16, 2008 10:03 am    Post subject: Reply with quote

Code:
define script(1,rain,0)
define Script(2,night,0)


These are not needed anymore. You can make things easier on yourself if you read 'How do I convert my scripts from old to new syntax?'

Code:

script,rain,begin
  night
  variable (done)


To call one script from another you just use the name. You do not need the @ sign. The @ sign is special for "set timer"

Code:

  while (done == False) do
  (
  wait (180)
  load tileset (3, 2)
  wait (100)
  load tileset (2, 2)
  end)


The way you have written your script, none of this will happen until the "night" script is completely finished. You cannot make two scripts run at the same time, even if they use "wait" commands.

That is why I am suggesting that you should use timers for your day/night and weather effects instead of wait commands.

Your script should be something like this:

Code:

plotscript, map autorun, begin
  become day
  start rain
end

plotscript, become day, begin
  load tileset(0,0)
  set timer(0, 1, 25920, @become night)
end

plotscript, become night, begin
  load tileset(4,0)
  set timer(0, 1, 25920, @become day)
end

plotscript, start rain, begin
  load tileset (2, 2)
  set timer (1, 1, 180, @slow rain)
end

plotscript, slow rain, begin
  load tileset (3, 2)
  set timer (1, 1, 100, @stop rain)
end

plotscript, stop rain, begin
  load tileset (2, 2)
end
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Misac
Lone Game Dev




Joined: 09 Aug 2005
Posts: 27
Location: São Paulo, Brazil

PostPosted: Tue Dec 16, 2008 10:25 am    Post subject: Reply with quote

wow Thanks this make me understand! the last time since i used Scripts was on ubertzung. thanks a lot paige but i still need the shoting Script know like on GTA 2
_________________

"Live and Inoperative"
Back to top
View user's profile Send private message Send e-mail MSN Messenger
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Dec 19, 2008 2:06 am    Post subject: Reply with quote

Your second request is much harder. You want to give NPC's HP and make them shoot at you whenever they face you? I've never seen any non-sidescrolling game actually do that (aside from a minigame in SoJ which was scrapped because it ran too slowly or something like that), so I don't think anyone has a script like that to give you.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Misac
Lone Game Dev




Joined: 09 Aug 2005
Posts: 27
Location: São Paulo, Brazil

PostPosted: Fri Dec 26, 2008 6:55 am    Post subject: Reply with quote

Moogle made something like this on OHR Tactics. But the attacks will ocur on Key Press
_________________

"Live and Inoperative"
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



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

PostPosted: Fri Dec 26, 2008 8:48 am    Post subject: Reply with quote

Yes, and it was a very complicated script. You're essentially asking someone to program your game for you here.
_________________
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