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.

Script for unarmed combat

I am using a side battler script that shows the weapon equipped while attacking. The problem I am having is that when a character doesn't have a weapon equipped I get an error "can't dup nilclass".

Is there anyway, through eventing, or even another script, that will automatically change to a weapon named "fist" once any weapon from any actor becomes unequipped?


This is the original thread with the script I am using.
http://www.rmxp.org/forums/http://dev.r ... 92#p300492

Thanks in advance.  If anyone can solve this problem they would fix a huge bug in my game.
 
You could do it with a common event parallel to an always on switch depending on how many weapons your characters will have access too.

Code:
@>Conditional Branch: [User] is [Weapon] equipped
  @>
 : Else
  @> Change Equipment: [User], Weapon = [Fist]
  @>
 : Branch End
@>
 
I've actually had that issue and came up with a nice little event system.
I also recommend putting this as a common event.

Instructions Below Code

Code:
@>Conditional Branch: Script: $game_party.actors[0].weapon_id == 0
    @>Change Weapons [Weapon Name] +1
    @>Change Equipment: [Character], Weapon = [Weapon Name]
    @>
:   Else
    @>Change Weapons: [Weapon Name] -1
    @>
:   Branch end

Ok, what you want to do is ues a conditional branch and on the 4th tab, select "script" then input the below code into that textbox.

Code:
$game_party.actors[0].weapon_id == 0

After that, you will need to use events for the rest in between. the (as shown above) for each actor, change the "0" in the script to the new actor.

0=actor 1
1=actor 2
and so on...

For Multiple Characters, I recommend a conditional branch inside a conditional branch (demonstrated below)
Code:
@>Conditional Branch: Actor in party (choose the actor you want this to apply to)
    @>Conditional Branch: Script: $game_party.actors[0].weapon_id == 0
         @>Change Weapons [Weapon Name] +1
         @>Change Equipment: [Character], Weapon = [Weapon Name]
         @>
   :     Else
         @>Change Weapons: [Weapon Name] -1
         @>
   :     Branch end
Note: The multiple one just demonstrates the general look, meaning it should show to "branch end" and possibly 2 "else"

Basicly, add one conditional branch that checks to see if an actor is in you party, then just add the weapon check conditional branch below that and change the "0" in the script to the actor you want this to apply to.

NOTE: There is a small updating problem, the changes will not occur untill you close fully out of the menu, then open the menu again.

Hope this helps you  :grin:
 
This one intruigues me, in that I need this as well.  I'll edit it so that when you select a weapon, if you choose a blank spot, a hidden item (fist, or unarmed) is actually selected.  I'll also make a spellbook item for mages that disables the attack command but boosts SP & MDEF.

Look for the release in a couple days, I post back here when I get it done.
 
Ok, sorry to necro here but I've finally been able to test this.

This idea does work but the problem I have is that the player can choose who to have in the party and the party positions change.

Script: $game_party.actors[0].weapon_id == 0

This points to the position of the actor in the party.

Actor #1 is Osmo, but Osmo isn't always in the front of the group in the first position

@>Conditional Branch: Script: $game_party.actors[0].weapon_id == 0
    @>Change Weapons [fist] +1
    @>Change Equipment: [Osmo], Weapon = [Weapon Name]
    @>
:   Else
    @>Change Weapons: [Weapon Name] -1
    @>
:   Branch end




I'm trying to create a set of conditional branches that might fix this (Free time is a problem), but if anyone has any other suggestions that might work that would rock.

Thanks,
 

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