User Tools

Site Tools


grid:targeting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
grid:targeting [2019/12/29 10:58] theoallengrid:targeting [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 66: Line 66:
      
 The method name is a method you put inside the ''Grid::Area'' module. The name of the method must be the same as the one you put as the tag. To create the method, you could create an empty script slot (the script slot must be below my script). And write it like this The method name is a method you put inside the ''Grid::Area'' module. The name of the method must be the same as the one you put as the tag. To create the method, you could create an empty script slot (the script slot must be below my script). And write it like this
-  class << Grid::Area +<code ruby> 
-    def method_name(user) +class << Grid::Area 
-      # Write the code here +  def method_name(user) 
-    end+    # Write the code here
   end   end
 +end
 +</code>
  
-The method accepts one parameter which is the user itself. For example, we're going to use the mininuke skill range. The method goes like this +The method accepts one parameter which is the user itself. For example, we're going to use the mini-nuke skill range. The method goes like this 
-  def dy_nuclearbomb_target(user) +<code ruby> 
-    return Grid.linear(Grid.neighbor(user.grid_pos, 4, 4), [4], 9) +def dy_nuclearbomb_target(user) 
-  end+  return Grid.linear(Grid.neighbor(user.grid_pos, 4, 4), [4], 9) 
 +end 
 +</code>
  
 The code ''user.grid_pos'' returns the position of the user. If the current position is in index ''14'' it will return the same value. Use this to dynamically set the target range. There is nothing that is stopping you if you want to create a strange targetable grid, like this... The code ''user.grid_pos'' returns the position of the user. If the current position is in index ''14'' it will return the same value. Use this to dynamically set the target range. There is nothing that is stopping you if you want to create a strange targetable grid, like this...
Line 95: Line 99:
 __It does NOT matter whether it is one enemy, all enemies, random enemies__, it basically tells the system that the skill/item is targeting the enemy. Because of this, any repeated attack or random attack to the enemies, you have to do it manually through the skill action sequence.  __It does NOT matter whether it is one enemy, all enemies, random enemies__, it basically tells the system that the skill/item is targeting the enemy. Because of this, any repeated attack or random attack to the enemies, you have to do it manually through the skill action sequence. 
  
-The same thing applies to ally selection. If you select the options provided that basically target the ally, it tells the system that the skill is targeting the ally. If you want a skill to target self, you have to do it through the targetable grid and do it this way. +The same thing applies to ally selection. If you select the options provided that basically target the ally, it tells the system that the skill is targeting the ally. If you want a skill to target self, you have to do it through the targetable grid and do it this way (or look at [[grid:targeting#self-trigger_skill|self trigger skill]] section)
-  class << Grid::Area +<code ruby> 
-    def self_target(user) +class << Grid::Area 
-      return [user.grid_pos] +  def self_target(user) 
-    end+    return [user.grid_pos]
   end   end
 +end
 +</code>
      
 Last, when you select the target scope equals none, it tells the system that the skill effect may fall for both allies and enemies alike. In essence, when the area effect is done through the target grid, if you select either of the target scope options, some battlers may not get affected even when they're within the area of effect. Last, when you select the target scope equals none, it tells the system that the skill effect may fall for both allies and enemies alike. In essence, when the area effect is done through the target grid, if you select either of the target scope options, some battlers may not get affected even when they're within the area of effect.
  
 === Target battler & Target null === === Target battler & Target null ===
-By default, all of the skill requires the selected grid to have a target on the targeted grid. This means, if the grid is null, the skill can not be launched. The target battler depends on the target scope you put. If you put the target as the enemy, you can not select the ally even if the ally is in the target range. This behavior can be changed by adding a hack using note tag ''<null target>''. This tag allows the user to launch attack on the empty grid.+By default, all of the skill requires the selected grid to have a target on the targeted grid. This means, if the grid is null, the skill can not be launched. The target battler depends on the target scope you put. If you put the target as the enemy, you can not select the ally even if the ally is in the target range. This behavior can be changed by adding a hack using note tag ''<null target>''. This tag allows the user to launch an attack on the empty grid
 + 
 +===== Determine the target grid ===== 
 +As has been said, the target grid by default is equal to the center grid. And thus, you have to manually change them through [[https://github.com/theoallen/TSBS/wiki/How-action-sequence-works|Action Sequence]] for every skill sequence if you want an area of effect. To change the area of effect, use this command within the action sequence. 
 +<code ruby> 
 +  [:grid_setup,
 +    :method => value, 
 +    :type => value, 
 +    :scope => value, 
 +    :null => value, 
 +  }] 
 +</code> 
 +The command tells the system to change the current grid setup. It accepts four parameters in Ruby [[https://ruby-doc.org/core-1.9.2/Hash.html|Hash]] format. However, you do not need to input all of them when you don't want to. It will simply use the default value. 
 + 
 +==== Method parameter ==== 
 +Usage: 
 +<code ruby> 
 +  :method => :method_name, 
 +  :method => lambda {|a,b,c| puts "code here" }, 
 +</code> 
 +Behavior if omitted: The target grid will simply not change 
 + 
 +Using '':method => :method_name'' will look for a method within the ''Grid::Area'' module. i.e, if you put it like '':method => :change_grid'' it will look something that is defined as 
 +<code ruby> 
 +  class << Grid::Area 
 +    def change_grid(a,b,c) 
 +      # Code here 
 +    end 
 +  end 
 +</code> 
 + 
 +Using '':method => lambda object'' means you're using [[https://ruby-doc.org/core-2.6.3/Proc.html|Ruby Lambda object]]. Lambda object is an anonymous method/function that returns something. So, you don't need to create a new method every time within the ''Grid::Area'' module. when you don't want to. To write a lambda object, you do it like this 
 +<code ruby> 
 +  :method => lambda do |a,b,c| 
 +    # Code here 
 +  end 
 +</code> 
 + 
 +Both of method name reference a lambda object accepts 3 parameters which are 
 +  * a = User of the skill 
 +  * b = Any battler in the center grid, if there is no battler, it will be redirected to a [[grid:target_null|target null]] 
 +  * c = Center grid 
 + 
 +Our mini-nuke explosion uses the lambda object to determine the target grid. It goes something like this on a moment before the projectile hits the target. 
 +<code ruby> 
 +  :method => lambda do |a,b,c| 
 +    return Grid.surrounding(c) | Grid.linear(c, [2,4,6,8], 2) 
 +  end, 
 +</code> 
 +**On a side note:** The operand ''|'' is merging two arrays and remove the duplicated, i.e, when you have an array ''[1,2,3,4]'' and ''[3,4,5,6]'' it will be ''[1,2,3,4]'' instead of ''[1,2,3,4,3,4,5,6]'' 
 +==== Type parameter ==== 
 +Usage: 
 +<code ruby> 
 +  :type => :set, 
 +  :type => :add, 
 +  :type => :sub, 
 +</code> 
 +Behavior if omitted: Use '':set'' as the default value 
 + 
 +You have an option to select one of those three modes. Let's assume you have target grid array as ''[1,2,3,4]'' and the next target grid array is ''[3,4,5,6]'' 
 +  * :set = target grid is replaced. It's now ''[3,4,5,6]'' 
 +  * :add = target grid is merged. It's now ''[1,2,3,4,5,6]'' 
 +  * :sub = target grid is substracted. It's now ''[1,2]'' 
 +==== Scope parameter ==== 
 +Usage: 
 +<code ruby> 
 +  :scope => :allies, 
 +  :scope => :enemies, 
 +  :scope => :collateral, 
 +</code> 
 +Behavior if omitted: No change on the scope 
 + 
 +Change the current scope as explained in the target scope option in determining the targetable grid section. 
 +==== Null parameter ==== 
 +Usage: 
 +<code ruby> 
 +  :null => true, 
 +  :null => false, 
 +</code> 
 +Behavior if omitted: Use the default value as true 
 + 
 +This option is an option for you to allow a skill animation to play on the empty grid using the default ''[:show_anim]'' from the base TSBS script. 
 + 
 +===== Self-Trigger skill ===== 
 +The self-trigger skill is a skill that does not require a selection through a targetable grid. The targetable grid is used as an Area of Effect indicator on where the skill may fall into. As has been said, the targetable grid only has its own role during the selection phase. It does not do anything during the action phase that you have to determine the target grid manually using ''[:grid_setup]''
 + 
 +To determine if the skill is a self-trigger type, put this tag in the skill note box. 
 +  <self trigger> 
 +   
 +When you're using the skill, it will look like this 
 + 
 +{{https://i.imgur.com/t4Oqjqq.jpg}} 
 + 
 +Noticed that the cursor stays at the user position. You can not change the position of the cursor when you put this tag. You can only confirm or cancel the skill activation. During the action phase, the initial center grid will also be the same as user position. What you're going to decide with this mechanism is entirely up to you.
grid/targeting.1577591899.txt.gz · Last modified: 2019/12/29 10:58 (external edit)