xD Need a script ;)

Go down

xD Need a script ;)

Post by yami on Mon Apr 19, 2010 11:59 am

Suspect Well I need a little script
So I can check if on the tile the player or another event is standing on,
has a event on it with a certain name* and get it's id.
If so, I need a script call to erase events by script i.d . (this may be used seperately)
Hope it's enough

*so if the event's name is Bob, I state in the script call, to check if it was Bob, I would get the script ID in a variable , else it would return 0


Last edited by yami on Mon Apr 19, 2010 1:20 pm; edited 2 times in total
avatar
yami
Apprentice
Apprentice

Posts : 127
Gald : 425

Stats
Cookies: 0

View user profile

Back to top Go down

Re: xD Need a script ;)

Post by Dezz123 on Mon Apr 19, 2010 12:12 pm

I think you need a little bit more info. in that... Like straighten it up a bit, make it easier to understand... Do you mean if someone stands on a tile (your character) it automatically gives the ID of the tile? :huh:
avatar
Dezz123
Legendary
Legendary

Posts : 1534
Gald : 6469

Stats
Cookies: 0

View user profile http://www.dezzgames.webs.com, www.evalon.webs.com

Back to top Go down

Re: xD Need a script ;)

Post by yami on Mon Apr 19, 2010 1:11 pm

I changed it Wink
It is to see if an event is on that tile
avatar
yami
Apprentice
Apprentice

Posts : 127
Gald : 425

Stats
Cookies: 0

View user profile

Back to top Go down

Re: xD Need a script ;)

Post by Dezz123 on Mon Apr 19, 2010 1:15 pm

Haha that's better... I think Omega is up for making a script actually Wink
Try asking him... *hint hint* Razz
:cheers: :bball: :bom: :drunken: :bounce:
That'll do...
avatar
Dezz123
Legendary
Legendary

Posts : 1534
Gald : 6469

Stats
Cookies: 0

View user profile http://www.dezzgames.webs.com, www.evalon.webs.com

Back to top Go down

Re: xD Need a script ;)

Post by omegas7 on Mon Apr 19, 2010 5:04 pm

Here you have, Yami:
Instructions in the script. Basically, it will let you check if the player is over another event with X specific name (case sensitive).
If true, the ID of the event found will be stored in a variable of your choice.
You can also erase an event ID through the value of a variable, look at the script. Smile

Code:
# =============================================================================
# Omegas7
# =============================================================================
# Checks if the player is OVER another event with a specific name.
# If that is true, the ID number of the event will be stored in a variable.
# =============================================================================
# Instructions:
# In a conditional branch, go to the script section, and write:
# $game_player.player_over_special_event?(name,variable)
# name is the 'name' (inside quotes) you are searching for.
# variable is the ID number of the game variable you want the event's ID to be
# stored.
# If that is true, the variable you chose will hold the ID number of the event
# found, and you'll be able to do whatever you want with such variable.
# =============================================================================
# In addition, you can use the number stored in the variable to erase an event,
# just use an event script call:
# $game_map.erase_event_id_from_variable(ID)
# ID is the ID number of the variable.
# =============================================================================

class Game_Event < Game_Character
  attr_reader :event
end

class Game_Map
  def player_over_special_event?(name,variable)
    for i in 1..@events.size
      if ($game_player.x == @events[i].x) && ($game_player.y == @events[i].y)
        if @events[i].event.name == name
          $game_variables[variable] = @events[i].id
          return true
        end
      end
    end
    return false
  end
  def erase_event_id_from_variable(variable)
    $game_map.events[$game_variables[variable]].erase
  end
end
avatar
omegas7
Admin
Admin

Posts : 1180
Gald : 4121

Stats
Cookies: 0

View user profile http://www.omegadev.biz

Back to top Go down

Re: xD Need a script ;)

Post by yami on Tue Apr 20, 2010 10:34 am

Omegas7 wrote:Here you have, Yami:
Instructions in the script. Basically, it will let you check if the player is over another event with X specific name (case sensitive).
If true, the ID of the event found will be stored in a variable of your choice.
You can also erase an event ID through the value of a variable, look at the script. Smile

Code:
# =============================================================================
# Omegas7
# =============================================================================
# Checks if the player is OVER another event with a specific name.
# If that is true, the ID number of the event will be stored in a variable.
# =============================================================================
# Instructions:
# In a conditional branch, go to the script section, and write:
# $game_player.player_over_special_event?(name,variable)
# name is the 'name' (inside quotes) you are searching for.
# variable is the ID number of the game variable you want the event's ID to be
# stored.
# If that is true, the variable you chose will hold the ID number of the event
# found, and you'll be able to do whatever you want with such variable.
# =============================================================================
# In addition, you can use the number stored in the variable to erase an event,
# just use an event script call:
# $game_map.erase_event_id_from_variable(ID)
# ID is the ID number of the variable.
# =============================================================================

class Game_Event < Game_Character
  attr_reader :event
end

class Game_Map
  def player_over_special_event?(name,variable)
    for i in 1..@events.size
      if ($game_player.x == @events[i].x) && ($game_player.y == @events[i].y)
        if @events[i].event.name == name
          $game_variables[variable] = @events[i].id
          return true
        end
      end
    end
    return false
  end
  def erase_event_id_from_variable(variable)
    $game_map.events[$game_variables[variable]].erase
  end
end
OMG
THANK YOU
Here, hab cookiez, hug and SWEETS NAO!
avatar
yami
Apprentice
Apprentice

Posts : 127
Gald : 425

Stats
Cookies: 0

View user profile

Back to top Go down

Re: xD Need a script ;)

Post by Dezz123 on Tue Apr 20, 2010 12:00 pm

Haha, Yami's happy... Guess that means that this is DONE. It can now be..... Closed. Wink
avatar
Dezz123
Legendary
Legendary

Posts : 1534
Gald : 6469

Stats
Cookies: 0

View user profile http://www.dezzgames.webs.com, www.evalon.webs.com

Back to top Go down

Re: xD Need a script ;)

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum