RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
help using different skills with different weapons. [RESOLVED]

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 85
In my game I'm making you can use medieval weapons like swords, clubs. etc. and you can use more futeristic weapons like guns, rifles, shotguns, etc. How can I make it so that when you are wielding a sword type weapon you can use a sword skill like double slash, and when you are wielding a gun you can use a skill only for guns like say burst fire. But when you are wielding a gun you cannot use the sword skill double slash. This probably sounds confusing but if someone can help me that would be great.
« Last Edit: July 05, 2009, 08:02:50 PM by ryuzaki95 »

**
Rep:
Level 83
hey ryuzaki95,

Okay so I've figured out one way that you can do this. It will be time consuming but it will make your game really cool in the end.

There are 3 event functions that you need to use; Conditional Branch(page 1), Change Skill(page 3) and Show Text(page 1).

1. Create an event and make sure it's set as a parallel process.

2. You're going to have to create a conditional branch for each weapon for each actor. So click on condition branch and go to page two where you can select the actor and the weapon they have equipped.

3. Next you need to make that actor learn the skill you want them to know when wielding that weapon. So select change skill; set actor, make sure learn is selected, pick the skill.

4.1 To unlearn any abilities you don't want the character to have you use change skill again except make sure forget is selected.

4.2 This is the hardest part because for each and every possible weapon that character can wield you must add the forget skill. In theory once a person starts playing the game you will have no idea what weapon they are wielding and when. So you have to make sure that when a skill can be learnt, all other possible skills that character could possible learn disappear.

Check out the spoiler for an image of a basic mock up.

5. To make sure that the skill change auto updates where ever the character is I found that by insterting an empty text box it helps to trigger an instant update. Otherwise you have to leave and reenter the screen in order for the skill change to auto update. Which would fail miserably if the player changed weapon while out in the field.

6. Copy and paste this event in every single map of your game.

Recommendation: Only make the one event square for now so as you constantly add new weapons you can update your event. Then once you're satisfied that you have entered all possible weapons in your game then go around adding that event to everyone of your maps.

I hope this helps but if anyone knows a better way to do this then by all means post it up.  ;D

Spoiler for:
I tested this event out in a weapon shop.

If you see anyone using Stand_Still as their user name then tell me. This is my logo that I created in 2006. Mine you tell me, mine. (c) 2006

*
Rep:
Level 87
I don't like events that have to be copied and pasted to every map and run as parallel just in case the player might do something to trigger it.

I would suggest doing this through the Actor equip script.

Use a hash table or an array to list the skills that go with each weapon.  When a weapon is unequipped, find the list of associated skills and make the character forget each one.  When a weapon is equipped, find the list of associated skills and make the character learn each one.  Of course, you'd also allow for weapons that don't have associated skills.
Always remember you're unique.
Just like everybody else.


*
Rep:
Level 87
shoot me an email on my AM email address if you get stuck. :)
Always remember you're unique.
Just like everybody else.

**
Rep: +0/-0Level 85
okay when i put in the empty text box and i test it all that it does is keep on displaying an empty text box.

**
Rep:
Level 83
okay i was worried that that might happen to you because it didn't happen to me. anyway there should be something like a 'text choices' option on the first page where you can select to hide the text box. make sure you add that above the text.

sorry i can't be more accurate right now because i'm away on holiday and am currently using the pay internet in reception. it's very annoying so i probably won't be able to get back on for a few days.

sorry but i hope this helps.

If you see anyone using Stand_Still as their user name then tell me. This is my logo that I created in 2006. Mine you tell me, mine. (c) 2006

**
Rep: +0/-0Level 85
hmm...it still shows a blank text box but i think i found a solution. Instead of putting in an empty text box put in an empty "comment" 1st page right under the "wait" option.

**
Rep:
Level 83
hey again,

sorry it took awhile to get back to you but crappy internet while on holidays suck. anyway I have found an easier way you can get the weapon system to run automatically without having to copy and paste the event on every screen.

You can use a common event and a switch to make it all sooo much easier.

Just copy and paste all of the weapon system eventing commands you have done so far into a common event. You can find 'common events' in the Database and it's like the second last tab.

Make sure you set it to parallel processes and then create a switch, for the sake of this example i'll call it 'Ability'.

To use this switch and the common event efficiently just make sure you create an event in the very first starting screen of your game when complete. Of course you can move the switch around to whereever your play testing the game.

To create the switch event, make a new event and make sure it's set to parallel processes. Then on the first page at the top of the right column select 'control switches'. Make a switch there called 'Ability' and make sure the position is set to on. NEVER turn this switch off at any point during the game.

So with this switch on and linked to the common event then there'll be no need to copy and paste the weapon change event to every screen of your game. 

I hope this helps to make things easier. ;D

Also I should be back online again saturday night australian time because i'll be home from my holiday. Yah! constant internet. ;D

If you see anyone using Stand_Still as their user name then tell me. This is my logo that I created in 2006. Mine you tell me, mine. (c) 2006

*
Rep:
Level 87
sorry to say, but this is an incredibly inefficient method of achieving what you're after.

Whether you do it as individual events on maps or as a common event, you're telling the game to check every frame whether the player has a weapon equipped (not whether the player has changed equipment), and if the weapon is equipped, you're telling it every frame to forget and learn a list of skills.  If the player has had that weapon equipped for the last 15 minutes, they are still forgetting and learning that same list of skills every frame.

I suspect you're going to see a LOT of lag due to this.

You need to change the skills at the same time you change the equipment.  Once.  That's it.

Here's a change to the Game_Actor script that will handle this very nicely (assuming the weapon id for sword is 1, and for gun is 2, and the skill id for double slash is 15, and for burst fire is 12):

Code: [Select]
def equip(equip_type, id)
  case equip_type
  when 0  # Weapon
    if id == 0 or $game_party.weapon_number(id) > 0
      change_weapon_skills(id) # Shaz - added to forget/learn skills when weapon is changed
      $game_party.gain_weapon(@weapon_id, 1)
      @weapon_id = id
      $game_party.lose_weapon(id, 1)
    end
    .
    .
  end
end

# Shaz - new function to forget and learn skills based on equipped weapon
def change_weapon_skills(id)
  # forget the skill for the current weapon
  case @weapon_id
  when 1 # Sword
    forget_skill(15) # Double Slash
  when 2 # Gun
    forget_skill(12) # Burst Fire
  end

  # Learn skill for new weapon
  case id
  when 1 # Sword
    learn_skill(15) # Double Slash
  when 2 # Gun
    learn_skill(12) # Burst Fire
  end
end

This will also work if the player currently has no weapon equipped, or if they are simply unequipping a weapon without replacing it with something else.

If you intend to give the player one of these special weapons right at the start of the game (through default equipment in the Actors tab), you should also change the Game_Actor setup function, and call change_weapon_skills(@weapon_id) after the line @weapon_id = actor.weapon_id
« Last Edit: July 09, 2009, 12:33:10 AM by shaz »
Always remember you're unique.
Just like everybody else.