Monster/NPC magic attacks (SOLVED 8-10-2017)

I haven't seen mention of monsters made with CombatLib3.0 making magic attacks against the player. When you attack a monster their return is always physical.
Are the clone monster of CombatLib 2.0 still useable in 3.0? These have magic users and are good for basic random volley but I'd like to add magic use to NPC's
It's not like you can add a fire spell to the monster/NPC as an object and have them use it instead of a physical attack. (Or can you?) I just change the (attackplayer) attribute of the monster and in the line where It is swinging and hitting you is replaced with some motion made by the monster and a glowing ball shooting at player. Just that part of the line. And the attack continues with damage yada yada.
Perhaps someone has a moment to show it in the combat creation of a monster if it is possible.

I noticed with Non-weapon attack (Does not include "you swing") box checked that I was still get a "You swing" in the game. Maybe I've tweaked when I should have Twalked in my game somewhere.


I've not looked at Pixie's combat library, but a simple method of doing AI behavior:

use the 'GetRandomInt (MIN_VALUE, MAX_VALUE)' Function

for poor/bad and incomplete design example:

(just for conception, but you can create a better design/system, which this is obviously not a good one)

<delegate name="combat_turn_delegate" parameters="enemy_list_parameter, team_list_parameter, spell_list_parameter, action_list_parameter"/>

<object name="battlemage_team_member">
  <attr name="action_list_attribute" type="simplestringlist">attack; defend; cast; item; escape</attr>
  <attr name="spell_list_attribute" type="simplestringlist">fireball; blizzard; meteor; tornado; quake</attr>
  <attr name="combat_turn" type="combat_turn_delegate">
    random_action_string_variable = StringListItem (battlemage_team_member.action_list_attribute, GetRandomInt (0, ListCount (action_list_parameter) - 1))
    switch (random_action_string_variable) {
      case ("attack") {
        // blah scripting
      }
      case ("defend") {
        // blah scripting
      }
      case ("cast") {
        random_spell_string_variable = StringListItem (battlemage_team_member.spell_list_attribute, GetRandomInt (0, ListCount (spell_list_parameter) - 1))
        // blah scripting, an example:
        // random_spell_object_variable = GetObject (random_spell_string_variable)
        // do (random_spell_object_variable, "cast")
      }
      case ("item") {
        // blah scripting
      }
      case ("escape") {
        // blah scripting
      }
    }
  </attr>
</object>

<object name="fireball">
  <attr name="cast" type="script">
    // blah scripting
  </attr>
</object>

hegemonkhan,
It is interesting that after several years of using Quest and creating so many makeshift scripts that a novice like myself can actually understand this and know how it all works. I'm at that point now where I just have to have the imagination to come up with the "how" to put it all together like you just did. Thank you for taking the time to write this. You are da man! Or as you might say... man/woman/identifier.

There is enough information here to copy from the Magic.xml of CombatLib to write/copy/paste a workable script for what I need.
Awesome


Look at the section on multi attack monsters in the help for combat lib.


ya, once you can script/code... the hard part is the design of it... especially when that design is for/as a large-scale/scale'able system (RPG aspects: magic, equipment, combat, dialogue/diplomacy, descriptions/info, items, storage, stealth, etc). You can code, but can you code the best/most-efficient design possible. This is where I'm at with coding as well (though I'm still struggling with just being able to do Data Structure/Management coding, sighs).

HK.sex = "male"
msg ("HK is definately a " + HK.sex + ".")


P.S.

there's some mistakes in my example code in my previous post, and some stuff that I left out that I need to add to it, to show how the Delegate's Parameters work.


basically, Delegates are a way of turning an Object's Script Attribute into having the same functionality (Parameters/Arguments/Inputs and/or a returns a value) as a Function has.

an example:

(a very impractical/stupid/lame, example, lol, but it is a good example of how to use delegates)

<delegate name="return_string_delegate" type="string" parameters="string_parameter">

<game name="example_game">
  <attr name="start" type="script">
    string_variable = do (return_string_object, "return_string_script_attribute", "hi")  // string_parameter = "hi"
    msg (string_variable) // string_variable = "hi"
  </attr>
</game>

<object name="return_string_object">
  <attr name="return_string_script_attribute" type="return_string_delegate">
    return (string_parameter) //return type (Delegate: type="string"): string
  </attr>
</object>

the "hi" String Value used-in/passed-into the 'game' Game Settings Object's 'start' Script Attribute's scripting's use of the 'do' Function as its Argument, is stored into the 'return_string_delegate' Delegate's 'string_parameter' Parameter VARIABLE, and which matches up with the 'return_string_delegate' Delegate's specified return type (in this example, of: string), which is then used by the 'return_string_object' Object's 'return_string_script_attribute' Attribute VARIABLE'S scripting. The scripting just returns that String Value (in this example: "hi") as is the specified return type by the 'return_string_delegate' Delegate (again, the "hi" String Value matches up with the 'return_string_delegate' Delegate's return type of: string, so no errors), which is stored into the 'game' Game Settings Object's 'start' Script Attribute's scripting's 'string_variable' Variable VARIABLE. This is this used by the 'msg' Function, to display this String Value (in this example: "hi", as: hi).

Yuck!, that's wordy/confusing... lol


just like a Function, a Delegate can have either:

  1. just Parameter(s)
  2. just a return type
  3. both: Parameter(s) and a return type

P.S.S.

also, different Script Attributes can use the same Delegate.

This makes using Objects and Script_Attributes+Delegates, more useful than Functions, as Objects allow encapsulation/compartmentalization/self-contained (everything that is needed, is held within that Object, aside from the Delegates used by the Object's Script Attributes, so no jumping all over your entire game code, to look at your various Function's scriptings. You only have to look at the Delegates, which is just the name+quantity of inputs/Parameters used and/or if+what return type is used), which makes it easier on the human for organization, sanity/understanding/following of your code, and finding+trouble-shooting and/or just editing of the code.


P.S.S.S.

if you know the full-bore main programming languages:

quest's 'Delegates' are just like a Function's 'PROTOTYPE', except they are-for/act-upon quest's Object's Script Attributes, and not quest's Functions.

I'm not sure if you can PROTOTYPE quest's Functions as well... never tried it... lol.


Pixie
I only see a choice of monster or monster with a bow in combatlib


You need to select multi attack monster. I am away for August and cannot check it, if it is not try going to Attributes tab and add the multimonster from the types at the top.


Turns out I was using an old CombatLib...


Log in to post a reply.

Support

Forums