Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

New Particle Engine

arev

Sponsor

@Helladen: yeah, as most of particle systems :D You just can't overdo it :)

@psykedeath: thanks :) I might make a small tutorial on this, however I'm thinking of rebuilding the script a little, putting those math things inside. And the keys are assigned in one of the events.
 
Hey arevulopapo, I have an idea, that if you occasionally has been some packages with new particles, because by that I see that your script has a huge variety to create new effects.

Great script, and there is a hint! ;)
 
i would like to see if i can get these particles and stuff into a battle like spells and such, thats would be pretty awsome you should try and make a script to do that sometime arevulopapo
 
Nice script :D.
Here is a suggestion, make particles actual animations. To do this you can do:

Animation_List = {}
Animation_List[animation_id] = particle_type

animation_id = animation id from the Database

Then, of course, you would need to edit RPG::Sprite's animation method.

Something like:
Code:
def animation(animation, hit)
  if Particle.Animation_List.include?(animation.id)
    [Particle Code On Character]
  else
    [default code] 
  end
end

Uses:
- ABS systems.
- Battle Systems.
- Just any map animations.

I think it would be even easier to use this way anyways.

But looking at the way you did the script, you would need to adjust a bit more. I would do it but its your script, I don't like editing other people's scripts...
 

arev

Sponsor

Thanks for suggestions :) Unforunatelly I don't quite understand what I'd need to do for this ^^ Would be nice if you could elaborate on this a little more :)
 
Powerful script, how can i put in the event script that the particle effect appear on the same event? (Without using the event ID)
 

arev

Sponsor

Actually you need to put the ID in the command. But you can obtain it by a simple command without knowing the actuall event id.
Code:
id = get_character(0).id
Then just use the 'id' variable (without the quotes) instead of a number.
 
Do i need to add that line somewhere in the script code or just use it in the event?. Because I use it in the event just like this...

script: id = get_character(0).id
script: $scene.effect(id,'fire','event',0,0)

and gave me an error message (undefined method 'get_character' for #<game_event... etc)
 

arev

Sponsor

Seems like you used it in the Set Move Route command. You nee to use the last command on the thid page of standard event commands - "Script..."
 
arevulopapo;327919 said:
Thanks for suggestions :) Unforunatelly I don't quite understand what I'd need to do for this ^^ Would be nice if you could elaborate on this a little more :)

Sure.

When an animations is shown on a Game_Character instance, ie $game_player, their "animation_id" is set to the animation's id. Like so:

$game_player.animation_id = 0 # means no animation

The Sprite_Character method checks if there is a current animation by:
Code:
    # Animation
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end

You don't need to worry about that really, its just to get you familiar with the system.

First of all, you would need a way for you to tell if an animation id is a particle animation id. To do this, you can add a hash to your script:

Code:
Animation_List = {}
Animation_List[animation_id] = [effect, lock, x, y]

You want that somewhere you can easily access, like a module(I'll use a module named Particle for this example).

Next you want to edit the place where the animation is executed, which is in RPG::Sprite:

Code:
    def animation(animation, hit)
      dispose_animation
      @_animation = animation
      return if @_animation == nil
      @_animation_hit = hit
      @_animation_duration = @_animation.frame_max
      animation_name = @_animation.animation_name
      animation_hue = @_animation.animation_hue
      bitmap = RPG::Cache.animation(animation_name, animation_hue)
      if @@_reference_count.include?(bitmap)
        @@_reference_count[bitmap] += 1
      else
        @@_reference_count[bitmap] = 1
      end
      @_animation_sprites = []
      if @_animation.position != 3 or not @@_animations.include?(animation)
        for i in 0..15
          sprite = ::Sprite.new(self.viewport)
          sprite.bitmap = bitmap
          sprite.visible = false
          @_animation_sprites.push(sprite)
        end
        unless @@_animations.include?(animation)
          @@_animations.push(animation)
        end
      end
      update_animation
    end

You want to edit that to check if the animation ID is actually a particle effect:

Code:
   def animation(animation, hit)
      dispose_animation
      if Particle::Animation_List.has_key(animation.id)
        
      else
        @_animation = animation
        return if @_animation == nil
        @_animation_hit = hit
        @_animation_duration = @_animation.frame_max
        animation_name = @_animation.animation_name
        animation_hue = @_animation.animation_hue
        bitmap = RPG::Cache.animation(animation_name, animation_hue)
        if @@_reference_count.include?(bitmap)
          @@_reference_count[bitmap] += 1
        else
          @@_reference_count[bitmap] = 1
        end
        @_animation_sprites = []
        if @_animation.position != 3 or not @@_animations.include?(animation)
          for i in 0..15
            sprite = ::Sprite.new(self.viewport)
            sprite.bitmap = bitmap
            sprite.visible = false
            @_animation_sprites.push(sprite)
          end
          unless @@_animations.include?(animation)
            @@_animations.push(animation)
          end
        end
        update_animation
      end
    end

Once you do that, you make sure the current scene is Scene_Map, since you made your script to use Scene_Map(bad choice :-p)



Code:
   def animation(animation, hit)
      dispose_animation
      if Particle::Animation_List.has_key(animation.id) 
        if $scene.is_a?(Scene_Map)
          a = Animation_List[animation.id]
          $scene.add_effect(@character.id,a[0],a[1],a[2],a[3])
        end
      else
        @_animation = animation
        return if @_animation == nil
        @_animation_hit = hit
        @_animation_duration = @_animation.frame_max
        animation_name = @_animation.animation_name
        animation_hue = @_animation.animation_hue
        bitmap = RPG::Cache.animation(animation_name, animation_hue)
        if @@_reference_count.include?(bitmap)
          @@_reference_count[bitmap] += 1
        else
          @@_reference_count[bitmap] = 1
        end
        @_animation_sprites = []
        if @_animation.position != 3 or not @@_animations.include?(animation)
          for i in 0..15
            sprite = ::Sprite.new(self.viewport)
            sprite.bitmap = bitmap
            sprite.visible = false
            @_animation_sprites.push(sprite)
          end
          unless @@_animations.include?(animation)
            @@_animations.push(animation)
          end
        end
        update_animation
      end
    end

Also add this:

Code:
class Game_Character
    attr_accessor :id
    alias av_particle_game_char_int initialize
    def initialize
      @id = -1
      av_particle_game_char_int
    end
end

Thats about all I see from your script.
 

arev

Sponsor

Thanks a lot, it's readable now :) But is there anything else this would do, except launching the animation from the event command?
And Scene_Map was chosen because of the spriteset_map, that I wanted to put the particles into. As far as I know they have to be in the same viewport as the tilemap and the characters for the Z coordinate to have some effect, don't they? So are there any more advantages than the one I mentioned?
And thanks for all that again. It's really educating ; )
 
Besides launching the particles from an event command for easy use, it would also make ABS systems look hot :p.

I would think about using it in CBS systems as well but you would need to edit Spriteset_Battle.

Also, you could edit your Particle Engine to make particle effects last for a period of time(in frames), which would be useful for event command by animation.

Its all easy stuff ;) I'm sure you can do it :)

I don't have a problem with the choice of Scene_Map that much really. I would have done something entirely different, but thats just me(and still use the same viewport). It doesn't matter much.
 
arevulopapo":2hkvxxfb said:
@Helladen: yeah, as most of particle systems :D You just can't overdo it :)

Sorry for the long reply, but yeah I knew that.
Though this actually quite nice. Once I checked out like 2-3
other particle system, this one seems to be the best.
Good job, hopefully you can add more to this eventually.
I am going to be using this on my new game. :D
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top