ArcEmu: Spellauramodcharm, And Creatures Mind Controlling Players - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Developing

Interesting in developing with us? Join us on IRC: irc.emulationnetwork.com:6667 #arcemu
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Spellauramodcharm, And Creatures Mind Controlling Players

#1 User is offline   THCSphere 

  • Member
  • Pip
  • Group: Members
  • Posts: 25
  • Joined: 20-October 09

Posted 08 December 2011 - 06:32 PM

So this is something I've began working on for my 1.12 server, and I'm somewhat stumped, and notice it's not implemented here at ArcEmu either, so I thought I'd make a post and see if anyone is interested on working on it.

Here is my code for Aura::SpellAuraModCharm. Some functions may differ from ArcEmu, but you'll get the point

void Aura::SpellAuraModCharm(bool apply)
{
	Unit* u_caster = GetUnitCaster();
	if(u_caster == NULL || m_target == NULL)
		return;

	// Creature vs Player Mind Control
	if(u_caster->IsUnit() && m_target->IsPlayer())
	{
		if(apply)
		{

			// Already has a charmed unit.....
			if( u_caster->GetUInt64Value( UNIT_FIELD_CHARM ) != 0 )
				return;

			// Remove control from player
			m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
			WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, 10);
			data << m_target->GetNewGUID() << uint8(0);
			TO_PLAYER(m_target)->GetSession()->SendPacket(&data);

			// Attach player to creature
			m_target->m_special_state |= UNIT_STATE_CHARM;
			m_target->SetCharmTempVal( m_target->GetUInt32Value( UNIT_FIELD_FACTIONTEMPLATE ) );
			m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, u_caster->GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE));
			m_target->_setFaction();
			m_target->UpdateOppFactionSet();
			m_target->SetUInt64Value(UNIT_FIELD_CHARMEDBY, u_caster->GetGUID());
			u_caster->SetUInt64Value(UNIT_FIELD_CHARM, m_target->GetGUID());

			//Interrupt current spell
			if(m_target->GetCurrentSpell())
				m_target->GetCurrentSpell()->cancel();
		}
		else
		{

			// Send control back to player
			m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
			WorldPacket data(SMSG_CLIENT_CONTROL_UPDATE, 10);
			data << m_target->GetNewGUID() << uint8(1);
			TO_PLAYER(m_target)->GetSession()->SendPacket(&data);

			// Remove player from creature
			m_target->m_special_state &= ~UNIT_STATE_CHARM;
			m_target->SetUInt32Value( UNIT_FIELD_FACTIONTEMPLATE, m_target->GetCharmTempVal() );
			m_target->_setFaction();
			m_target->UpdateOppFactionSet();
			m_target->SetUInt64Value(UNIT_FIELD_CHARMEDBY, 0);
			u_caster->SetUInt64Value(UNIT_FIELD_CHARM, 0);

			//Interrupt current spell
			if(m_target->GetCurrentSpell())
				m_target->GetCurrentSpell()->cancel();
		}
	}
}


What the code currently does is easy to tell. It removes full player control and sets the faction to the creature that controls the player.

The problem is figuring out how to initialize some kind of AI for the player once this is all taken into effect. Has anyone else thought about how this could be done? I know the code isn't the best, but it was temporary to test to see how it went.
0

#2 User is offline   MesoX 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 296
  • Joined: 15-June 08
  • Gender:Male
  • Location:Czech Republic
  • Interests:pc & girls & parties

Posted 09 December 2011 - 05:19 AM

I guess it will be hard to make some kind of AI for it, is there any real example on retail? I wanna see it in action so you can see what actually creatures are doing with players.

Btw this:
u_caster->IsUnit()


Isn't u_caster always unit? Isn't better to check if it's a creature then unit?
Posted Image
0

#3 User is offline   Neo_mat 

  • drunken bear rider
  • PipPipPip
  • Group: Developers
  • Posts: 278
  • Joined: 07-June 08
  • Gender:Male
  • Server OS:Linux

Posted 09 December 2011 - 06:38 AM

In most cases as I remember such spells just are making your character going nuts, u becoming an enemy to other players in your party/raid and you randomly target people and cast your character's spells, even racials can be casted. You can observe it in fights vs Yogg Saron and C'Thun, as well Hakkar is charming people too (not the one in 4.0, old one in ZG). In ICC iirc Lady Deathwhisper is taking control over players too.

http://www.youtube.c...h?v=zDZRpKp0ivU here is an example of what happens when you being charmed by npc.
http://www.youtube.c...tailpage#t=440s
Posted Image
Posted Image
Posted Image
I am 91% addicted to World of Warcraft. What about you?
0

#4 User is offline   THCSphere 

  • Member
  • Pip
  • Group: Members
  • Posts: 25
  • Joined: 20-October 09

Posted 09 December 2011 - 08:37 AM

Yeah I know how they work, the question is how to make it work. I began working on this for Molten Core, as Flamewaker Protector's(Lucifron adds) use Dominate Mind. The problem is, how do we handle the spells? Just grab one from the players spells? Or setup a map of spells based on each level of a class for a better setup (Due to the fact in Vanilla there is plenty of down ranking, and old ranks are kept, and at lower levels players still have different spells in Wrath). Also, as for movement, would we just use some of the fear code in between casts/attacks? These are the things I'm actually wondering about.

In response to Mesox: Yeah... That's supposed to be IsCreature(). My bad. Like I said, it was a quick test, which removed control from player and updated factions properly. That's about it.
0

#5 User is offline   Neo_mat 

  • drunken bear rider
  • PipPipPip
  • Group: Developers
  • Posts: 278
  • Joined: 07-June 08
  • Gender:Male
  • Server OS:Linux

Posted 09 December 2011 - 04:27 PM

View PostTHCSphere, on 09 December 2011 - 08:37 AM, said:

Yeah I know how they work, the question is how to make it work. I began working on this for Molten Core, as Flamewaker Protector's(Lucifron adds) use Dominate Mind. The problem is, how do we handle the spells? Just grab one from the players spells? Or setup a map of spells based on each level of a class for a better setup (Due to the fact in Vanilla there is plenty of down ranking, and old ranks are kept, and at lower levels players still have different spells in Wrath). Also, as for movement, would we just use some of the fear code in between casts/attacks? These are the things I'm actually wondering about.

In response to Mesox: Yeah... That's supposed to be IsCreature(). My bad. Like I said, it was a quick test, which removed control from player and updated factions properly. That's about it.


just grab one from the players spells, because I don't remember that when I was mind controlled to cast Mind Flay Rank 1 instead of latest rank, though i remember such encounters only at max levels, so maybe it defferent when u are level 25 and being mind controled, but still doubt that, guess you always will be firing out your max rank spells. Because it doesn't seem like blizz has set a map of fixed spells that player can cast according to his calss while being mind controlled, because as Human, my character was randomly casting Mind Blast, then popping Every Man For Himself, healing some random mob and then running to melee someone, looks so dumb and amusing.
Posted Image
Posted Image
Posted Image
I am 91% addicted to World of Warcraft. What about you?
0

#6 User is offline   THCSphere 

  • Member
  • Pip
  • Group: Members
  • Posts: 25
  • Joined: 20-October 09

Posted 10 December 2011 - 10:08 PM

View PostNeo_mat, on 09 December 2011 - 04:27 PM, said:

just grab one from the players spells, because I don't remember that when I was mind controlled to cast Mind Flay Rank 1 instead of latest rank, though i remember such encounters only at max levels, so maybe it defferent when u are level 25 and being mind controled, but still doubt that, guess you always will be firing out your max rank spells. Because it doesn't seem like blizz has set a map of fixed spells that player can cast according to his calss while being mind controlled, because as Human, my character was randomly casting Mind Blast, then popping Every Man For Himself, healing some random mob and then running to melee someone, looks so dumb and amusing.


Alright, I'll give it a shot hopefully sometime this weekend after I deal with a few of my cores issues, and report back on what I get.


-- EDIT --

I haven't looked much into it, but I'm guessing when a player is feared, it uses the AI code for fear(As that's the only movement code based for fear). Is there any way of initializing AI for a player? If so, NPC Mind control could be extremely simple for NPC -> Player.

Alright. I've got it working partially now. I had to make a mod to isAttackable, and add some new stuff into Unit to set/grab who mind controlled the player, but I have them doing regular attacks on other units/players while mind controlled. It's a start!
0

#7 User is offline   Neo_mat 

  • drunken bear rider
  • PipPipPip
  • Group: Developers
  • Posts: 278
  • Joined: 07-June 08
  • Gender:Male
  • Server OS:Linux

Posted 11 December 2011 - 05:32 AM

View PostTHCSphere, on 10 December 2011 - 10:08 PM, said:

Alright, I'll give it a shot hopefully sometime this weekend after I deal with a few of my cores issues, and report back on what I get.


-- EDIT --

I haven't looked much into it, but I'm guessing when a player is feared, it uses the AI code for fear(As that's the only movement code based for fear). Is there any way of initializing AI for a player? If so, NPC Mind control could be extremely simple for NPC -> Player.

Alright. I've got it working partially now. I had to make a mod to isAttackable, and add some new stuff into Unit to set/grab who mind controlled the player, but I have them doing regular attacks on other units/players while mind controlled. It's a start!


Working on github or just locally? Would like to see the changesets, tho I see you've updated first post ;p
Posted Image
Posted Image
Posted Image
I am 91% addicted to World of Warcraft. What about you?
0

#8 User is offline   THCSphere 

  • Member
  • Pip
  • Group: Members
  • Posts: 25
  • Joined: 20-October 09

Posted 11 December 2011 - 03:10 PM

View PostNeo_mat, on 11 December 2011 - 05:32 AM, said:

Working on github or just locally? Would like to see the changesets, tho I see you've updated first post ;p


Well, my 1.12 is private on a repository. I don't have a 3.3.5 client right now to put it into ArcEmu and test it. If you can tell me of a function in ArcEmu to get a random player or closest player (that's not located in scripts), I can do a fork on Git and see if I can get it working. I got a 3.3.5 client downloading right now.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users