Jump to content
Rpg²S Forum

*Dimensione degli eventi


dani3
 Share

Recommended Posts

Sized events

Descrizione


Questo script da la possibilita di avere eventi di varie dimensioni, aumentandone l'altezza e larghezza dei tile che li compongono


Autore


Toby Zerner

 

In un processo parallelo chiamare il seguente script:
$game_map.events[iD].size(SIZE_X, SIZE_Y)
dove ID sta per l'index dell'evento, SIZE_X per larghezza in tiles e SIZE_Y per lunghezza in tiles .

 

 

 

class Game_Character

attr_accessor :size_x # event size x
attr_accessor :size_y # event size y
attr_accessor :tiles_left # sizing - tiles to the left
attr_accessor :tiles_right # sizing - tiles to the right

def initialize
@id = 0
@x = 0
@y = 0
@real_x = 0
@real_y = 0
@tile_id = 0
@character_name = ""
@character_hue = 0
@opacity = 255
@blend_type = 0
@direction = 2
@pattern = 0
@move_route_forcing = false
@through = false
@animation_id = 0
@transparent = false
@original_direction = 2
@original_pattern = 0
@move_type = 0
@move_speed = 4
@move_frequency = 6
@move_route = nil
@move_route_index = 0
@original_move_route = nil
@original_move_route_index = 0
@walk_anime = true
@step_anime = false
@direction_fix = false
@always_on_top = false
@anime_count = 0
@stop_count = 0
@jump_count = 0
@jump_peak = 0
@wait_count = 0
@locked = false
@prelock_direction = 0
@size_x = 1
@size_y = 1
@tiles_left = 0
@tiles_right = 0
end

#--------------------------------------------------------------------------
# *** BEGIN Sized Events v1.0
#--------------------------------------------------------------------------
# By Toby Zerner
# USAGE:
# In a parallel process event, call this script:
# $game_map.events[iD].size(SIZE_X, SIZE_Y)
# Replacing the words in capitals with the actual details.
#--------------------------------------------------------------------------
def size(x, y)
# Set instance variables
@size_x = x
@size_y = y
# Work out the number of tiles either side of the event
tiles_x = (@size_x - 1) / 2
@tiles_left = tiles_x.floor
@tiles_right = tiles_x.ceil
end

#--------------------------------------------------------------------------
# * Determine if Passable
# x : x-coordinate
# y : y-coordinate
# d : direction (0,2,4,6,8)
# * 0 = Determines if all directions are impassable (for jumping)
#--------------------------------------------------------------------------
# EDITED FOR SIZED EVENTS
#--------------------------------------------------------------------------
def passable?(x, y, d)
# Get new coordinates
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
# If coordinates are outside of map
unless $game_map.valid?(new_x, new_y)
# impassable
return false
end
# If through is ON
if @through
# passable
return true
end

# Check map passability settings
# Loop through each x tile
for i in 0...@size_x
# Check x coordinates
# If unable to leave first move tile in designated direction
unless $game_map.passable?(x - @tiles_left + i, y, d, self) then return false end
unless $game_map.passable?(new_x - @tiles_left + i, new_y, 10 - d) then return false end
# Loop through each y tile
for j in 0...@size_y
# Check y coordinates
# If unable to leave first move tile in designated direction
unless $game_map.passable?(x, y - j, d, self) then return false end
# If unable to enter move tile in designated direction
unless $game_map.passable?(new_x, new_y - j, 10 - d) then return false end
# Check x and y coordinates
# If unable to leave first move tile in designated direction
unless $game_map.passable?(x - @tiles_left + i, y - j, d, self) then return false end
# If unable to enter move tile in designated direction
unless $game_map.passable?(new_x - @tiles_left + i, new_y - j, 10 - d) then return false end
end
end

# Loop through map events
for event in $game_map.events.values
# If self is in range of [event]'s sizing, we can't pass
if event_collide?(self, event, new_x, new_y)
return false
end
end

# If player coordinates are consistent with move destination
if event_collide?(self, $game_player, new_x, new_y) and self != $game_player
return false
end

# passable
return true
end

#--------------------------------------------------------------------------
# * Check if two events collide (event sizing)
# event1 : the first event
# event2 : the second event
# new_x : the new x coordinate of event 1
# new_y : the new y coordinate of event 1
#--------------------------------------------------------------------------
def event_collide?(event1, event2, new_x, new_y)
if event1.id == event2.id then return false end
collision = false
# Check if there is a collision on the y axis
# Loop through each individual tile on both events and compare them
for i in (new_y - (event1.size_y - 1))..new_y
for j in (event2.y - (event2.size_y - 1))..event2.y
# If event 1's tile is the same as event 2's tile, we have a collision
if i == j
unless event1.through or event2.through
# Make sure there is a graphic - if not, no collision
if event1.character_name != "" and event2.character_name != ""
# There was a collision
collision = true
end
end
end
end
end
# If there was a collision on the y axis...
if collision == true
# Check the x axis
# Loop through each individual tile on both events and compare them
for i in (new_x - event1.tiles_left)..(new_x + event1.tiles_right)
for j in (event2.x - event2.tiles_left)..(event2.x + event2.tiles_right)
# If event 1's tile is the same as event 2's tile, we have a collision
if i == j
unless event1.through or event2.through
# Make sure there is a graphic - if not, no collision
if event1.character_name != "" and event2.character_name != ""
# There was a collision
return true
end
end
end
end
end
end
# No collision
return false
end

end

class Game_Player

#--------------------------------------------------------------------------
# * Same Position Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_here(triggers)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
# EDITED FOR SIZED EVENTS
# If player's coordinates collide with the event and its sizing
if @x >= event.x - event.tiles_left and @x <= event.x + event.tiles_right and
@y >= event.y - (event.size_y - 1) and @y <= event.y and
triggers.include?(event.trigger)
# If starting determinant is same position event (other than jumping)
if not event.jumping? and event.over_trigger?
event.start
result = true
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Front Envent Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_there(triggers)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# Calculate front event coordinates
new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
# EDITED FOR SIZED EVENTS
# If player's new coordinates collide with the event and its sizing
if new_x >= event.x - event.tiles_left and new_x <= event.x + event.tiles_right and
new_y >= event.y - (event.size_y - 1) and new_y <= event.y and
triggers.include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
# If fitting event is not found
if result == false
# If front tile is a counter
if $game_map.counter?(new_x, new_y)
# Calculate 1 tile inside coordinates
new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
# All event loops
for event in $game_map.events.values
# If event coordinates and triggers are consistent
# EDITED FOR SIZED EVENTS
# If player's new coordinates collide with the event and its sizing
if new_x >= event.x - event.tiles_left and new_x <= event.x + event.tiles_right and
new_y >= event.y - (event.size_y - 1) and new_y <= event.y and
triggers.include?(event.trigger)
# If starting determinant is front event (other than jumping)
if not event.jumping? and not event.over_trigger?
event.start
result = true
end
end
end
end
end
return result
end
#--------------------------------------------------------------------------
# * Touch Event Starting Determinant
#--------------------------------------------------------------------------
def check_event_trigger_touch(x, y)
result = false
# If event is running
if $game_system.map_interpreter.running?
return result
end
# All event loops
for event in $game_map.events.values
# EDITED FOR SIZED EVENTS
# If passed coordinates collide with the event and its sizing
if x >= event.x - event.tiles_left and x <= event.x + event.tiles_right and
y >= event.y - (event.size_y - 1) and y <= event.y and [1,2].include?(event.trigger)
event.start
result = true
end
end
return result
end

end

 

 


Bugs e Conflitti Noti


Se usate lo XAS mettelo dentro lo script XAS - Initialize, prima di tutto il resto

Edited by Dilos
Script monoriga sistemato.

Partecipante al Rpg2s.net Game Contest 2007/2008

http://www.rpg2s.net/contest/GameContest0708/userbar_r2sgc.gif

Gioco in Sviluppo: Hokuto no Ken RPG

Link to comment
Share on other sites

parebbe che 'sto script ha un bug. Non aumenta correttamente l'evento, se metto 4, mi aumenta giusto in altezza ma aumenta solo 3 in larghezza.

Deviantart

ElfGamesWorks Forum

My adventure game
Little Briar Rose

Altri progetti: Oh! I'm Getting Taller! / Il pifferaio di Hamelin

I miei Fumetti: Folletto Vs Nenè / A.s.D. / A.s.D.2

http://www.rpg2s.net/img/fablecontest1st.pnghttp://rpg2s.net/gif/SCContest3Oct.gif http://i43.tinypic.com/1zokd2s.png http://i.imgur.com/qRfaRqE.png http://i43.tinypic.com/eger81.gifhttp://i.imgur.com/BEu6G.gifhttp://i43.tinypic.com/eger81.gif

Un sogno nel cassetto...

 

 

http://i.imgur.com/H1ARhq7.gif

 

 

Citaziò!

 

 

Il Coniglio, si sa, saltella con una gamba dietro ed una avanti, un braccino corto ed uno lungo, un'orecchia dritta ed una storta. Perchè il Coniglio odia la simmetria.

Flame: Io me lo sono fatto raccontare tutto il Sigmarillion ma ancora devo leggerlo (...)
Impaled Janus: Il Sighmarillion, un'opera molto triste.
Testament: Ma Flame mi sa che erra convinto, come al solito.

"Tu devi essere il chiacchierato FenriX, la cui fama deriva dall'arte di giungere rozzamente al sodo del concetto la maggior parte delle volte... detto in una via inoffensiva..." Una piaga in due righe, by Dr.Risolvo!

 

 


Scheda di Zuppo Del'Oquie


Nome - Zuppo Del'Oquie
Età - 76
Razza - Elvaan
Descrizione - Snello, faccia da cretino, cappelletto alla Robin Hood in testa con la piuma perennemente spiegazzata, maglia in pieno stile: "è la prima cosa che ho trovato in giro" e pantaloni uguali. Le scarpe invece sono forse l'unica cosa realmente sua. Di pelle morbida, salvo la base di cuoio, ottime per correre e fare poco rumore, prive di alcun tipo di tacco. Ed aldilà del vestiario, abbiamo una cerbottana, una fionda, un pugnaletto, una...un..ah no basta. Lo zainetto, si! Ma lì ci tiene il pane ed i suoi strumenti di dubbia qualità.
Poi..ha orecchie a punta come ogni Elvaan e capelli castano chiaro, bizzarremente brezzolati di ciocchette tendenti al biondo. E' un biondo fallito, in sostanza. Ah, ma a lui non importa molto. Detto, questo, null'altro di rilevante da segnalare.
Se non il fatto che, il più delle volte, sia vestiti che capelli che zaino sono ornati da una quasi perenne sensazione di Bagnato. Perchè ogni pozzanghera che esiste sulla faccia di questa terra, deve, senza via di scampo, finire contro il suo naso. O forse è lui che è legato all'elemento Acqua da un odio amore non espresso...?
Misteri del Fato.
Carattere - Simpatico, socievole, affabile, allegro, ed al tempo stesso estremamente indifferente alle questioni che non lo riguardano. Astuto, ma mai per cattiveria, decide lui a cosa affezionarsi ed a cosa no. Di mentalità molto..molto bizzarra, vive la vita con dei valori del tutto personali che possono essere a volte comprensibili ed in accordo con quelle altrui, o possono essere decisamente ridicoli agli occhi degli altri. Ma lui è fatto così e non ci ragiona poi molto su come è fatto. Finchè mantiene due braccia due gambe ed una testa, ritiene di essere fatto semplicemente perfetto per quel che gli serve!

Background - "Fratello minore. Si, minore! Oh si! DANNATAMENTE MINORE! E questo è un problema! Perchè è un problema, no? A logica dovrebbe essere un bel problema per chiunque abbia voglia di non essere sempre chiamato per secondo, interpellato solo all'ultimo come scorta, impegnato solo quando proprio tutti sono impegnati, considerato solo per fare numero. AH! Minore! Onta! Orgoglio! AH!
AH!
A...ahah! Ma col cavolo..è una pacchia!"

Tranquillamente adagiato sul suo enorme divano, perchè se l'erba è il cuscino, un colle è dunque un enorme divano, Zuppo stava fischiettando con una foglia di acetella in bocca, così univa l'utile (il fischiettare era molto utile a parer suo) con il dilettevole (e quella fogliolina aveva un buon sapore, perciò dilettevolmente saporita!).
Era a dir poco splendido compiere un'attività tanto impegnativa e semplice al contempo da giustificare la sua lunga, perenne, praticamente insindacabile assenza a qualsivoglia attività sociale.
Lui disegnava le mappe, ed il fratellone le spacciava per sue guadagnando una montagna di soldi, tanta era l'accuratezza delle zone anche più inesplorabili, ed in cambio il Brò gli garantiva una vita tranquilla e senza impegni. Oh, fratello minore, ma il maggiore era tutto merito suo!
Poi, all'improvviso, tutto cambiò.
Perchè serve sempre un grande cambiamento per una grande svolta, no?
Ebbene, da quel momento lui partì, viaggiò, abbandonò la sua colonia, perseguì la via del "faccio da solo e meglio mi sento".
Tutto questo a causa sua..a causa loro...!!

"Fra'? Dove hai messo il mio flauto di rape?"
"Uh..era ammuffito. L'ho buttato anni fa ormai."
"..che..CHE COSA HAI FATTO!?!?!"

Inaudito.
Ovvio e logico andarsene, no? Sono certo che voi tutti sarete daccordo con me! NON SI TOCCANO I FLAUTI DI RAPE ALTRUI! MUFFA O NON MUFFA!
Beh si, daccordo, forse lo aveva dimenticato per gli ultimi vent'anni, ma questo non cambiava le cose. Dannato fratello. E.....no, non se ne era andato solo per quello, cosa credete!?

"...Mamma...Fra' ha buttato il mio flauto di rape."
"Ah, deve essere ammuffito come l'ocarina di zucca che ho buttato l'altro ieri."
"...che...CHE COSA HAI FATTO!?!?!?!"

Ovvio che non bastava un flauto a mandarlo via. Ma due, dai è troppo! L'aveva terminata, quell'ocarina, appena tre anni prima. ERA NUOVA!
E così, imparata la lezione del "non si lascia nulla in casa altrui", perchè quella non era PIU' la sua casa, Zuppo prese ogni cosa di valore che aveva con se: dunque uno svariato elenco di strumenti da ortolano, a partire dal triangolo di selci alla trombetta di cavolfiore, e partì. Partì, lasciandosi dietro una città perfetta, con una vita perfetta, una famiglia perfetta, ed una stupida, sciocca, banale idea che questa perfezione sarebbe durata in eterno.
Ah. Ma non scordiamoci un dettaglio.

Partì. Attraversò la strada. Il ponte. Il fiume. Inciampò. Cadde nella pozza vicino al fiume. Si inzuppò. Si rialzò e ri-partì.
Perchè il nome se lo era guadagnato con molta sfigata fatica eh.

"Ma che bel bambino, signora Ouquie!"
"...oh...scusatemi, riposavo. Quale bambino?"
"Hemm..quello che tenete nella culla."
"Oh! Quel bambino! Oh si ve lo faccio vedere subit.." E con un braccio, la maldestra madre intruppò la culla, che era ovviamente posizionata di fianco alla finestra aperta, che vide ovviamente un infante venire catapultato fuori, e che, alfine, vide sempre ovviamente il medesimo infante finire a mollo nel fiume, per fortuna abbastanza profondo, che passava proprio adiacente le mura della piccola dimora.
Quando lo ripresero, era vivo. Zuppo, ma vivo.
E Zuppo rimase a vita.

I reumatismi sarebbero arrivati in vecchiaia.

Equip -
Pugnale comune - Prezzo: 9
Armatura di Cuio [1 PA] - Prezzo: 15
Borsa Comune - Prezzo: 10
Fionda - Prezzo(pagato da madre natura XD)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...