Author Topic: Touch Damage From Player In Blizz-ABS  (Read 1519 times)

Offline MEANDONLYME

  • Total Beginner
  • Posts: 8
  • LV: 0
    • View Profile
Touch Damage From Player In Blizz-ABS
« on: April 11, 2017, 08:44:20 AM »
So I'm trying to create a state in Blizz-ABS in which the enemy takes damage if the players touches him.
Now, this can be done with custom event triggers on one enemy, but it will be a nightmare to copy the same trigger to every enemy in the game.
I'm thinking the problem could be solved in two ways: a script that applies some event's custom event trigger to all events (enemies), or a script like Touch Damage only the opposite (since here we need the enemy to take damage from touching the player).
I'm very tempted to ask for the first option- just because it opens so many possibilities, but choose what you like as long as you help.   :naughty:

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2957
  • LV: 369
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: Touch Damage From Player In Blizz-ABS
« Reply #1 on: April 12, 2017, 07:24:08 AM »
Here's to adding global triggers:
(click to show/hide)

Regarding touch damage to enemies, you might run into issues with that as discussed in this topic:
http://forum.chaos-project.com/index.php/topic,15717.msg195587.html#msg195587



(click to show/hide)
NNID: KK20-CP

Offline MEANDONLYME

  • Total Beginner
  • Posts: 8
  • LV: 0
    • View Profile
Re: Touch Damage From Player In Blizz-ABS
« Reply #2 on: April 12, 2017, 04:58:01 PM »
Thank you very much, you seem to be helping a lot of people here.
I couldn't get the global trigger to work for some time, until I realized the common event only controls the trigger, and you can't add commands in the case of a trigger.
The script does help cover touch damage (In my game I'm fine with the skill not killing the enemy which solves the problem in the thread you linked).
But is there a possibility to define specific commands for different triggers in the common event? Is it even possible to make more than one trigger on blizz?
« Last Edit: April 12, 2017, 05:00:07 PM by MEANDONLYME »

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2957
  • LV: 369
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: Touch Damage From Player In Blizz-ABS
« Reply #3 on: April 12, 2017, 10:54:00 PM »
You can always add more than one trigger; just make a new Comment directly below another Trigger.
Code: [Select]
@>Comment: Trigger:Weapon=1
@>Comment: Trigger:ActionButton
I can see the need to add custom event commands to the global triggers, but that will require some extra tweaking to my script. I'll see if it's even possible firstly. Might be as simple as copying the common event command list and somehow shoving them into the map event's list.

You might also be interested in this script I made too.
http://forum.chaos-project.com/index.php/topic,12230.0.html



(click to show/hide)
NNID: KK20-CP

Offline MEANDONLYME

  • Total Beginner
  • Posts: 8
  • LV: 0
    • View Profile
Re: Touch Damage From Player In Blizz-ABS
« Reply #4 on: April 13, 2017, 05:26:48 AM »
Yeah, I knew you could add different triggers, the problem was I couldn't check which trigger was activated-  and the script you linked solved this.
Let me know if you manage to make custom commands in the common event.  :naughty:

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2957
  • LV: 369
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: Touch Damage From Player In Blizz-ABS
« Reply #5 on: April 20, 2017, 10:12:17 AM »
Give that a shot
Code: [Select]
=begin
--------------------------------------------------------------------------------
Global Custom Event Triggers                                        Ver 1.1
by KK20                                                             Apr 20 2017
--------------------------------------------------------------------------------

[ Purpose ]

Allows the creation of Global Triggers, making enemies with the same custom
triggers easier to create.

[ Instructions ]

Place this script below all of Blizz-ABS. (and above Main obviously)
Scroll down this script and find COMMON_EVENT_ID. The number assigned to it
indicates what Common Event ID you want to use as the default global triggers.
Change its value to whatever suits your project's needs.

In your Database, create a Common Event. Add as many triggers as you like to it,
much in the same fashion as if you were adding triggers to an enemy event. Refer
to the Blizz-ABS manual for further instructions on how to set this up.

*** New in Version 1.1 ***
If you have a common execution of command events for this trigger, you may also
add them to the common event. They will be automatically added to the event's
command list in-game.

A new custom trigger can be defined for enemy events:
   
                           Trigger:Global=X

where X represents the Common Event ID in your database.
You can create multiple Global Triggers this way--just use another Common Event.
Have triggers that should only apply to boss monsters? This command will help.

**NOTE**
If you use this trigger, IT MUST BE AT THE VERY TOP OF THE COMMAND LIST.
As a result, YOU CANNOT USE THIS TRIGGER MORE THAN ONCE PER EVENT.

Enemy events that do not use this new trigger will use the default triggers
defined in your Common Event as specified by COMMON_EVENT_ID.

If you set Global=0, then your event will NOT use any global triggers.

You can still add more triggers to enemy events after the Trigger:Global.

--------------------------------------------------------------------------------
=end
module BlizzABS
 
 
  # The common event that holds the global Custom Event Trigger for enemies if
  # no Trigger:Global=X is defined in the enemy's event command list.
  COMMON_EVENT_ID = 1
 
 
  class Utility
    alias get_common_triggers get_triggers
    def get_triggers(list)
      ce_list = nil
      cloned_list = list.clone
      triggers = [-1, {}]
      # If the first event command is a comment
      if list[0].code == 108
        comment = list[0].parameters[0]
        ce_id = comment.scan(/Trigger:Global=(\d+)/).flatten[0]
        # If a Global trigger was defined, use it
        if ce_id
          ce_id = ce_id.to_i
          # No global trigger if ID is 0
          unless ce_id == 0
            ce_list = $data_common_events[ce_id].list
            triggers = get_common_triggers(ce_list)
          end
          # Remove this comment from being interpreted by the alias
          cloned_list = list[1, list.size - 1]
        else # Use the default
          ce_list = $data_common_events[COMMON_EVENT_ID].list
          triggers = get_common_triggers(ce_list)
        end
      else # Use the default
        ce_list = $data_common_events[COMMON_EVENT_ID].list
        triggers = get_common_triggers(ce_list)
      end
      # Call the alias
      triggers2 = get_common_triggers(cloned_list)
      # Combine two results to get resulting triggers
      result = []
      special = {}
      result.push(triggers[0] == BlizzABS::CETNone ? triggers2[0] : triggers[0])
      (triggers[1].keys + triggers2[1].keys).each { |key|
        special[key] = (triggers[1][key] || []) + (triggers2[1][key] || [])
      }
      result.push(special)
      # Now add the global event commands to the event itself
      list.unshift(*ce_list) if ce_list
      # Return the triggers
      result
    end
  end
end



(click to show/hide)
NNID: KK20-CP

Offline MEANDONLYME

  • Total Beginner
  • Posts: 8
  • LV: 0
    • View Profile
Re: Touch Damage From Player In Blizz-ABS
« Reply #6 on: April 21, 2017, 04:46:21 AM »
Well, it does work until I try to check with what specific trigger was activated. Here's the demo:
http://www.mediafire.com/file/o0ycjck0d0sdldk/Project3.exe
The bugs I found are:
When you add a trigger for a specific item, the trigger applies to all items.
When you check what item was used it gives you the wrong item.
« Last Edit: April 21, 2017, 04:52:28 AM by MEANDONLYME »

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2957
  • LV: 369
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: Touch Damage From Player In Blizz-ABS
« Reply #7 on: April 21, 2017, 05:07:15 AM »
Yeah, I found that out before I saw your edit. It also applied to skills. Must've been a rushed copy-pasta mistake.

Problem were the lines that looked like this
Code: [Select]
@event_trigger = [BlizzABS::CETSkill, id]In this case, the 'id' being used was the event ID, not the item/skill ID being used :P

Try this:
(click to show/hide)



(click to show/hide)
NNID: KK20-CP

Offline MEANDONLYME

  • Total Beginner
  • Posts: 8
  • LV: 0
    • View Profile
Re: Touch Damage From Player In Blizz-ABS
« Reply #8 on: April 21, 2017, 06:59:55 PM »
Oh, it works perfectly!
You know, i'm using a bunch of your scripts from the script requests forum and I feel kind of bad that most people probably won't see them. I'm talking about this script and a reflection system for blizz that you made.
Can I make a demo and publish it here (or send it and you'll publish)?
EDIT: On a second thought, I'm not sure I currently have the time for creating a demo, but I will let you know if that will change.
« Last Edit: April 22, 2017, 03:09:22 AM by MEANDONLYME »

Offline KK20

  • Master Scripter Fixer
  • Global Moderator
  • Lexima Warrior
  • ****
  • Posts: 2957
  • LV: 369
  • Gender: Male
  • Bringer of Salt
    • View Profile
Re: Touch Damage From Player In Blizz-ABS
« Reply #9 on: April 22, 2017, 03:46:50 AM »
I'll add the Global Triggers to the database and will need to update the first post for the trigger condition checking. I'm not too proud of the reflecting one as that was made more as a proof-of-concept; it's too experimental to be considered an official script.

But sure, go ahead and make the demo if you'd like :)



(click to show/hide)
NNID: KK20-CP