Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
ellisd88
Newbie


Joined: 31 Oct 2013
Posts: 3

PostPosted: 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!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
ellisd88
Newbie


Joined: 31 Oct 2013
Posts: 3

PostPosted: 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.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: 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
Reply with quote
MCrews17
Beginner


Joined: 16 Oct 2011
Posts: 13

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net