|
ellisd88 Newbie
Joined: 31 Oct 2013 Posts: 3
|
Posted: Thu Oct 31, 2013 3:51 pm
Combat trigger help |
Hello folks,
I recently got back into playing my favorite MUD and decided to buy CMUD. I am completely new to setting up triggers besides very basic commands. The MUD I am playing on does not allow someone to use triggers to basically autowalk,stop and search for mobs, auto attack those mobs and then continue. I can however setup a trigger that will search for mobs in the room and automatically attack them as long as I control the movement of my character. How can I make a trigger to automatically attack mobs as I enter the room?
Lets use these two lines as an example:
"A servant is wandering around here"
"A muscular orcish guard is watching you"
I would like to have a trigger that will automatically attack these mobs as well as tell my group to assist me.
Help is greatly appreciated! Thanks! |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Oct 31, 2013 11:06 pm |
Quote: |
I recently got back into playing my favorite MUD and decided to buy CMUD. I am completely new to setting up triggers besides very basic commands. The MUD I am playing on does not allow someone to use triggers to basically autowalk,stop and search for mobs, auto attack those mobs and then continue. I can however setup a trigger that will search for mobs in the room and automatically attack them as long as I control the movement of my character.
|
Code: |
#trigger {({@targets})} {
#loopdb @mobs {
#if (%key = %1) {attack %val}
}
}
#alias target {#if (!%null(%1)) {#additem targets %-1}}
#alias mobadd {
#switch (!%null(%1) and !%null(%2)) {
//both arguments are present
//example: mobadd cat dog
#addkey Mobs %-2 %1
#print "A new mob ("%-2") was added with "%1" as a keyword"
}
(%null(%1)) {
//first argument is blank, second is not
//example: mobadd "" dog
#print "ERROR: the mob's keyword is missing!"
}
(%null(%2)) {
//second argument is blank, first is not
//example: mobadd cat ""
//example: mobadd cat
#print "ERROR: the mob's room name is missing!"
}
(1) {
//neither argument is present
//example: mobadd "" ""
//example: mobadd
#print "Syntax: MOBADD [keyword] [description]"
}
}
|
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
ellisd88 Newbie
Joined: 31 Oct 2013 Posts: 3
|
Posted: Fri Nov 01, 2013 3:50 am |
Wow thanks for that Matt. I am very new to this and I am still having a hard time getting it work. Could you use the following line as an example and display how it should be plugged into the trigger?
for example lets so I go north and enter the room and the MUD text displays the normal room title and description and the mobs descrpition is
"An ice mephit is here, watching you with disdain"
Thanks again. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Fri Nov 01, 2013 9:54 pm |
Given the way mobs are in poses, it makes knowing which word is the noun hard for the game to understand.
I would suggest you make a variable to hold the nouns of the creatures you wish to automatically attack.
autoKill=mephit|guard|servant|etc
then a trigger like this would work:
#TR {({@autoKill}) {is|are}} {kill %1} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
MCrews17 Beginner
Joined: 16 Oct 2011 Posts: 13
|
Posted: Mon Nov 25, 2013 11:13 pm |
Try copy this code and paste it notepad.exe then copy and paste from there into your command line.
It should open up a simulation.
Enjoy!
-Matt
Code: |
//QUICK COMBAT SYSTEM
//Using a quick menu for combat is much easier than dealing
//with the complexities of designing an auto-combat system.
#TRIG {(%w) Enters Room Text} {
$Monster=%1
AttackList=%additem($Monster,@AttackList)
GetList
}
#TRIG {You killed the (%w)} {
$Monster=%1
RemList $Monster
}
#ALIAS GetList {
#CLR TARGETING
#FORALL @AttackList {
$Monster=%i
#WIN TARGETING {
<send 'kill $Monster'>$Monster</send>
<send 'RemList $Monster'>REMOVE</send>
%char(13)
}
}}
#ALIAS RemList {
#VAR AttackList %delitem(%1,@AttackList)
GetList
}
#SAY TargetA Enters Room Text
#SAY TargetB Enters Room Text
#SAY TargetC Enters Room Text
|
|
|
|
|
|
|