Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 


———
Before you ask! Read! ;)

You must have 30+ Posts to create a topic here!

Thanks for reading!
———

 
Reply to this topicStart new topic
> Create Map event manually, Create Map event manually and change its meaning
cometstar
post Dec 14 2011, 03:06 PM
Post #1


Level 5
Group Icon

Group: Member
Posts: 60
Type: None
RM Skill: Undisclosed




I want a script to call it to create an even t manually ,which is copied from another mapevent with its command events and give it new graphic or change its ghraphic manually, too
Is this possible ?
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Dec 15 2011, 12:41 PM
Post #2


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




QUOTE (cometstar @ Dec 15 2011, 12:06 AM) *
I want a script to call it to create an even t manually ,which is copied from another mapevent with its command events and give it new graphic or change its ghraphic manually, too
Is this possible ?


Hello Cometstar,
I think it's possible, try this script...

CODE
class Game_Event
  attr_accessor :character_name
  attr_accessor :character_hue
end

class Spriteset_Map
  def add_event(id)
    sprite = Sprite_Character.new(@viewport1, $game_map.events[id])
    @character_sprites.push(sprite)
  end
end

class Scene_Map
  attr_reader :spriteset
end

class Game_Map
  def copy_event(id,x,y,char_name=nil,char_hue=nil)
    if $game_map.events[id] == nil
      return -1
    end
    event = $game_map.events[id].clone
    event.moveto(x,y)
    if char_name != nil
    event.character_name = char_name
    end
    if char_hue != nil
    event.character_hue  = char_hue
    end
    index = $game_map.events.keys.size
    $game_map.events[index+1] = event
    if $scene.is_a?(Scene_Map)
      $scene.spriteset.add_event(index+1)
    end
    return true
  end
end


Call it from script writing
CODE
$game_map.copy_event(id,x,y,char_name,char_hue)

where:
-id is the id of the event you want to copy;
-x and y are the new coordinates;
-char_name and char_hue are what their name say and can be left blank.

For example,

$game_map.copy_event(1,5,7)

creates a copy of Event #1 and places it into coordinates (5,7).

I've not made a complete debug yet, please report any bugs...

N.B. It works ONLY in Scene_Map and in this state doesn't save the new event. If you exit the game and resume it again, the new event will disappear...

####
EDIT: actually, you can use this script anywhere, but once you leave the map, events will be reset...
It seems working quite well, although...
Please, let me know if it works...
###

Jens

This post has been edited by Jens of Zanicuud: Dec 19 2011, 09:25 AM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
cometstar
post Dec 18 2011, 01:40 PM
Post #3


Level 5
Group Icon

Group: Member
Posts: 60
Type: None
RM Skill: Undisclosed




Thank you for this replay
it is very good, and it's exactly what I want, but I need also to change graphic of the event and specify a new graphic
I'll try it later....
Thank you
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Dec 19 2011, 09:24 AM
Post #4


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




QUOTE (cometstar @ Dec 18 2011, 10:40 PM) *
Thank you for this replay
it is very good, and it's exactly what I want, but I need also to change graphic of the event and specify a new graphic
I'll try it later....
Thank you


Actually the script allows you to change graphics...
Just set the new character name and character hue in the arguments...
Maybe I wrote it in wrong words...
I meant this...

CODE
$game_map.copy_event(id,x,y,new_char_name,new_char_hue)


Jens

This post has been edited by Jens of Zanicuud: Dec 19 2011, 09:26 AM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
cometstar
post Dec 27 2011, 01:01 PM
Post #5


Level 5
Group Icon

Group: Member
Posts: 60
Type: None
RM Skill: Undisclosed




Thank you much.....
Your job is perfect, and it's exactly what I need for my project.
thanks for this briliant site in RPG Maker's world
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 20th May 2013 - 12:21 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker