Combat Library Question

chrisw70
I was just beginning to look at the Combat Library to adapt for my game, I understand how to manipulate the actions through the tab, but I'm unclear whether you can have a monster attack the character on sight, without you having to do anything to provoke it? Is there anything about this anywhere? Thanks for any help or suggestions!

HegemonKhan
combat is either very simple or very complex~advanced (in fact, it can be probably one of thee most complex code systems of a game, as literally combat is usually one of the main aspects of a game, lol), there's a few links and libraries on combat:

(seriously, as you seem to be a noob to quest and~or to coding~programming, I'd stick with trying to understand and use Pixie's Simple Combat Library, or use an even simplier combat system of your own, if Pixie's is too confusing for you. I fully know how you want to jump into doing combat, as I myself want to jump into doing cool things... quickly learning that I'm not anywhere capable of doing those cool things, yet, lol~argh!)

(really, you need to understand attributes and 'if' scripts well, before you can really work with combat, as combat deals with attributes and 'if' scripts, and also A LOT more, unless you do really 'light' combat: just using messages and buttons: 'attack high', 'attack mid', and 'attack low', etc like stuff)

http://docs.textadventures.co.uk/quest/
http://docs.textadventures.co.uk/quest/tutorial/
http://docs.textadventures.co.uk/quest/ ... aries.html
viewforum.php?f=18 (Code~Libraries~Guides)
http://docs.textadventures.co.uk/quest/ ... nced_.html (Pixie's Simple Combat Library)
viewtopic.php?f=18&t=2660 (Pertex' Combat Library)
viewtopic.php?t=3348 (my successful, after a lot of struggle, to craft my own combat code, using Pertex' Combat Code structure, see the near last~newest post in the thread, called 'vini, vidi, veci', hehe)

etc links (I can find+provide more links: equipment, magic, item stacking, dialogue~conversations, etc etc etc)

-----------

there's a few combat metrics~features~options~strucutres you need to decide upon:

turn-based (script locked until the fight scripting is over: Pertex' Coding and my-Pertex 's Coding) vs more open~fluid (Pixie's Coding) vs timed-based

features~options: attack (physical: melee, ranged), magic, item, escape~run, etc etc etc

dynamic initiative ('who goes first' based upon, example, a 'speed' stat~attribute) vs static initiative (set scripting of who goes first)

attacked upon entering the room vs triggered by an action (such as clicking on the monster object's 'fight' button verb)

do you want a 'hostility' Attribute (where any npc can be friendly or enemy, based upon actions: you can make them more mad at you or more happy with you) vs set friendly npcs ('townspeople') and set hostile npcs ('monsters')

equipment usage or not

1vs1 or group (you and your party members) vs group (many monsters and types of monsters)

magic: spell targeting (single targetting, multiple targetting, self-targetting, all targetting, etc etc etc), spell types (healing~curing, damage, buffing: up~down, summoning,

elemental damages (weapons~armors, magic, etc)

bonus damage (swords: 150% vs humans, axes: 150% vs demons, blunts~'maces': 150% vs undead, critical hits, etc etc etc)

Command vs Verb

etc etc etc

I think you get the idea...

we need to know what you want, before we can help you with how to do those things that you want and~or with your type of entire structure of coding you'll be needing, etc etc etc

HegemonKhan
if you *DO* want to be attacked on sight, here's a simple way to do it:

simply use the room object's 'on enter room' or 'on enter room for first time' (not sure what tab of~for the room it's under... ?scripts? tab maybe), and put~make your combat scripting in it.

for example, in the GUI~Editor (all the friendly windows, buttons, tabs, and drop down menus) that you're using (as opposed to by code writing):

'room' Room Object -> ?scripts? (Tab) -> 'on enter room' Script or 'on enter for first time' Script -> run as script -> (add your combat~fight scripts)

---------

room to room: you can also have the enemy follow you, or even code for the enemy to head towards you, hehe

following you is simple code (that I can do)... coming towards you is complex code (mostly beyond my ability... Jaynebonne can help with it)

---------

if you don't, then there's a lot of ways you can do this...

HegemonKhan
also, you probably need to read this (if you're wondering where are all these tabs you see people talking about, lol):

the version history of changes made to quest:

http://docs.textadventures.co.uk/quest/ ... notes.html

you got to toggle the tags to be shown first as the link above explains.

chrisw70
Hi there, thanks for all the links I'll study them and see what I can learn! I'm somewhat familiar with light coding and simple if/then statements but still definitely a noob to Quest, I'm working up a prologue to my game hoping to throw in a little bit of everything in the beginning, so by the time I finish it I'll have a good working knowledge of the process before I get moving forward with the rest of it.

So for the combat system simple is good for my purposes, it won't be too heavy in RPG elements just the basics as in Pixie's library (weapon use, equip-unequip, damages, ect.)--I'm mostly puzzled how to make a monster attack you on sight and move it around at random or by following a path...is there a way that if a monster or NPC randomly wanders into the same room as the player, or the monster/NPC is moved to the room following a player action, it will attack without being provoked?

Which brings me to a second question that you brought up, involving NPC's patrolling areas/stalking the player/or just wandering about randomly.

I get how to create a monster which will fight back if you attack it using the simple Combat library--but I thought there might be a library you could add that would allow monsters and/or NPCS to randomly patrol areas/follow or hunt the player--and initiate attacks automatically.

It would also be useful for the player to be able to hide and evade a patroller or monster if there's something in the room they can hide behind or in.

This could be a tall order in asking for help with, but I think it would be something many people could use in their games--an NPC/monster patroller combined with light combat elements, and a way for players to hide to evade being spotted...

I'll be thinking about how to implement some of these elements as I learn more about Quest, and of course greatly apprecaite any help or advice. Thanks!

HegemonKhan
chris wrote:I'm mostly puzzled how to make a monster attack you on sight


simpliest method for being in the same room: using a Room Object's 'on enter' or 'on enter for the first time' Scripts

for global or event attack (don't need to be in the same room): you can use a (global) Turnscript or a (global) Timer Elements.

http://docs.textadventures.co.uk/quest/elements/
http://docs.textadventures.co.uk/quest/ ... cript.html (GUI~Editor: add Turnscript)
http://docs.textadventures.co.uk/quest/ ... timer.html (GUI~Editor: add Timer)

for within the room ('logically'), you'd have checks, such as comparing 'speed' attributes, you and the monster can't swim nor have any means of projectile attack and there's a river separating you and preventing you from fighting, etc etc etc, get creative~advanced~lol with your 'if'~'check' scripts, hehe :D

--------

useful link:

http://docs.textadventures.co.uk/quest/

useful scripts~functions (randomization), especially if you know how to use lists~dictionaries (arrays):

SUCH AS FOR NPCs 'PATROLLING' AREAS ~ RANDOMLY MOVING BETWEEN AREAS

http://docs.textadventures.co.uk/quest/ ... eroll.html
http://docs.textadventures.co.uk/quest/ ... omint.html
http://docs.textadventures.co.uk/quest/ ... ouble.html

the darkness levels (checkdarkness, setdark, setlightstrength)

and etc etc etc

--------

take a look at my combat code (the 'veni vidi vici' post) for ideas, if you're interested:

viewtopic.php?f=10&t=3348&start=120

and my 'explore' and 'travel' code:

<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>eef801a1-4e6b-4b0a-bdbf-8f3ecfa8389c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns=</statusattributes>
<start type="script">
msg ("Important Note:")
msg ("Type in: help")
</start>
</game>
<object name="homeland">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="grassland">
<inherit name="editor_room" />
</object>
<object name="plains">
<inherit name="editor_room" />
</object>
<object name="desert">
<inherit name="editor_room" />
</object>
<object name="tundra">
<inherit name="editor_room" />
</object>
<object name="swampland">
<inherit name="editor_room" />
</object>
<object name="mountains">
<inherit name="editor_room" />
</object>
<object name="forest">
<inherit name="editor_room" />
</object>
<object name="wasteland">
<inherit name="editor_room" />
</object>
<object name="coastland">
<inherit name="editor_room" />
</object>
<object name="hills">
<inherit name="editor_room" />
</object>
<command name="help_command">
<pattern>help</pattern>
<script>
help_function
</script>
</command>
<command name="explore_command">
<pattern>explore</pattern>
<script>
explore_function
</script>
</command>
<command name="travel_command">
<pattern>travel</pattern>
<script>
travel_function
</script>
</command>
<object name="data_object">
<inherit name="editor_object" />
<travel_string_list type="simplestringlist">homeland</travel_string_list>
<homeland_events_string_list type="simplestringlist">grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery</homeland_events_string_list>
<homeland_events_script_dictionary type="scriptdictionary">
<item key="grassland_discovery">
list add (data_object.travel_string_list, "grassland")
msg ("You've discovered the grassland! Now, you can travel to the grassland and explore it!")
</item>
<item key="plains_discovery">
list add (data_object.travel_string_list, "plains")
msg ("You've discovered the plains! Now, you can travel to the plains and explore it!")
</item>
<item key="desert_discovery">
list add (data_object.travel_string_list, "desert")
msg ("You've discovered the desert! Now, you can travel to the desert and explore it!")
</item>
<item key="tundra_discovery">
list add (data_object.travel_string_list, "tundra")
msg ("You've discovered the tundra! Now, you can travel to the tundra and explore it!")
</item>
<item key="swampland_discovery">
list add (data_object.travel_string_list, "swampland")
msg ("You've discovered the swampland! Now, you can travel to the swampland and explore it!")
</item>
<item key="forest_discovery">
list add (data_object.travel_string_list, "forest")
msg ("You've discovered the forest! Now, you can travel to the forest and explore it!")
</item>
<item key="mountains_discovery">
list add (data_object.travel_string_list, "mountains")
msg ("You've discovered the mountains! Now, you can travel to the mountains and explore it!")
</item>
<item key="hills_discovery">
list add (data_object.travel_string_list, "hills")
msg ("You've discovered the hills! Now, you can travel to the hills and explore it!")
</item>
<item key="wasteland_discovery">
list add (data_object.travel_string_list, "wasteland")
msg ("You've discovered the wasteland! Now, you can travel to the wasteland and explore it!")
</item>
<item key="coastland_discovery">
list add (data_object.travel_string_list, "coastland")
msg ("You've discovered the coastland! Now, you can travel to the coastland and explore it!")
</item>
</homeland_events_script_dictionary>
</object>
<turnscript name="global_turnscript">
<enabled />
<script>
game.turns = game.turns + 1
</script>
</turnscript>
<function name="help_function">
msg ("Type 'explore' to explore your area.")
msg ("Type 'travel' to travel to different areas.")
</function>
<function name="explore_function"><![CDATA[
switch (game.pov.parent) {
case (homeland) {
result_1 = ListCount (data_object.homeland_events_string_list) - 1
if (result_1 >= 0) {
result_2 = StringListItem (data_object.homeland_events_string_list,GetRandomInt(0,result_1))
invoke (ScriptDictionaryItem (data_object.homeland_events_script_dictionary,result_2))
on ready {
foreach (item_x, split ("grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery",";")) {
if (result_2 = item_x) {
list remove (data_object.homeland_events_string_list, result_2)
}
}
}
} else {
msg ("There seemingly is nothing left to explore in this area.")
}
}
}
]]></function>
<function name="travel_function">
show menu ("Where do you wish to travel?",data_object.travel_string_list,false) {
if (not game.pov.parent = GetObject (result)) {
game.pov.parent = GetObject (result)
} else {
msg ("You are already at this area.")
ask ("Try again?") {
if (result=true) {
travel_function
} else {
msg ("You realize that you need to discover a new area to travel to first, before you can travel to that place.")
}
}
}
}
</function>
</asl>


chris wrote:but I thought there might be a library you could add that would allow monsters and/or NPCS to randomly patrol areas/follow or hunt the player--and initiate attacks automatically.


viewtopic.php?f=10&t=4051&p=27140&hilit=follower+code#p27140

also, Jaynebonne has some libraries~posts~threads on advanced path coding (for having the monster navigating rooms seeking you out), or just ask him about it or for help with it.

all I understand about it, is using the 'grid' method, create X,Y coordinates for every~each room, and check the two rooms' (of you and monster) coordinates to each other via 'if greater than~lesser than~equal' for what room to move the monster to next.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums