Common Event from a Skill, invoking a switch?

Lynvia

Veteran
Veteran
Joined
Oct 14, 2015
Messages
88
Reaction score
45
First Language
English
Primarily Uses
RMMV
I'm not getting a common event to fire, when executing a skill that fires that common event. Explanation and screen shots below, hopefully.

The game I'm working on involves having the player walk up to an event, which has a conversation with them, each time the event speaks, it's a lie, which the player needs to choose a verse, stored in skills, to refute. The verses are gained via level up, finding on scraps of paper, etc, or via events. So it needs to be a variable list that the party members have stored, not a choice list.

Anyway, I have a test event on my first panel.
When the player 'talks' to the event, the following code runs:
(This should open the menu, allowing the player to select a verse from one of the characters, which should turn on a corresponding switch, which is then checked by the event when control returns to the event.

This forces the character to open the menu screen, where they will choose the correct verse from skills.
As long as they HAVE the correct verse stored, and choose the correct verse, it should fire the common event 2tim215.
upload_2017-3-1_7-10-46.png
(The scope on this skill is NONE, so that it doesn't have to be 'applied' to any person, just used...)
The common event fires the code below, setting on the desired switch that the original event will be checking:
upload_2017-3-1_8-1-45.png

When control turns to the event, though, the switch does not appear to be on, and the text window in the common event never shows up either, which tells me the common event is NOT running.
Instead I get:
upload_2017-3-1_8-5-28.png
Is this a setup issue? Or a problem with the scope of the skill??

(Oh, and PS, is there an easier way to do this? I'm going to have literally HUNDREDS of verses in this game, all firing common events to set switches (not parallel, just event driven) But I need to get the base process right before diving into setting them all up.
 

Attachments

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
1,483
Reaction score
986
First Language
English
Primarily Uses
The inherent problem is that the conditional branch which checks the switch being on in your event happens before the common event executes. There is probably a much easier way to do this in Javascript; if you tell me exactly what it is you're trying to do I'll try to put something together for you.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,772
First Language
German
Primarily Uses
RMMV
Here is a more complete explanation:

Common events are only executed on the map. Even if they're called by skills from menu, they go into a stack of reserved procedures that is processed only after the menu is closed and the player back on the map. And since your menu was called from an already running event, that event is completed before the common event is processed.


I would do it in a completely different way, which would solve the problem and make the process much more stream lined:

Make each verse an item, set those items to an item type that you don't use for anything else and keep it reserved for "verse items" (regular item and key item are listed in the menu, hidden items A and hidden items B are not listed).
Then, instead of opening the menu you use the command "select item" on that item type. It will list only those "items" (or verses) of that type that you have gained until then, and load the ID of the selected item in the variable given.
Then you can simply test if the number in that variable is the correct one for the current situation instead of checking one of hundreds of switches.
 

Lynvia

Veteran
Veteran
Joined
Oct 14, 2015
Messages
88
Reaction score
45
First Language
English
Primarily Uses
RMMV
@Andar - ouch. So common events wouldn't work.
Since it's my plan to use some verses in the bank for healing or encouragement, building 'faith' (MP) and protection, defense, etc, I'd rather use skills, with a special type of skill for 'Application' which would be used for refuting lies.

While all other verses have a purpose that can be called during battle or from the menu for skill application, it makes good sense to do it that way, although I've seen items used for power ups, defense ups, etc.

The 'kicker' is that I want individuals in the party to have their own bank they can use, while items are shared in the party. In fact, the verse chosen would determine the face presented in the event (who is quoting the verse) - that is, if the correct verse is chosen.

I'd want the verses to show up under a menu as such. since there won't be magic in this game, but some of the verses will 'operate' in that fashion, the verses would need to all show, as they are all 'learned'... Using items could work, but then the verses would show up with bandaids, energy drinks, etc. Currently they will show up anyway alongside 'Attack', but subdivided by skill type.

I also considered setting up 'states' for the player, hundreds, one for each verse. These would all have to be cleared after the event completes. But I'm concerned there's a limit to how many can be applied to a player, and whether they'd show up.

If all else fails, I will try the item application.

@Trihan - I will PM offline, scripting might be the best option. I'm a programmer by employ, but not well versed in javascript, just X++, VB and RPG (the language, but I'm also an expert at the games...:smile:)

in a nutshell, though, gameplay will be two types - in one, the player confronts a blocking 'plant' that spouts a single lie. Player must choose a verse to refute the lie. If successful, the player enters a battle and fights the plant with physical attacks to get it 'out of the way'. XP and MP rewards and leveling up for success. If fail (chose wrong verse), lose MP (faith) and some HP. (plant strikes back).
Second type is confronting a 'possessed' human. Spouts 3-5 lies, one at a time. Player chooses right verse to refute, each time, gains MP and XP, human is 'unpossessed' and either leaves, or joins party, if a major character.

All of this will be event driven, each plant or human will be an event, for the most part stationary and blocking passage. Verses are 'found' during events, or in books, scraps of paper, signs on walls, computer screens, etc, as well as 'earned' in level-ups. Party members have different verses 'learned'. Verses fall into categories - Healing, Application (unblocking/refuting lies), Defense, Power-ups, rebuilding faith (MP), encouragement.

Thanks for the quick replies!:smile:
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,772
First Language
German
Primarily Uses
RMMV
@Lynvia
In that case, your best option would be to use the damage formula with the script command to either turn a switch or set a variable value.
In such a case you should make it a skill targeted on the user, usable only in the menu and not in battle and doing a zero effect (probably MP damage zero or something like that) and use the then active damage formula for affecting switches or variables.

And I think a variable "verse number used" would still be better as an approach using hundreds of different switches.
 

Lynvia

Veteran
Veteran
Joined
Oct 14, 2015
Messages
88
Reaction score
45
First Language
English
Primarily Uses
RMMV
@Andar BRILLIANT! And yes, the variable is a MUCH better choice.
 

Lynvia

Veteran
Veteran
Joined
Oct 14, 2015
Messages
88
Reaction score
45
First Language
English
Primarily Uses
RMMV
Well, but maybe I'M not so brilliant.
I added the following to the damage formula of skill#11, which I chose, and I still get Oops:
;$gameVariables.setValue(1, 11);
I had it without the leading semicolon, but got no result, so I added the semicolon in case it needed a 'SQL insertion hack' to jump to script code...

The variable# I am using is 0001, but I have named it. Do I need to reference by name?
Or do I need to add script() around it?
 

Lynvia

Veteran
Veteran
Joined
Oct 14, 2015
Messages
88
Reaction score
45
First Language
English
Primarily Uses
RMMV
Actually, it never allows me to apply the skill/'spell' to the user, or ally, or all allies. it just buzzes at me.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,772
First Language
German
Primarily Uses
RMMV
[dpost]Lynvia[/dpost]
If you have to add something and your own post is the last, just edit it.

Please attach a screenshot of the skill - if it just buzzes, then there is one condition on skill use that you don't fulfill.
Best guess? you made it a healing skill, those require the target to be wounded even if rhey do 0 healing. (which is why I made the example of MP damage above)
 

Lynvia

Veteran
Veteran
Joined
Oct 14, 2015
Messages
88
Reaction score
45
First Language
English
Primarily Uses
RMMV
upload_2017-3-2_7-10-16.png
Here you go. Sorry for the triple-post. it slipped my mind about editing the original.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,772
First Language
German
Primarily Uses
RMMV
your damage formula is wrong.

"a.mp - 0" would result in the damage being a.mp or completely emptying the actors MP if it were processed.
However, it won't be processed because the damage formula does not result in a number, because the last part is a command.

The result of the damage formula always has to be a number, because that number will be used for damage or healing or whatever.
And the result is always the last number processed, so if you want to do something in addition to the damage, those commands have to come first.

The correct structure would be something like
Code:
$gameVariables.setValue(1,11);0
However, please check your formula for spelling - something still looks off on it with capitalization (g and G are not identical for javascript), but I can't check it myself at the moment. And no semicolon after the last part please
 

Lynvia

Veteran
Veteran
Joined
Oct 14, 2015
Messages
88
Reaction score
45
First Language
English
Primarily Uses
RMMV
I actually pasted the code from the Script Call spreadsheet placed elsewhere. And vetted it against @Shaz 's Damage Formula thread, just in case there was a typo in it. I also pasted the formula you just gave me, above, still the bubuzz... sigh.

It's possible the character class is not allowing an MP damage, or is it even possible to do a spell against yourself that deals damage?
I added every skill type to the character's class, still no dice. I gotta go to work, so I won't have time to dig further till later.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
29,230
Reaction score
6,772
First Language
German
Primarily Uses
RMMV
try to use it with HP damage then - MV did change a few things in the structure and I can't test it myself right now.
Also test the same settings in a completely new project, to make sure that it doesn't conflict with anything else in your plugins or so.
 

Lynvia

Veteran
Veteran
Joined
Oct 14, 2015
Messages
88
Reaction score
45
First Language
English
Primarily Uses
RMMV
I know this is a support forum thread, and you answered my original question clearly a few posts ago, so, sorry if this is devolving into more of an advice column.

Thinking about the way game mechanics work, this might work better if the event launches a battle, with a Troop associated with the particular character or 'lie'. Then, I can use event pages on the Troop to control the conversation. This allows me to limit the choices of what the character can select to just skills, and limit or lock physical attacks.

It still leaves open the question of how to flag the system which verse was chosen, but once the skill damage formula question is resolved I think it will work better this way.

The 'enemy' can still physically attack, in between lies, which motivates the player to choose the correct answer, or escape. The physical attack back could be locked completely when going up against humans, and released once the correct answer is given, for the 'man-eating plants'...

I will try a fresh project, no plugins at all, and verify the skill-sets-variable damage formula method on MP Damage or HP Damage, when I am home tonight. I bet I've got something wonky with the class definition or character, and a fresh project with base characters will give me an understanding of how the formula bar can be used.

Been at this long enough now that I figured (as a programmer) I wouldn't be running into these learning curve issues. But there's quite a bit to learn in RMMV, from eventing and asset creation to plug-ins and scripting.

Thanks much for your help!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts


The main character of the book)
Things you can say about your rpg maker project but not your bf/gf: I'm not super committed but it's fun to play around with it.
putting a puzzle in my game that BSODs the player's computer if they complete it
I finally got a book out the door after seven years of nothing \^-^/ Now if I can get a game out the door too, that'd be great...

Forum statistics

Threads
94,366
Messages
920,302
Members
124,132
Latest member
voltrone
Top