Welcome to the Builder Academy

Question stop kill trigger

More
03 May 2018 05:41 #8024 by JTP
Replied by JTP on topic stop kill trigger
Well hope someone May know the answer to a trigger that prevents Any form for fighing, kill, kick, bash etc.

Please Log in or Create an account to join the conversation.

More
03 May 2018 12:22 - 03 May 2018 12:22 #8027 by lacrc
Replied by lacrc on topic stop kill trigger
Well I don't think there's a way to check if commands are 'violent', the commands are different ACMDs (bash is different from kill) and each has it's own checks regarding peaceful rooms for example.

You would have to create a script that checks all commands that you want to check (just like Krell said). But I think the arg needs to be set to '*' and not '+' maybe?

The script would be something like:
Code:
if (%cmd.mudcommand% == kill || %cmd.mudcommand% == kick || %cmd.mudcommand% == bash || ... ) .... end
Last edit: 03 May 2018 12:22 by lacrc.

Please Log in or Create an account to join the conversation.

More
03 May 2018 13:49 #8028 by JTP
Replied by JTP on topic stop kill trigger
Ohh that wil be complicated, think i have 65 offensive skills

Please Log in or Create an account to join the conversation.

More
03 May 2018 17:43 - 03 May 2018 18:08 #8029 by krell
Replied by krell on topic stop kill trigger
You could do it as a switch if it makes it easier to read and keep track of which skills you're checking.

Code:
switch %cmd.mudcommand% case kill .... break case kick etc...

But there may be a limit on how many cases you can switch on. If so you may have to do a spec proc in the codebase.

Good luck.
Last edit: 03 May 2018 18:08 by krell.

Please Log in or Create an account to join the conversation.

More
03 May 2018 18:54 #8030 by krell
Replied by krell on topic stop kill trigger

lacrc wrote: (lke Krell said). But I think the arg needs to be set to '*' and not '+' maybe?


Yeah, when I'm responding on my phone I can't always tell if I'm entering the * or + with my soft keyboard. Editing on this forum with a phone is also a pain as it's hard to expand the field without a lot of fiddling. :(

Please Log in or Create an account to join the conversation.

More
03 May 2018 21:04 #8031 by thomas
Replied by thomas on topic stop kill trigger

Editing on this forum with a phone is also a pain as it's hard to expand the field without a lot of fiddling. :(

Hmm.. I think that should be fixable. I'll look into it.

About the original question - this is a case where there is no relevant triggers. As the suggestions show, a command trigger for this quickly becomes unwieldy. If you add all of your damaging skills here, what do you do with casters? And when you add a spell, it's another place to make sure you add it.

So, no trigger types make sense here. Let's make a new one. I'll just show you the general idea:
- Add new mob trigger type in dg_, and add one to the max in dg_olc.h.
- Add the text for it in constants.h
- Add a trigger handler in dg_triggers.c/h
- Now, add a trigger check in damage() in fight.c, just after the peaceful room check
Make it respect the return value, -1 means disallow damage (as if room was peaceful), 0 means miss, >0 means do this damage. Default is just to do the same damage.

I've created a branch in github showing how it works: github.com/tbamud/tbamud/compare/damager...er-addition?expand=1

Also, a trigger to show it off - this one stops the fight from starting:
Code:
1) Name : Damage trigger example 2) Intended for : Mobiles 3) Trigger types: Damage 4) Numeric Arg : 100 5) Arguments : 6) Commands: %echo% Damage trigger triggered %echo% actor: %actor.name% %echo% victim: %victim.name% %echo% dam: %damage% %echo% attacktype: %attacktype% return -1
The following user(s) said Thank You: krell, lacrc

Please Log in or Create an account to join the conversation.

Time to create page: 0.251 seconds