Navigation Line

Started by Hellfire Dragon, January 25, 2009, 12:52:34 pm

Previous topic - Next topic

Hellfire Dragon

I want a Navigation Line script, like th eone in dead space. For those who didn''t play dead space, basically, when a certain button is being held down a glowing blue line would appear and yo could follow it to your next objective. I want it so I can turn it on and off too.

I thought about this and it wold probably be hard, especially when the objective is on another map. Well I don't know, I'm not a scripter but if anyone thinks they could give this a try, could you please :shy:

Fantasist

I didn't understand the "line" part. If it's an arrow which points to the destination, then it's fine.
Yeah, pointing to something on a different map is a problem. Though, you can point to the teleport event in every map manually. If that's the case, I think I can pull this off.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Hellfire Dragon

Yeah that'd work fine, the line, well in dead space a blue line appears along the ground and if you follow it you get to the objective, the arrow is fine though and it's probably way easier.

G_G

This would be an awesome script. Good luck Fantasist hope you can pull it off!

This is also in a game called Legendary. You hold down a button and there's a line to your next objective.
\

Fantasist

January 26, 2009, 12:04:50 pm #4 Last Edit: January 27, 2009, 11:54:31 am by Fantasist
Okay. I'll give it a shot. It should take 20 mins max, but I need to be able to concentrate. I'll do it within 2 days.

EDIT:

I have the first draft. It's getting late, so I'll update the script header later (the instructions). Here's the demo:

http://www.sendspace.com/file/art9fo

Tell me if you need anything else.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




G_G

Its great! I think he wanted to only be activated if a certain button is being held down. But great Fantasist this is just pure awesomenes.

Hellfire Dragon

That's great! That you Fantasist ;) But like GG said, I wanted it to only appear when a button is being pressed. I'm using Blizz ABS so I wanted it something like, it appears/disappears when the player press 'P' Or something like that. Maybe if you can have it activating with like, whatever = true/false I could just make a common event for it.


Fantasist

Glad you like it :)
I forgot about the button being pressed. No need to make a common event, it's easy to implement. Also, if you checked out the events in the demo, you can turn it off by using:
$game_temp.point_towards(nil)


nvm, I'll update this tonight.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Reno-s--Joker

Wow, awesome script! :D
This might really come in handy - better than having to talk to NPCs... XD

Fantasist

January 30, 2009, 08:43:24 am #9 Last Edit: January 30, 2009, 08:44:29 am by Fantasist
Here you are HFD:
Spoiler: ShowHide

#==============================================================================
# ** Map Target Pointer
#------------------------------------------------------------------------------
# by Fantasist
# Version: 1.0
# Date: 30-Jan-2009
#------------------------------------------------------------------------------
# Version History:
#
#   1.0 - First version
#------------------------------------------------------------------------------
# Description:
#
#     This script adds a pointer which points to a desired event on the map.
#------------------------------------------------------------------------------
# Compatibility:
#
#     Should be compatible with almost everything.
#------------------------------------------------------------------------------
# Instructions:
#
#     Place this script in a new slot below Scene_Debug and above main.
#   If you're using any input modules and the key you set is from that script,
#   plave this below that input script.
#
#   Use the following call script to set a target event:
#
#         $game_temp.point_towards(EVENT_ID)
#
#   where EVENT_ID is the ID of the event to which the pointer should point.
#
#   To remove the target, use:
#
#         $game_temp.point_towards
#                   or
#         $game_temp.point_towards(nil)
#------------------------------------------------------------------------------
# Configuration:
#
#     Scroll down a bit for configuration.
#
#  MTP_Pic: Name of the picture file in the "Graphics/Pictures" folder.
#           The pointer should point upwards.
#  MTP_Position: Position of the pointer.
#                 - If it is fixed, use an array of X and Y values
#                   (like this: [X, Y]) if the pointer is static.
#                 - Use nil for placing the pointer above the player.
#  MTP_Key: The key which should be pressed for the pointer to appear.#
#------------------------------------------------------------------------------
# Issues:
#
#     None that I know of.
#------------------------------------------------------------------------------
# Credits and Thanks:
#
#    - Fantasist for making this.
#    - Hellfire Dragon for requesting this.
#------------------------------------------------------------------------------
# Notes:
#
#   If you have any problems, suggestions or comments, you can find me at:
#
# - www.chaos-project.com
# - www.quantumcore.forumotion.com
#
#   Enjoy ^_^
#==============================================================================

#==============================================================================
# ** FTSConfig
#==============================================================================
module FTSConfig
 
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # CONFIG BEGIN
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
  MTP_Pic = 'Target_Pointer'
  MTP_Position = nil #[320, 240]
  MTP_Key = Input::A
 
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # CONFIG END
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
end
#==============================================================================
# ** Game_Temp
#==============================================================================
class Game_Temp
 
  attr_reader :point_target
 
  alias mtp_game_temp_init initialize
  def initialize
    mtp_game_temp_init
    @point_target = nil
  end
 
  def point_towards(val=nil)
    @point_target = val
    $scene.set_target(val) if $scene.is_a?(Scene_Map)
  end
 
end
#==============================================================================
# ** Spriteset_Map
#==============================================================================
class Spriteset_Map
 
  attr_reader :character_sprites
  attr_reader :pointer
 
  alias mtp_spriteset_map_init initialize
  def initialize
    mtp_spriteset_map_init
    @pointer = Pointer.new(self)
    @pointer.z = 5100
  end
 
  alias mtp_spriteset_map_upd update
  def update
    mtp_spriteset_map_upd
    @pointer.update if @pointer != nil
  end
 
  alias mtp_spriteset_map_disp dispose
  def dispose
    mtp_spriteset_map_disp
    @pointer.dispose
  end
 
end
#==============================================================================
# ** Pointer
#==============================================================================
class Pointer < Sprite
 
  attr_reader :target
  attr_accessor :spriteset
 
  def initialize(spriteset)
    super()
    self.visible = false
    self.spriteset = spriteset
    self.target = $game_temp.point_target
    self.bitmap = RPG::Cache.picture(FTSConfig::MTP_Pic)
    if FTSConfig::MTP_Position
      self.x, self.y = FTSConfig::MTP_Position[0], FTSConfig::MTP_Position[1]
    end
  end
 
  def update
    super
    self.visible = @target && Input.press?(FTSConfig::MTP_Key)
    return unless Input.press?(FTSConfig::MTP_Key)
    update_pointing if @target
  end
 
  def update_pointing
    y = ($game_player.screen_y - @target.screen_y).to_f
    x = (@target.screen_x - $game_player.screen_x).to_f
    rad = Math.atan2(y, x) - Math::PI/2
    self.angle = rad * 180 / Math::PI
    unless FTSConfig::MTP_Position
      self.x = $game_player.screen_x
      self.y = $game_player.screen_y - 64
    end
  end
 
  def get_sprite_char(event_id)
    return nil unless $scene.is_a?(Scene_Map)
    self.spriteset.character_sprites.each {|spr_char|
    return spr_char if spr_char.character.id == event_id}
    return nil
  end
 
  def target=(event_id)
    @target = nil if event_id == nil || event_id < 0
    @target = get_sprite_char(event_id)
    @target = @target.character unless @target == nil
    update_pointing if @target
    self.visible = false
  end
 
  def bitmap=(val)
    super(val)
    return if val == nil
    self.ox, self.oy = self.bitmap.width/2, self.bitmap.height/2
  end
 
end
#==============================================================================
# ** Scene_Map
#==============================================================================
class Scene_Map
 
  attr_reader :spriteset
 
  def set_target(event_id)
    @spriteset.pointer.target = event_id
  end
 
end


Here's the picture:


EDIT: Oh, and thank you guys :D
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Shadonking

this could be really cool with a few other options. e.g. for the pointer to point at coodinates using variables.

also i seem to be having trouble getting the the pointer to work when pressing a key, if you leave it as A it started up but i use that to walk but if you change it to any other key it comes up with errors.





Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0

Hellfire Dragon

January 30, 2009, 10:39:47 am #11 Last Edit: January 30, 2009, 10:44:53 am by Hellfire Dragon
Actually it does work with other keys, but only the ones built into rmxp, so for Q you'd set it to L. Awesome work Fantasist :) So other than than only being able to use the rmxp keys, this script is great ;)

shdwlink1993

To use other keys (provided you're using Ton's Input), you use this (I think :)):

Input::Key['A']
Stuff I've made:




"Never think you're perfect or else you'll stop improving yourself."

"Some people say the glass is half full... some half empty... I just wanna know who's been drinking my beer."

Shadonking

i see if L uses the Q key what do you put in to use P.






Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0

Hellfire Dragon

The rmxp keys don't cover the whole keyboard :( They only cover, the arrow keys,Z, X, C, Q, W, A, S, and D.

@shdw I don't know if that would work, I only tried using that with the blizz-abs. I'll check though

Shadonking

thats a shame, but at least there is one key there that im not using which is Z but i dont now what to put in for that key to use.





Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0

Fantasist

January 30, 2009, 01:24:21 pm #16 Last Edit: January 30, 2009, 01:25:27 pm by Fantasist
Woah, wait a second guys, it'll work with any input module.

Quote# Instructions:
#
#     Place this script in a new slot below Scene_Debug and above main.
#   If you're using any input modules and the key you set is from that script,
#   place this below that input script.


Basically, if you're using Tons or Blizz-ABS, both of them have the same input module, so what shdwlink said would work:

Quote from: shdwlink1993 on January 30, 2009, 11:13:21 am
To use other keys (provided you're using Ton's Input), you use this (I think :)):

Input::Key['A']



So for p, it's:
Input::Key['P']


If you're still getting errors, here is the workaround:

In the config, comment out the MTP_Key option:
Quote
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # CONFIG BEGIN
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
  MTP_Pic = 'Target_Pointer'
  MTP_Position = nil #[320, 240]
  MTP_Key = Input::A # <<<<< Comment this out!!
 
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # CONFIG END
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Then paste the following snipped BELOW any input modules you're using. So this snippet goes below Tons and/or Blizz-ABS:


#==============================================================================
# ** FTSConfig (MTP key workaround)
#==============================================================================
module FTSConfig
 
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # CONFIG BEGIN
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  MTP_Key = Input::A
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # CONFIG END
  #::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 
end


Glad you guys like it :)

@Shadonking: That's an interesting feature, pointing to coordinates. I'll remember that ;)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Shadonking

January 30, 2009, 01:41:09 pm #17 Last Edit: January 30, 2009, 01:51:02 pm by Shadonking
ok im not using tons input and im using blizz abs controlles and i have place the script under both of them but certian keys keep coming up with errors, i even just tried that little snippit thing you just posted but the same error came up when tring to use P.

also what would be cool would to have an option to turn it on and off with a swith then people could use this script as an item or skill.





Creator Of Music And Games
Spoiler: ShowHide
]

keywords: ShowHide
rmxp rmvx blizz-abs rpg maker xp vx abs cbs cms script tons of addons charsets autotiles HUD


come here if you have a ps3
http://forum.chaos-project.com/index.php?topic=1952.0

Hellfire Dragon

I was just going by the Where to put Blizzards scripts thing, it says to put other people's script above the abs. Anyway I'll try what you said out ;)

Aqua

Nice script Fanta! :D

I'll definitely use it in my game (unless like... I don't find a need for it... but who wouldn't need this!?! :P)