Welcome to the Builder Academy

Question Switch target skill

More
29 Aug 2017 19:07 #6847 by JTP
Replied by JTP on topic Switch target skill
Hope someone can help see whats wrong.

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

More
29 Aug 2017 21:03 #6848 by thomas
Replied by thomas on topic Switch target skill
Oh, but there's nothing wrong, per se. The code does exactly what I designed it to do. It is not currently designed to let you add another person to the fight, just switch between the ones who are already fighting you.

However, though it is reasonably easy to change the logic here, we must avoid getting in an illegal state.
Something like this would work, I think:
Code:
if (GET_SKILL(ch, SKILL_SWITCH) > rand_number(1,95)) { send_to_char(ch, "You switch your target!\r\n"); act("$n switches target to $N!", FALSE, ch, 0, vict, TO_ROOM); + damage(ch, vict, 1, TYPE_UNDEFINED); + if (FIGHTING(vict) == ch) { FIGHTING(ch) = vict; + } } else {
The damage() call causes the opponent to be set_fighting if it isn't already. Then we switch.
The following user(s) said Thank You: JTP

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

More
29 Aug 2017 21:18 #6849 by JTP
Replied by JTP on topic Switch target skill
Working now..thanks alot.

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

More
01 Oct 2017 18:02 #6941 by zusuk
Replied by zusuk on topic Switch target skill
I do not remember if it is absolutely necessary, but I think it may save you some heartache in the future if you add a "stop_fighting" then just hit the new target with zero damage. To switch targets in our MUD it takes an 'action' and will present opponents that are attacking you with an 'attack of opportunity', so you can ignore those parts :) Oh and ignore the event stuff, we use events to run combat.

Because you are running the damage() function, you and the new target will automatically engage (if he/she can, if he/she is already targeting someone else, they will continue to do so), and the previous target will continue to fight you because you are not messing with their target.
Code:
} else { /* don't forget to remove the fight event! */ if (char_has_mud_event(ch, eCOMBAT_ROUND)) { event_cancel_specific(ch, eCOMBAT_ROUND); } USE_STANDARD_ACTION(ch); stop_fighting(ch); send_to_char(ch, "You switch opponents!\r\n"); act("$n switches opponents!", FALSE, ch, 0, vict, TO_ROOM); hit(ch, vict, TYPE_UNDEFINED, DAM_RESERVED_DBC, 0, FALSE); //everyone gets a free shot at you unless you make a acrobatics check //15 is DC if (FIGHTING(ch) && FIGHTING(vict)) { if (!skill_check(ch, ABILITY_ACROBATICS, 15)) attacks_of_opportunity(ch, 0); } }

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

Time to create page: 0.382 seconds