Jump to content


Photo

Ruby/RGSS3 questions that don't deserve their own thread


  • Please log in to reply
1315 replies to this topic

#1301 TheoAllen

TheoAllen

    Wandering Hunter

  • Ace Member
  • 239 posts
  • LocationIndonesia
  • RM Skill - Coder

Posted 01 April 2014 - 04:10 PM

You should provide more information such as what is inside A_Damage method and what is the value of "damage" parameter in Basic_Attack?


My scripts collection :
http://theolized.blogspot.com/
Sorry if I made it in Indonesian

Supporter of :
1viwZUi.png

Make your own party composition based on 31 playable characters :
Um49Knu.gifatgZMqB.gifVSYyHJW.gifuQg15JR.gifGMwnDzr.gifJXX3YES.gifG6PbyQB.gift1SSEgm.gifLZANXrT.gifQrsC7UF.gifklkNdKW.gifDFIr27Z.gifOsRSVVA.gifWhpXAKn.gifBgkgoFS.gifE6O3uwJ.gifDrZBJAC.gifTUJhJFi.gifXjwwARd.gifDCfyJEZ.gif0jiqJzm.gifijRP96L.gifpz33g0h.giflEgJ4Pi.gifEIXXKvC.gifNp1wQef.gifwZeJbQs.gifz5r213j.gifjko7j44.gifL0laUN4.gifBr3m9MN.gif


#1302 AJNR

AJNR

    >mfw Project Progress

  • Ace Member
  • 554 posts
  • LocationBrooklyn, New York
  • RM Skill - Artist

Posted 01 April 2014 - 04:24 PM

Okay, those methods work as is, but I'll put them up (I was just asking if the return x if y method I was using was correct):

Spoiler

 

The only reason I didn't add those is because if I insert those 3 functions by themselves, they work, but if I use the Basic_Attack function (Weapon_Damage) it returns 0 damage.


Pearl.pngq53jyMM.gifPearl_Flip.png


#1303 TheoAllen

TheoAllen

    Wandering Hunter

  • Ace Member
  • 239 posts
  • LocationIndonesia
  • RM Skill - Coder

Posted 01 April 2014 - 05:19 PM

Wait a minute....

I just realize that you wrote .include? in a wrong way.

I though the 3 methods cause the problem

 

The a.atk_elements.include?() only accepts one value.

You can't insert multiple values in that method.

 

Instead, try to use this 

if [3,4,5].any? {|elem_id| a.atk_elements.include?(elem_id)}

 

Sorry for my bad...


My scripts collection :
http://theolized.blogspot.com/
Sorry if I made it in Indonesian

Supporter of :
1viwZUi.png

Make your own party composition based on 31 playable characters :
Um49Knu.gifatgZMqB.gifVSYyHJW.gifuQg15JR.gifGMwnDzr.gifJXX3YES.gifG6PbyQB.gift1SSEgm.gifLZANXrT.gifQrsC7UF.gifklkNdKW.gifDFIr27Z.gifOsRSVVA.gifWhpXAKn.gifBgkgoFS.gifE6O3uwJ.gifDrZBJAC.gifTUJhJFi.gifXjwwARd.gifDCfyJEZ.gif0jiqJzm.gifijRP96L.gifpz33g0h.giflEgJ4Pi.gifEIXXKvC.gifNp1wQef.gifwZeJbQs.gifz5r213j.gifjko7j44.gifL0laUN4.gifBr3m9MN.gif


#1304 AJNR

AJNR

    >mfw Project Progress

  • Ace Member
  • 554 posts
  • LocationBrooklyn, New York
  • RM Skill - Artist

Posted 01 April 2014 - 05:29 PM

Yup, it definitely works. Thanks a bunch


Pearl.pngq53jyMM.gifPearl_Flip.png


#1305 AJNR

AJNR

    >mfw Project Progress

  • Ace Member
  • 554 posts
  • LocationBrooklyn, New York
  • RM Skill - Artist

Posted 05 April 2014 - 05:49 PM

Sorry to double post, but I'm trying a quick edit to the base script:

How would I correct the following?

 

Element Rate 12 is "Poison" and States 2, 19, 43 are Poison States

 

Edit:

def regenerate_hp
    return @damage = -(1000 * self.element_rate(12) * hrg).to_i if self.state?[2, 19, 43] 
    return @damage = -(1000 * hrg).to_i
    perform_map_damage_effect if $game_party.in_battle && damage > 0
    @result.hp_damage = [damage, max_slip_damage].min
    self.hp -= @result.hp_damage
  end

Wrong Template, sorry


Edited by AJNR, 05 April 2014 - 06:08 PM.

Pearl.pngq53jyMM.gifPearl_Flip.png


#1306 DarthVollis

DarthVollis

    Moogle Master

  • + Premium Members
  • 344 posts
  • LocationSivart's Casino
  • RM Skill - Jack of All Trades

Posted 11 April 2014 - 06:15 PM

I want to add states in a scripts how would that be accomplished?


Posted Image

#1307 SoulpourVII

SoulpourVII

    Crownless King

  • Ace Member
  • 834 posts
  • LocationPhilippines
  • RM Skill - Coder

Posted 11 April 2014 - 06:36 PM

There are many ways to do that.

$game_actors[actor_id].add_state(state_id)

where actor_id is the actor's id and state_id the id of the state you want to add the actor.

 

If you want it to be all members of your party:

$game_party.members.each do |member|
 member.add_state(state_id)
end

where state_id is the state's id on the database that you wanted to add to all the party members.


For the link of my scripts:

 

script_banner.jpg?w=200&h=200

 

I am a supporter of:

 

F2iYq0r.png?2Fdlq6er.gif P0zFTvB.png


#1308 DarthVollis

DarthVollis

    Moogle Master

  • + Premium Members
  • 344 posts
  • LocationSivart's Casino
  • RM Skill - Jack of All Trades

Posted 11 April 2014 - 07:28 PM

That answers that question, but what if I need the actor id to be a variable because of multiple main characters. 


Posted Image

#1309 TheoAllen

TheoAllen

    Wandering Hunter

  • Ace Member
  • 239 posts
  • LocationIndonesia
  • RM Skill - Coder

Posted 11 April 2014 - 07:51 PM

Try using $game_variables[id]

$game_actors[$game_variables[id]].add_state(state_id)

Replace the 'id' with variable id that you want to use

 

For example :

$game_variables[1]


My scripts collection :
http://theolized.blogspot.com/
Sorry if I made it in Indonesian

Supporter of :
1viwZUi.png

Make your own party composition based on 31 playable characters :
Um49Knu.gifatgZMqB.gifVSYyHJW.gifuQg15JR.gifGMwnDzr.gifJXX3YES.gifG6PbyQB.gift1SSEgm.gifLZANXrT.gifQrsC7UF.gifklkNdKW.gifDFIr27Z.gifOsRSVVA.gifWhpXAKn.gifBgkgoFS.gifE6O3uwJ.gifDrZBJAC.gifTUJhJFi.gifXjwwARd.gifDCfyJEZ.gif0jiqJzm.gifijRP96L.gifpz33g0h.giflEgJ4Pi.gifEIXXKvC.gifNp1wQef.gifwZeJbQs.gifz5r213j.gifjko7j44.gifL0laUN4.gifBr3m9MN.gif


#1310 DarthVollis

DarthVollis

    Moogle Master

  • + Premium Members
  • 344 posts
  • LocationSivart's Casino
  • RM Skill - Jack of All Trades

Posted 11 April 2014 - 09:13 PM

That gave an error.

 

Capture_zps60671a30.png

 

 Here is the way I have it set up.

 

Cap_zpsfacc349d.png


Posted Image

#1311 Xypher

Xypher

    Advanced Member

  • Ace Member
  • 809 posts
  • RM Skill - Jack of All Trades

Posted 11 April 2014 - 10:32 PM

you can use $game_party.leader to specify the first party member in your party.



#1312 TheoAllen

TheoAllen

    Wandering Hunter

  • Ace Member
  • 239 posts
  • LocationIndonesia
  • RM Skill - Coder

Posted 11 April 2014 - 10:45 PM

That is because the script call is too long. Try to simplify it

id = $game_variables[25]
actors = $game_actors
actors[id].add_state(28)

My scripts collection :
http://theolized.blogspot.com/
Sorry if I made it in Indonesian

Supporter of :
1viwZUi.png

Make your own party composition based on 31 playable characters :
Um49Knu.gifatgZMqB.gifVSYyHJW.gifuQg15JR.gifGMwnDzr.gifJXX3YES.gifG6PbyQB.gift1SSEgm.gifLZANXrT.gifQrsC7UF.gifklkNdKW.gifDFIr27Z.gifOsRSVVA.gifWhpXAKn.gifBgkgoFS.gifE6O3uwJ.gifDrZBJAC.gifTUJhJFi.gifXjwwARd.gifDCfyJEZ.gif0jiqJzm.gifijRP96L.gifpz33g0h.giflEgJ4Pi.gifEIXXKvC.gifNp1wQef.gifwZeJbQs.gifz5r213j.gifjko7j44.gifL0laUN4.gifBr3m9MN.gif


#1313 DarthVollis

DarthVollis

    Moogle Master

  • + Premium Members
  • 344 posts
  • LocationSivart's Casino
  • RM Skill - Jack of All Trades

Posted 17 April 2014 - 12:51 PM

My game has a time system with day and night and I wanted to know if there is a way that I can have the enemies stronger or different at night. I am using Falcao's  Pearl ABS and my enemies walk around on the map but their data comes from the database.


Posted Image

#1314 trapless

trapless

    ɘltiT ЯɘdmɘM

  • Ace Member
  • 57 posts
  • RM Skill - Jack of All Trades

Posted 17 April 2014 - 04:05 PM

I'm not aware of a script that already does it, thos it's possible there is one already.

 

That functionality could be implemented via a <notetag> on the enemy that would call a stat boost defendant on an conditional branch.

 

if [switch: "night time" == on]

  stat += "value of stat boost"

end

 

try the script request board if you cant find an existing script.   :)


galv-plea_zps59cc531b.png


#1315 blacks888

blacks888

    Member

  • Ace Member
  • 10 posts
  • LocationPhilippines
  • RM Skill - Jack of All Trades

Posted 21 April 2014 - 04:44 PM

Hello.

My question is: How to determine the actor who attacked in battle using script call? 



#1316 SoulpourVII

SoulpourVII

    Crownless King

  • Ace Member
  • 834 posts
  • LocationPhilippines
  • RM Skill - Coder

Posted 21 April 2014 - 10:17 PM

Getting it through Game_Battler:

class Game_Battler < Game_BattlerBase
  alias :get_user_id_item_apply                           :item_apply
 #--------------------------------------------------------------------------
  # * Apply Effect of Skill/Item
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    get_user_id_item_apply(user, item)
    if user.is_a?(Game_Actor)
      p user.id
    end
  end
end

where 

 p user.id

prints out the attacker's id.


For the link of my scripts:

 

script_banner.jpg?w=200&h=200

 

I am a supporter of:

 

F2iYq0r.png?2Fdlq6er.gif P0zFTvB.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users