Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> [Solved] Day & Night Scripts Question
Hedgen
post Jun 25 2011, 08:13 PM
Post #1


Level 1
Group Icon

Group: Member
Posts: 10
Type: Event Designer
RM Skill: Beginner




Hi, I was looking between two different scripts that add day/night to the game, and I was wondering. Can I make it so there are more aggressive monsters at night? (higher spawn rate, more attack, more defense, etc.) The two scripts I was looking at are

http://www.rpgrevolution.com/forums/index....showtopic=35105
and
http://www.rpgrevolution.com/forums/index.php?showtopic=7619

I know nothing about RGSS coding but I looked at the script and saw nothing in there about that and wondered if there was some way of making the script be able to do that. Is it possible?

Sorry if this question has been asked before, I tried looking but didn't find anything, if it has then I probably didn't type the right keywords in.


This post has been edited by Hedgen: Jun 27 2011, 12:33 PM
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Jun 26 2011, 04:36 AM
Post #2


Level 50
Group Icon

Group: +Gold Member
Posts: 1,529
Type: Scripter
RM Skill: Undisclosed




Those two scripts are very different.

The first script reads the time from your computer, and uses that to state whether the time is day or night.
If you use the first script, edit it so that just after @time_stamp = Time.new it has the code:
CODE
$game_switches[123] = @time_stamp.hour > 18

After you insert that line, it will set switch 123 (you can change which switch it looks at, 123 is an example) to true if it is night time (after 6pm), or false if it is not night time (before 6pm).


The second link doesn't have a script at all in the first post.
If you follow the link Blizzard posted which leads here, it has "in game" time, where the time in the game is not related to the time in the real world.
This second script contains the code:
CODE
  # switch ID of the "night" switch
  NSWITCH = 52

Which sets switch 52 to true if it is night time.


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
Hedgen
post Jun 26 2011, 10:17 AM
Post #3


Level 1
Group Icon

Group: Member
Posts: 10
Type: Event Designer
RM Skill: Beginner




Oh ok, I get it now. My friend had to explain to me what you said ^^' Thanks smile.gif

(I am stupid when it comes to RGSS biggrin.gif )

All the edits except for the last one
Edit: I guess I am going with the computer time one, since I am, I am going to have four different "times", dawn, day, dusk, and night. How would I edit that script to be able to have four different times, and then would I just need 4 switches for the different times? (Or is what I'm asking would need to majorly change the script?)

Edit 2:Oh I noticed in the comments that You edited the script to do this, Nevermind the last edit smile.gif (Now I just need to make the enemy's during different times...) (unless this is in replies of it as well xD )

Edit 3: Ok I love you now <-< cause of http://www.rpgrevolution.com/forums/index....st&p=361563 xD

Edit 4: Ok I read through the script instructions, do I still need to do
CODE
#       On each map you want the tint set by this script, make an event as follows:
#        [Parallel Process Event]
#         Turn on switch 3
#         Loop
#               Script... Check_Time.new
#               Wait 1 frame
#         End Loop


Or do I just add the variables into the event window?


Edit 5: I can't get this to work sad.gif I looked through the discussion about this script and have tried turning the switch on and it doesn't tint the game. I tried the "original" way of installing it on the maps but that didn't work either. What do I put into the Edit Event window?

Edit 6: Ok I got it to change times, finally smile.gif How would I go about making it so monsters spawn at different times though? Would that be a script thing?

Edit 7: I think I know how to make different monsters at different times, but if it would activate then I think it would work fine. Which variable constant is what time? is 1 night, 2 dawn, 3 day, 4 dusk?

This is the Event I am using to try to make it so there are different monsters during different times of the day (It is a Troops event, it makes it so it randomly makes monsters appear and if the way I did it work, make it so it is different kind of monsters depending on the day)
Events I tried using for making monsters appear at different times

CODE
@>Control Variables:[0014:Time] = Variable [0014: Time]
@>Conditional Branch: Variable [0014: Time] == 1
  @>Control Variables:[0015:monstergen]= Random No.(1...4)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[1.Randomizer], [Dangerous Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0015: monstergen] ==4
    @>Change Enemy HP:[1. Randomizer], -999999
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[1.Randomizer], [Dangerous Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[1.Randomizer], [Dangerous Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Control Variables:[0015:monstergen]= Random No.(1...3)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[3.Randomizer], [Dangerous Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[3.Randomizer], [Dangerous Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[3.Randomizer], [Dangerous Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Control Variables:[0015:monstergen]= Random No.(1...3)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[2.Randomizer], [Dangerous Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[2.Randomizer], [Dangerous Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[2.Randomizer], [Dangerous Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>
: Else
  @>Erase Event
  @>
: Branch End
@>Control Variables:[0014:Time] = Variable [0014: Time]
@>Conditional Branch: Variable [0014: Time] == 2
  @>Control Variables:[0015:monstergen]= Random No.(1...4)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[1.Randomizer], [Starving Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0015: monstergen] ==4
    @>Change Enemy HP:[1. Randomizer], -999999
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[1.Randomizer], [Starving Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[1.Randomizer], [Starving Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Control Variables:[0015:monstergen]= Random No.(1...3)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[3.Randomizer], [Starving Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[3.Randomizer], [Starving Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[3.Randomizer], [Starving Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Control Variables:[0015:monstergen]= Random No.(1...3)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[2.Randomizer], [Starving Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[2.Randomizer], [Starving Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[2.Randomizer], [Starving Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>
: Else
  @>Erase Event
  @>
: Branch End
@>Control Variables:[0014:Time] = Variable [0014: Time]
@>Conditional Branch: Variable [0014: Time] == 3
  @>Control Variables:[0015:monstergen]= Random No.(1...4)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[1.Randomizer], [Tired Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0015: monstergen] ==4
    @>Change Enemy HP:[1. Randomizer], -999999
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[1.Randomizer], [Tired Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[1.Randomizer], [Tired Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Control Variables:[0015:monstergen]= Random No.(1...3)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[3.Randomizer], [Tired Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[3.Randomizer], [Tired Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[3.Randomizer], [Tired Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Control Variables:[0015:monstergen]= Random No.(1...3)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[2.Randomizer], [Tired Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[2.Randomizer], [Tired Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[2.Randomizer], [Tired Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>
: Else
  @>Erase Event
  @>
: Branch End
@>Control Variables:[0014:Time] = Variable [0014: Time]
@>Conditional Branch: Variable [0014: Time] == 4
  @>Control Variables:[0015:monstergen]= Random No.(1...4)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[1.Randomizer], [Healthy Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0015: monstergen] ==4
    @>Change Enemy HP:[1. Randomizer], -999999
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[1.Randomizer], [Healthy Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[1.Randomizer], [Healthy Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Control Variables:[0015:monstergen]= Random No.(1...3)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[3.Randomizer], [Healthy Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[3.Randomizer], [Healthy Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[3.Randomizer], [Healthy Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Control Variables:[0015:monstergen]= Random No.(1...3)
  @>Conditional Branch: Variable [0014: monstergen]==1
    @>Enemy Transform:[2.Randomizer], [Healthy Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==2
    @>Enemy Transform:[2.Randomizer], [Healthy Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>Conditional Branch: Variable [0014: monstergen]==3
    @>Enemy Transform:[2.Randomizer], [Healthy Ghost]
    @>
   : Else
    @>Erase Event
    @>
   : Branch End
  @>
: Else
  @>Erase Event
  @>
: Branch End


I decided to type the entire code up of what I am trying to use for having different monsters at different times. The monstergen is a random monster generator my friend showed me how to make, and I thought the different monsters at different times would work with this also.
Without the Time conditional branches, the monster's appear just fine but with it, it just stays as the "randomizer" monster.

The conditions I set are Turn 0 + 0 X


Edit 8: I got it to work, apparently I forgot to change the Switch event back to Parallel Process so it wasn't turning on. Thanks for the help smile.gif

This post has been edited by Hedgen: Jun 27 2011, 09:43 AM
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th June 2013 - 07:52 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker