hey guys, i was wondering if there is a script call that checks if any input button is pressed? mainly for use in a conditional branch so if the player moves or anything then the condition can run.
Input.press?
Input.trigger?
Quote from: diagostimo on June 05, 2012, 08:41:17 pmmainly for use in a conditional branch so if the player moves or anything then the condition can run.
QuoteConditional Branch : $game_player.moving?
@>
@>
End
or
QuoteConditional Branch : Input.dir8 != 0
@>
@>
End
cool thanks guys, also off topic but im trying to change my actors graphic via script and it will change when a switch is activated, heres what i have at the moment:
class Game_Map
if $game_switches == (0 == true)
actor = $game_actors[0]
actor.set_graphic("aluxeswc.png", 255)
$game_player.refresh
end
end
i got my code from reading the interpreters and seeing how the events did it but i havnt had any look so far :(
Not sure what "game_switches = (0 == true)" is supposed to do, you didn't find that in the Interpreter.
0 will never equal true, and $game_switches will never equal false. Game_Switches is a wrapper for an array that simply holds a bunch of true/false values.
This is probably something like what you want to do:
class Interpreter
def my_call
if $game_switches[ID_OF_SWITCH]
a = $game_actors[ID_OF_ACTOR]
a.set_graphic('aluxeswc', a.character_hue, a.battler_name, a.battler_hue)
end
end
end
You simply replace the values in all caps with what you want, and call "my_call" in a script call.
EDIT:
On another note, a value of 0 for index of $game_actor will throw an error. In pretty much all the data classes, the first element is always nil.
hm i tried messing with that example but no luck, im calling the it with this script call: $my_call
also do i need the $game_player.refresh? im not getting any errors its just not doing anything :/
class Newclass
def my_call
if $game_switches[0]
a = $game_actors[nil]
a.set_graphic('aluxeswc.png', 0, nil, 0)
$game_player.refresh
end
end
end
You just modified every bit of code I posted as an example to something totally different, the majority of which will cause errors, and somehow expect it to work?
- I used "Interpreter" so that you could use it as a script call without creating a new class.
- You can't use "nil" as an indexer for an array.
- You changed "set_graphic" to use "nil" as a battler name. This will cause an error.
- I don't know why you insist on $game_player.refresh. It does nothing in this situation.
Paste the script I posted in a new slot. Change the actor id to 1, change the switch id to 1. Make a script call with the event command that simply reads "my_call". Nothing else. No $ symbols. No @ symbols. Just that.
cool i got it to work, im still getting used to how all the functions work but im slowly getting there, iv also been trying to change the actors step_anime to true, what im trying to build here is a script that changes the graphic, sets it so the character is animated then switches back, heres what i came up with to turn step_anime on:
class Game_Character
alias new_update update
def update
new_update
if game_switches[1]
@actor_step_anime = true
end
end
end
the problem here is every event is set to this also