If i remember correctly Another Fen made one for the German Community, but the Website went down forever, here the Script without the Big Info explanation which is lost now.
Self Variables Script for Events:
Code:
class Game_System
def self_variables(map_id, event_id)
if map_id > 0 and event_id > 0
# Erstelle Self-Variables-Hash wenn noch nicht vorhanden:
@self_variables ||= Hash.new
@self_variables[map_id] ||= Hash.new
@self_variables[map_id][event_id] ||= Hash.new(0)
else
# Bei ungültiger Map-/Event-ID gebe einen leeren Hash zurück:
Hash.new(0)
end
end
end
class Game_Interpreter
def self_variables(event_id = @event_id)
$game_system.self_variables(@map_id, event_id)
end
end
class Game_Event
def self_variables
$game_system.self_variables(@map_id, @id)
end
end
Self Variables Script for Actors:
Code:
class Game_Actor < Game_Battler
def variables
@variables ||= Hash.new(0)
end
end
class Game_Interpreter
def actor_variables(actor_id)
actor = $game_actors[actor_id]
actor != nil ? actor.variables : Hash.new(0)
end
def member_variables(member_index = 0)
actor = $game_party.members[member_index]
actor != nil ? actor.variables : Hash.new(0)
end
end
Here some Examples of the Script and in General:
$game_system.self_variables([ID of your Map], [EventId])[Self Var Name/Number] = 1234
$game_system.self_variables([$game_map.map_id], [1])[Villager Gold] = 1234
Iam not sure about the brackets [] , long time not used this and never realy did so in the past. But its an awesome Script.
The moment you assign something to a Self Variable thats the moment it gets created. So no need for any previous Setup.
The Variables also get Safed in the Safefiles as far as i know, so no known Bugs or Problem known. But i dont have any more code examples. the call for the seccond one i dont have but should be no problem to paste something together with the available infos.