Announcement

Collapse
No announcement yet.

XP Event Scripting

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    XP Event Scripting

    So I've been knocking around with RMXP for a few weeks now and I'm more impressed with it every time I touch it. It's really the "ease of 3, flexibility of 2" setup that everyone dreams of (though without the raw graphical power) and it's just a pleasure to work with.

    In just hours I was able to import some custom graphics, create a pair of maps, set up a makeshift day/night system, and create a few enemy parties which take different actions depending on the flow of battle. All of this is without touching the Ruby; the scripting is just far more robust than meets the eye at first.

    But there are several things that I feel like I'm definitely going to need to do, and can't figure out how. Two are coming to my mind at the moment. Any advice as to how to make these happen is greatly appreciated. Ideally I'd like to know how to do this on my own, without importing someone else's public Ruby script. But if that's what's necessary, I'm willing to do that too.

    1) I need to give the player a multiple choice, but I need to populate that list of options based on variables, held items, etc. For example, let's say there are 40 different items you could use in cooking. I'd like to limit the list that the player can choose from, to only items he is holding. Or, let's say there are 8 possible party members, but only 3 can be with you at a given time. For a certain event in a dungeon, I'd like you to be asked which party member to use, but only of the three that are currently with you (if I show all 8, that's a spoiler!). I can't seem to pull this off with the Multiple Choice command, without using an insane number (thousands) of branches. Am I missing something? Can I do this at all?

    2) I'd like to be able to turn events "off" and "on" frequently. For example, an NPC leaves an area at night, and returns there the next day. I haven't used the "erase event" command yet because I can't see any way to restore the NPC event once it's erased. The way I'm thinking of doing this would be to "move" the NPC event to an unreachable place at night, and "move" it back to the correct location at the start of the next day. Would this work, and more importantly, is there any more graceful way to do it?


    How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

    "I live and love in God's peculiar light." - Michelangelo

    #2
    Re: XP Event Scripting

    Why not just tie a switch/flag to your day/night switchover, and have that de-activate the events you don't want active.



    Comment


      #3
      Re: XP Event Scripting

      The dialogue branch option is really only useful for the most basic of branches. "Yes/No", etc. Anything more complicated and you should explore other means.

      For question 1, the way I would get around this problem for the second example would be to take the player to a character-select style screen. Put each of the 8 party members on the screen, but only have them visible/selectable if they're in the party. This becomes less viable the more possible options you have, like in your ingredients example.

      For your second question,

      Originally posted by Valkysas View Post
      Why not just tie a switch/flag to your day/night switchover, and have that de-activate the events you don't want active.
      This is probably the easiest way. Use a switch, call it "Day" or whatever, turn it off during the night and back on during the day. Then set your event to be blank if the Day switch is off. Easy peasy.
      Ryner's Games

      Simple Man's Quest for the Playground* - Winner: Pavilionite Biography Contest - Click Here!

      Monster Must Die - Winner: Halloween Horror Contest - Click Here!

      All you need to play is a computer, no outside program necessary!

      Comment


        #4
        Re: XP Event Scripting

        Thanks so much, guys! I'll give the day/night solution a try next time I get onto RPG Maker; I think it should work if the "event body" hit detection can disappear alongside the image. So far this program has rarely disappointed me and I really hope that continues here.

        Oh, while I'm at it, does anyone know how to determine who the player just targetted with a given skill? There are a lot of battle skills I'm planning on using Common Event scripts for, but I can't tell the script which actors/enemies to target with the nonstandard effects if it has no idea who the skill was cast on!


        How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

        "I live and love in God's peculiar light." - Michelangelo

        Comment


          #5
          Re: XP Event Scripting

          That's something I really wish had a default option in the game commands. I would imagine there's a chance a script (I mean an actually programmed ruby-style one) out there for this, but that kind of resource would have to be searched for on a source that's primary focused on the PC Makers.

          The solution I used for this was to have abilities cause states that lasted temporary and had no effect other than to note who had been hit by a certain ability. Then I created an event that ran every turn that checked if someone was affected by one of those states, and what should happen if that was the case.
          Ryner's Games

          Simple Man's Quest for the Playground* - Winner: Pavilionite Biography Contest - Click Here!

          Monster Must Die - Winner: Halloween Horror Contest - Click Here!

          All you need to play is a computer, no outside program necessary!

          Comment


            #6
            Re: XP Event Scripting

            Thanks I tried the event conditions and... it worked! I can't believe the "event conditions" actually remove the display and hit detection of the event as well, that's brilliant.

            I really wish they had a few more tools for the default battles - like you said, Ryner, not allowing you to place certain targets in a variable seems like a real omission, and I also feel left wanting more in the different conditions you can use to kick off an event mid-battle.

            At any rate, I know some scripts have been made for "custom states" and I'm sure that method can be used to do what we're trying to do here... the bigger question is, can I figure out what to do with it. I'll let you know if I do.


            How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

            "I live and love in God's peculiar light." - Michelangelo

            Comment


              #7
              Re: XP Event Scripting

              Originally posted by Wavelength View Post
              Thanks I tried the event conditions and... it worked! I can't believe the "event conditions" actually remove the display and hit detection of the event as well, that's brilliant.
              You do realize this feature has been in every localized RPG Maker thus far, right? :P
              Last edited by ErikaFuzzbottom; 11-01-2010, 11:04 PM.
              "What if like...there was an exact copy of you somewhere, except they're the opposite gender, like you guys could literally have a freaky friday moment and nothing would change. Imagine the best friendship that could be found there."

              Comment


                #8
                Re: XP Event Scripting

                Originally posted by Draygone View Post
                You do realize this feature has been in every localized RPG Maker thus far, right? :P
                Really? You can make NPC's disappear simply using event conditions in RM3, without using the "Display Off" command?


                How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

                "I live and love in God's peculiar light." - Michelangelo

                Comment


                  #9
                  Re: XP Event Scripting

                  Who cares about RM3? You're on the winning team now!
                  Ryner's Games

                  Simple Man's Quest for the Playground* - Winner: Pavilionite Biography Contest - Click Here!

                  Monster Must Die - Winner: Halloween Horror Contest - Click Here!

                  All you need to play is a computer, no outside program necessary!

                  Comment


                    #10
                    Re: XP Event Scripting

                    So, I found a few good places to insert little bits of code to make my effects work. One of the cool things is that the code likes to refer to "self", which, in battle, often seems to be the target, and "user", which seems to be whoever is taking action (or "attacker", which is the same thing as "user" but for basic physical attacks).

                    As an example, I wanted to make a skill that attacks all enemies for moderate damage but also restores SP for each enemy defeated with this skill. Normal scripting can't determine who was defeated, so I created the skill in the database (it happens to be skill #95), skipped the Common Event script, and dug through the code.

                    Right after the HP damage calculation in the "Apply Skill Effects" section of Game Battler 3 (default code that ends in effective |= self.hp != last_hp), I added the following custom code:

                    if self.hp <= 0
                    if skill.id == 95
                    user.sp += 150
                    end
                    end


                    So, hours of searching for the right place (and using trial and error to figure out which keywords from other parts of the code might be appropriate here), but once I got beyond that learning curve, it's the kind of thing I can create in seconds.

                    There are also "apply attack effects" and "handle item effects" sections directly before and after this section in Game Battler 3 that let you do similar things with attacks and items. I've found this area of the code to be very flexible and relatively easy to work with.
                    Last edited by Wavelength; 05-08-2011, 01:01 PM.


                    How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

                    "I live and love in God's peculiar light." - Michelangelo

                    Comment


                      #11
                      Re: XP Event Scripting

                      Nice job, you're officially more advanced than I am.
                      Ryner's Games

                      Simple Man's Quest for the Playground* - Winner: Pavilionite Biography Contest - Click Here!

                      Monster Must Die - Winner: Halloween Horror Contest - Click Here!

                      All you need to play is a computer, no outside program necessary!

                      Comment


                        #12
                        Re: XP Event Scripting

                        I wasn't too happy with the default "slip damage" system which saps each character of about 1/10 of their HP each turn. I'm trying to make health degeneration into a more tactical battle move (and one that bosses don't need to be immune to), sort of like Guild Wars.

                        I want them to have different levels of efficacy, I want them to be able to stack, and I want health regen effects as well. And I don't want any random factor in the calculation.

                        I found the Slip Damage Application script inside Game_Battler_3 and modified it to the following. It's a little brute force-ish but it gets the job done. (I left alone the script for doing damage while your character is poisoned in the field, but that's under the Game_Party topic if you want to modify it.) Text shown in green is comments that are ignored by the code.

                        Lines like if self.state?(3) will check to see if the character is currently affected by State #3 in your standard "States" database, and run the following line(s) (up to "End") if the character has that state applied. Check my last post for an explanation of "self".

                        def slip_damage_effect
                        self.damage = 0

                        # Set degeneration rate - adds damage to the total for each type of degen effect a character is suffering from
                        if self.state?(3) # Venom
                        self.damage += 60
                        end
                        if self.state?(19)
                        # Disease
                        self.damage += 30
                        end
                        if self.state?(20)
                        # Poisoned
                        self.damage += 60
                        end

                        # Set regeneration rate - subtracts damage from the total for each healing effect the character is under; may go below zero
                        if self.state?(25) # Life Weaving
                        self.damage -= 50
                        end

                        # Cap the Degen to 100HP per turn
                        if self.damage > 100
                        self.damage = 100
                        end

                        # Cap the Regen to 100HP per turn
                        if self.damage < -100
                        self.damage = -100
                        end

                        # Subtract damage from HP
                        self.hp -= self.damage # This will cause the character to lose HP equal to the total poison damage calculated above, or gain it in the case of Life Weaving
                        # End Method

                        return true
                        end


                        For reference, the original code in this method was:

                        Originally posted by Original Code
                        def slip_damage_effect
                        # Set damage
                        self.damage = self.maxhp / 10
                        # Dispersion - Allows variance in the damage dealt
                        if self.damage.abs > 0
                        amp = [self.damage.abs * 15 / 100, 1].max
                        self.damage += (rand(amp+1) + rand(amp+1)) - amp
                        end
                        # Subtract damage from HP
                        self.hp -= self.damage
                        # End Method
                        return true
                        end
                        Hopefully anyone who's new to the code scripting will find this useful!


                        How Badly Do You Want It? (VX Ace) is now available for download! - no outside software necessary.

                        "I live and love in God's peculiar light." - Michelangelo

                        Comment

                        Working...
                        X