Hello, how do I make it so when a certain common event is running, the player is unable to run and can only walk?
I have devised a stealth skill and want to make it so the player cannot run while using the stealth skill (which calls a common event).
Thank you.
Common Event that Disallows Player Running
● ARCHIVED · READ-ONLY
-
-
I''m afraid you need a script to do that(I don't know if it can be done without scripting).
Right now, what in my mind is changing the map dash setting via script call. Then you can assign the script call from common event. But first paste this short code in new slot script
class Game_Map def disable_dash_now @map.disable_dashing = true end def enable_dash_now @map.disable_dashing = false end end # End of Game_MapThe script call for disable dash is :$game_map.disable_dash_now
and for enable dash is $game_map.enable_dash_now
How you implemented it with your skill, I leave it to you :) -
Do you know how that would work if you saved your game, exited, then resumed your game after disabling dashing? Would it still be disabled, or would the map have reloaded and the setting overwritten?
-
Since the map doesn't reload upon loading (unless you modify the loading sequence), unless the game is re-saved using the editor, the value would be kept. At least that's how it should be.
That is assuming the disable is done before saving. -
@Shaz
That's why I put this on my first line.
And I still don't really know the OP's gameplay mechanism.Right now, what in my mind is changing the map dash setting via script call.
Does the Stealth skill can be used forever or not, does the game allowing the player to save or not while doing Stealth skill.
But in fact that's not real problem, here's what I mean. The player activate Stealth skill, that means he can't do dashing because the map dashing is disabled. That means the actor is in the status Stealth. Now if the player save his game, then exit, then load his game, again Does the actor still in Stealth Skill? Of course, because it also saved too. So that's been expected, player still can't do dashing because when he load the game and the game load the map the dash is disabled and actor in Stealth status.
The real problem is if player changed map while the actor is in Stealth Skill, the new map dash setting is following the default map dash setting, that's why this my last line
Perhaps he use it only on specific map, and give handler in every transfer map event, who knows :)How you implemented it with your skill, I leave it to you :) -
@Shaz
That's why I put this on my first line.
And I still don't really know the OP's gameplay mechanism.
Does the Stealth skill can be used forever or not, does the game allowing the player to save or not while doing Stealth skill.
But in fact that's not real problem, here's what I mean. The player activate Stealth skill, that means he can't do dashing because the map dashing is disabled. That means the actor is in the status Stealth. Now if the player save his game, then exit, then load his game, again Does the actor still in Stealth Skill? Of course, because it also saved too. So that's been expected, player still can't do dashing because when he load the game and the game load the map the dash is disabled and actor in Stealth status.
The real problem is if player changed map while the actor is in Stealth Skill, the new map dash setting is following the default map dash setting, that's why this my last line
Perhaps he use it only on specific map, and give handler in every transfer map event, who knows :)
Player may save while stealthed (currently, but this could easily change, it isnt important to me).
The stealth mechanism is for an ABS game. The player uses stealth, which triggers a common event shutting off enemy sensors (wont be able to be attacked), turns the player into a shadow, and after 25 steps are taken, resets back to normal (opacity goes to 255, enemy sensors are re-enabled, etc), I want the trigger of the skill use to also prevent running while the skill is being used (during those 25 steps).
No - this skill would have to work on multiple maps. Is there a way to simply disable the button that allows for running, temporarily? -
If you make the skill add a state to player, you can modify the real_speed method (Game_Player I think) so that it won't take into account dashing if the actor has the state
-
Well, I suppose the obvious followup would be how to do that exactly. I know how to make states, but not the modify real_speed_method etc..If you make the skill add a state to player, you can modify the real_speed method (Game_Player I think) so that it won't take into account dashing if the actor has the state
-
class Game_Player
def real_move_speed
if $game_actors[id].state?(state_id)
return @move_speed
else
return @move_speed + (dash? ? 1 : 0)
end
end
end
This will disable the consideration of dashing if $game_actors[id] has the state -
I just tested this in my game, but it's throwing up an error:
"undefined method 'state?' for nil:NilClass" -
[From: Engr. Adi]I just tested this in my game, but it's throwing up an error:
"undefined method 'state?' for nil:NilClass"
it should be this actually, I forgot that it needs the value to return...
Code:class Game_Playerdef real_move_speedif $game_actors[id].state?(state_id)return @move_speedelsereturn @move_speed + (dash? ? 1 : 0)endendend -
Have you by any chance used [id] without modifying it???I just tested this in my game, but it's throwing up an error:
"undefined method 'state?' for nil:NilClass"
You should change it to the id of the actor that ur using for the check -
Yep. Just like you thought, I had only changed the state_id. I can enter the actors in array format, yeah?
EDIT: Just tested it, it did need an actor ID. But it won't let me do array format..... But! This still opens up a range of possibilities, thank you Dymdez for posting the topic! -
It only checks for a single actor :)
-
$game_actors[id] is AN actor. Not an array of actors.
If you want to see if ANY actor in the party has a certain state, you'd do something like this:
$game_party.members.any? {|actor| actor.state?(state_id)}replacing state_id with the actual id of the state (no leading zeros).
In battle, that will just look at the first 4 battlers. Outside of battle it'll look at the entire party. If you want it to ALWAYS look at just the first 4 battlers, use $game_party.battle_members instead, and if you want it to ALWAYS look at the whole party, use $game_party.all_members