ArcEmu: [Double -H- Release] Merc System - Lua - 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

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

[Double -H- Release] Merc System - Lua

#1 User is offline   HalestormXV 

  • The Ultimatum
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,031
  • Joined: 07-June 08
  • Gender:Male

Posted 23 December 2009 - 01:32 AM

If you get errors please make sure you are using LuaHypArc and have Lua Enabled. If you are still receiving Errors please provide a detailed description.

So as you all know Hypersniper and I are well know scripters I kind of fell silent for a while. We do things that people look at and wonder....WTF. So he and I have decided to do what is called Double "H" Releases. These are scripts that combine both me and Hypersniper's scripting ability into universal scripts that use the LuaHypeArc Engine. This is our first release:

This is a server wide mercenary system that will allow players to higher mercenaries to work for them and act as a group. The Mercenaries are composed of two base units. A Medic and a Soldier. What makes them unique however is their ability to change style based on what you tell them to do.

For example if you want the Soldier to go into tank mode then it will switch its weapons and use pure tanking abilities. If you tell it to go into a Berserk Mode it will equip two - two-handed weapons and go into a Berserk aggressive fight style. If you tell it to go into a Balance style it will equip a single two handed weapon and fight with a balance between defensive and offensive.

The Medic class will allow you to change between healer mode or DPS mode The healer has AI designed to look out for you as well as other Mercenaries that you have hired.

The script is configurable and very simpl to use. It is plug and play, All you have to do is edit the cost to hire a mercenary (default is 150 gold), you can change how many Mercenaries you are allowing players to hire, (default is 3 and one officer, officer not yet implemented). And you can change the default style that the mercenary will start in (See Configurations in the Script)


So without further a due i present to you, the first Double "H" Release.
http://doubleh.pastebin.com/jBiDgyUt
--(  __  \ (  ___  )|\     /|(  ___ \ ( \      (  ____ \         |\     /|         (  ____ )(  ____ \( \      (  ____ \(  ___  )(  ____ \(  ____ \--
--| (  \  )| (   ) || )   ( || (   ) )| (      | (    \/         | )   ( |         | (    )|| (    \/| (      | (    \/| (   ) || (    \/| (    \/--
--| |   ) || |   | || |   | || (__/ / | |      | (__       _____ | (___) | _____   | (____)|| (__    | |      | (__    | (___) || (_____ | (__    --
--| |   | || |   | || |   | ||  __ (  | |      |  __)     (_____)|  ___  |(_____)  |     __)|  __)   | |      |  __)   |  ___  |(_____  )|  __)   --
--| |   ) || |   | || |   | || (  \ \ | |      | (               | (   ) |         | (\ (   | (      | |      | (      | (   ) |      ) || (      --
--| (__/  )| (___) || (___) || )___) )| (____/\| (____/\         | )   ( |         | ) \ \__| (____/\| (____/\| (____/\| )   ( |/\____) || (____/\--
--(______/ (_______)(_______)|/ \___/ (_______/(_______/         |/     \|         |/   \__/(_______/(_______/(_______/|/     \|\_______)(_______/--

-- Mercenary Selection System --
--      Double H Release      --

--//////////////////////--|
--Standard Configuration  |
--\\\\\\\\\\\\\\\\\\\\\\--|
local MAX_MERC          = 2        --The allowed number of Mercenaries to hire
local MAX_OFFICER       = 1        --The allowed number of Officers to hire
local GOLD_COST         = 1500000  --The amount of gold required to hire mercenaries in copper value.
local GOLD_COST_OFFICER = 4500000
--===========================---
--Creature AI Default Settings--
--===========================---

local WARRIOR_ENTRY = 100000
local MEDIC_ENTRY = 100001
local OFFICER_ENTRY = 100002

-- Warrior Settings (1 = Starting Fight Style, you can only enable one default style to start in. 
-- If you attempt to activate more then one style via cofigs, the standard style will automatically apply itself. (1=balance, 2=defensive, 3=offensive)
local	DEFAULT_WARRIOR_STYLE  = 1

-- Priest Settings (1 = Starting Fight Style, you can only enable one default style to start in. All others will default to 0. 
-- If you attempt to activate more then one style via cofigs, the standard style will automatically apply itself. (1=heals, 2=damage)
local   DEFAULT_MEDIC_STYLE = 1

-- Officer Settings (1 = Starting Fight Style, you can only enable one default style to start in. All others will default to 0. 
-- If you attempt to activate more then one style via cofigs, the standard style will automatically apply itself. (1=offensice, 2=defensive, 3=support)
local DEFAULT_OFFICER_STYLE = 3


--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
--                        DO NOT EDIT BELOW                                           --
--++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
OLDSTRAT = {}
OLDSTRAT.WARRIOR = {}
OLDSTRAT.HEALER = {}
OLDSTRAT.OFFICER = {}
math.randomseed(os.time()); math.random(); math.random(); math.random();

function hasMerc(player, pUnit)
	if (OLDSTRAT[player:GetName()] == nil) then return false; end
	if (OLDSTRAT[player:GetName()].mercs == nil) then return false; end
	for i,v in ipairs(OLDSTRAT[player:GetName()].mercs) do
		if (tostring(v) == tostring(pUnit)) then
			return true
		end
	end
	return false
end

function getNumMercs(player)
	if (OLDSTRAT[player:GetName()] == nil) then return 0; end
	if (OLDSTRAT[player:GetName()].mercs == nil) then return 0; end
	local count = 0
	for i,v in ipairs(OLDSTRAT[player:GetName()].mercs) do
		if (v ~= 0) then
			count = count+1
		end
	end
	return count
end

function hasOfficer(player, pUnit)
	if (OLDSTRAT[player:GetName()] == nil) then return false; end
	if (OLDSTRAT[player:GetName()].officer == nil) then return false; end
	for i,v in ipairs(OLDSTRAT[player:GetName()].officer) do
		if (tostring(v) == tostring(pUnit)) then
			return true
		end
	end
	return false
end

function getNumOfficer(player)
	if (OLDSTRAT[player:GetName()] == nil) then return 0; end
	if (OLDSTRAT[player:GetName()].officer == nil) then return 0; end
	local count = 0
	for i,v in ipairs(OLDSTRAT[player:GetName()].officer) do
		if (v ~= 0) then
			count = count+1
		end
	end
	return count
end

function OLDSTRAT.HookPlayerGone(pUnit, playerName)
	if (OLDSTRAT[playerName] == nil) then return; end --don't even bother with this func if no mercs.
	if (OLDSTRAT[playerName].mercs == nil) then return; end
	pUnit:RemoveEvents()
	for i,v in ipairs(OLDSTRAT[playerName].mercs) do
		if (tostring(v) == tostring(pUnit)) then
			OLDSTRAT[playerName].mercs[i] = 0
		end
	end
	OLDSTRAT[tostring(pUnit)] = nil
	--pUnit:Despawn(1, 60000) causes crashes...
end

function OLDSTRAT.HookPlayerGoneOfficer(pUnit, playerName)
	if (OLDSTRAT[playerName] == nil) then return; end --don't even bother with this func if no officer.
	if (OLDSTRAT[playerName].officer == nil) then return; end
	pUnit:RemoveEvents()
	for i,v in ipairs(OLDSTRAT[playerName].officer) do
		if (tostring(v) == tostring(pUnit)) then
			OLDSTRAT[playerName].officer[i] = 0
		end
	end
	OLDSTRAT[tostring(pUnit)] = nil
end

function OLDSTRAT.LeaveCombat(pUnit, event)
	if (OLDSTRAT[tostring(pUnit)] == nil) then return; end
	local player = OLDSTRAT[tostring(pUnit)].owner
	if (OLDSTRAT[player:GetName()] == nil) then return; end --don't even bother with this func if no mercs.
	if (OLDSTRAT[player:GetName()].mercs == nil) then return; end
	if (OLDSTRAT[player:GetName()].officer == nil) then return; end
	pUnit:SetUInt32Value(0x52, 1) --UNIT_NPC_FLAGS
	pUnit:SetUnitToFollow(player, math.random(1,8), 1)
	pUnit:RemoveEvents()
end

function OLDSTRAT.OfficerLeaveCombat(pUnit, event)
	if (OLDSTRAT[tostring(pUnit)] == nil) then return; end
	local player = OLDSTRAT[tostring(pUnit)].ownerO
	if (OLDSTRAT[player:GetName()] == nil) then return; end --don't even bother with this func if no mercs.
	if (OLDSTRAT[player:GetName()].officer == nil) then return; end
	pUnit:SetUInt32Value(0x52, 1) --UNIT_NPC_FLAGS
	pUnit:SetUnitToFollow(player, math.random(1,8), 1)
	pUnit:RemoveEvents()
end

RegisterUnitEvent(WARRIOR_ENTRY, 2, "OLDSTRAT.LeaveCombat")
RegisterUnitEvent(MEDIC_ENTRY, 2, "OLDSTRAT.LeaveCombat")
RegisterUnitEvent(OFFICER_ENTRY, 2, "OLDSTRAT.OfficerLeaveCombat")

function OLDSTRAT.OnTick(pUnit)
	local p = GetPlayer(OLDSTRAT[tostring(pUnit)].ownerName)
	if (p == false) then
		OLDSTRAT.HookPlayerGone(pUnit, OLDSTRAT[tostring(pUnit)].ownerName)
		OLDSTRAT.HookPlayerGoneOfficer(pUnit, OLDSTRAT[tostring(pUnit)].ownerNameO)
	elseif (p:IsDead() or p:IsInWorld() == false) then
		OLDSTRAT.HookPlayerGone(pUnit, OLDSTRAT[tostring(pUnit)].ownerName)
		OLDSTRAT.HookPlayerGoneOfficer(pUnit, OLDSTRAT[tostring(pUnit)].ownerNameO)
	end
end

function OLDSTRAT.OfficerOnTick(pUnit)
	local po = GetPlayer(OLDSTRAT[tostring(pUnit)].ownerNameO)
	if (po == false) then
		OLDSTRAT.HookPlayerGoneOfficer(pUnit, OLDSTRAT[tostring(pUnit)].ownerNameO)
	elseif (po:IsDead() or po:IsInWorld() == false) then
		OLDSTRAT.HookPlayerGoneOfficer(pUnit, OLDSTRAT[tostring(pUnit)].ownerNameO)
	end
end

function OLDSTRAT.OnDied(pUnit, event)
	pUnit:RemoveEvents()
        local player = OLDSTRAT[tostring(pUnit)].ownerName
	pUnit:Despawn(5000, 60000)
	for i,v in ipairs(OLDSTRAT[player].mercs) do
		if (tostring(v) == tostring(pUnit)) then
			OLDSTRAT[player].mercs[i] = 0
			break
		end
	end
	for i,v in ipairs(OLDSTRAT[player].officer) do
		if (tostring(v) == tostring(pUnit)) then
			OLDSTRAT[player].officer[i] = 0
			break
		end
	end
	if (getNumMercs(player) == 0) then OLDSTRAT[player] = nil end
end
	
RegisterUnitEvent(WARRIOR_ENTRY, 4, "OLDSTRAT.OnDied")
RegisterUnitEvent(MEDIC_ENTRY, 4, "OLDSTRAT.OnDied")
RegisterUnitEvent(OFFICER_ENTRY, 4, "OLDSTRAT.OnDied")

function OLDSTRAT.WARRIOR.Speak1(pUnit, event, player)
	if (OLDSTRAT[player:GetName()] == nil and OLDSTRAT[tostring(pUnit)] == nil) then
		pUnit:GossipCreateMenu(50020, player, 0)
		pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 1, 0)
		pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
		pUnit:GossipSendMenu(player)
	elseif (getNumMercs(player) < MAX_MERC) and (hasMerc(player, pUnit) == false) and (OLDSTRAT[tostring(pUnit)] == nil) then
		pUnit:GossipCreateMenu(50020, player, 0)
		pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 1, 0)
		pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
		pUnit:GossipSendMenu(player)
	elseif (hasMerc(player, pUnit) == true) then
		pUnit:GossipCreateMenu(50022, player, 0)
		pUnit:GossipMenuAddItem(0, "Focus more on defense right now.", 10, 0)
		pUnit:GossipMenuAddItem(0, "Use a more balance fight style right now.", 11, 0)
		pUnit:GossipMenuAddItem(0, "Go into a more aggressive fight style for now.", 12, 0)
		pUnit:GossipSendMenu(player)
	else
		pUnit:GossipCreateMenu(50021, player, 0)
		pUnit:GossipSendMenu(player)
	end
end

function OLDSTRAT.HEALER.Speak1(pUnit, event, player)
	if (OLDSTRAT[player:GetName()] == nil and OLDSTRAT[tostring(pUnit)] == nil) then
		pUnit:GossipCreateMenu(50020, player, 0)
		pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 2, 0)
		pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
		pUnit:GossipSendMenu(player)
	elseif (getNumMercs(player) < MAX_MERC) and (hasMerc(player, pUnit) == false) and (OLDSTRAT[tostring(pUnit)] == nil) then
		pUnit:GossipCreateMenu(50020, player, 0)
		pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 2, 0)
		pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
		pUnit:GossipSendMenu(player)
	elseif (hasMerc(player, pUnit) == true) then
		pUnit:GossipCreateMenu(50022, player, 0)
		pUnit:GossipMenuAddItem(0, "Focus more on support right now.", 20, 0)
		pUnit:GossipMenuAddItem(0, "Use a heavy damage based style for now.", 21, 0)
		pUnit:GossipSendMenu(player)
	else
		pUnit:GossipCreateMenu(50021, player, 0)
		pUnit:GossipSendMenu(player)
	end
end

function OLDSTRAT.OFFICER.Speak1(pUnit, event, player)
	if (OLDSTRAT[player:GetName()] == nil and OLDSTRAT[tostring(pUnit)] == nil) then
		pUnit:GossipCreateMenu(50020, player, 0)
		pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 1, 0)
		pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
		pUnit:GossipSendMenu(player)
	elseif (getNumOfficer(player) < MAX_OFFICER) and (hasOfficer(player, pUnit) == false) and (OLDSTRAT[tostring(pUnit)] == nil) then
		pUnit:GossipCreateMenu(50020, player, 0)
		pUnit:GossipMenuAddItem(0, "I see. I accept your offer.", 1, 0)
		pUnit:GossipMenuAddItem(0, "I do not need you now, Mercenary.", 3, 0)
		pUnit:GossipSendMenu(player)
	elseif (hasOfficer(player, pUnit) == true) then
		pUnit:GossipCreateMenu(50022, player, 0)
		pUnit:GossipMenuAddItem(0, "I need you in an offensive state.", 30, 0)
		pUnit:GossipMenuAddItem(0, "I am going to need your defensive capabilities.", 31, 0)
		pUnit:GossipMenuAddItem(0, "I need you to play the supportive role.", 32, 0)
		pUnit:GossipSendMenu(player)
	else
		pUnit:GossipCreateMenu(50021, player, 0)
		pUnit:GossipSendMenu(player)
	end
end

function OLDSTRAT.WARRIOR.Selection1(pUnit, event, player, id, intid, code)
	if (intid == 1) then
		if (player:GetCoinage() < GOLD_COST) then
			pUnit:SendChatMessage(12, 0, "I apologize, "..player:GetName().." but you do not have the amount of money I require.")
			player:GossipComplete()
		else
			if (OLDSTRAT[player:GetName()] == nil) then OLDSTRAT[player:GetName()] = {}; end
			if (OLDSTRAT[player:GetName()].mercs == nil) then OLDSTRAT[player:GetName()].mercs = {0,0,0}; end
			for i,v in ipairs(OLDSTRAT[player:GetName()].mercs) do
				if (v == 0) then
					OLDSTRAT[player:GetName()].mercs[i] = pUnit
					break
				end
			end
			OLDSTRAT[tostring(pUnit)] = {}
			OLDSTRAT[tostring(pUnit)].owner = player
			OLDSTRAT[tostring(pUnit)].ownerName = player:GetName()
			pUnit:RegisterEvent("OLDSTRAT.OnTick", 1000, 0)
			pUnit:SetFaction(player:GetFaction())
			pUnit:SendChatMessage(12, 0, "Excellent, I look forward to working with you, "..player:GetName()..".")
			OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE = DEFAULT_WARRIOR_STYLE
			pUnit:SetUnitToFollow(player, math.random(1,8), 1)
			player:DealGoldCost(GOLD_COST)
			player:GossipComplete()
		end
			
	end
	if (intid == 3) then
		player:GossipComplete()
	end
	-- Warrior Segment Playstyle --
	if (intid == 10) then  --Defensive Style
		pUnit:CastSpell(71)
		OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE = 2
		pUnit:SendChatMessage(12, 0, "Well, Tank mode it is then.")
		pUnit:EquipWeapons(45110, 40700, 1)
		player:GossipComplete()
	end		
	if (intid == 11) then  --Balance Style
		pUnit:CastSpell(2457)
		OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE = 1
		pUnit:SendChatMessage(12, 0, "Very well I shall fight in a mixed style.")
		pUnit:EquipWeapons(45165, 1, 1)
		player:GossipComplete()
	end

	if (intid == 12) then  --Agressive Style
		pUnit:CastSpell(2458)
		OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE = 3
		pUnit:SendChatMessage(12, 0, "Hmm, this should be entertaining, I will be taking more damage, just so you know.")
		pUnit:EquipWeapons(46016, 46016, 1)
		player:GossipComplete()
	end
end
	
function OLDSTRAT.HEALER.Selection1(pUnit, event, player, id, intid, code)
	if (intid == 2) then
		if (player:GetCoinage() < GOLD_COST) then
			pUnit:SendChatMessage(12, 0, "I apologize, "..player:GetName().." but you do not have the amount of money I require.")
			player:GossipComplete()
		else
			if (OLDSTRAT[player:GetName()] == nil) then OLDSTRAT[player:GetName()] = {}; end
			if (OLDSTRAT[player:GetName()].mercs == nil) then OLDSTRAT[player:GetName()].mercs = {0,0,0}; end
			for i,v in ipairs(OLDSTRAT[player:GetName()].mercs) do
				if (v == 0) then
					OLDSTRAT[player:GetName()].mercs[i] = pUnit
					break
				end
			end
			OLDSTRAT[tostring(pUnit)] = {}
			OLDSTRAT[tostring(pUnit)].owner = player
			OLDSTRAT[tostring(pUnit)].ownerName = player:GetName()
			pUnit:RegisterEvent("OLDSTRAT.OnTick", 1000, 0)
			pUnit:SetFaction(player:GetFaction())
			pUnit:SendChatMessage(12, 0, "Excellent, I look forward to working with you, "..player:GetName()..".")
			OLDSTRAT[tostring(pUnit)].MEDIC_STYLE = DEFAULT_MEDIC_STYLE
			pUnit:SetUnitToFollow(player, math.random(2,4), math.random(1, 6))
			player:DealGoldCost(GOLD_COST)
			player:GossipComplete()
		end
	end
	if (intid == 3) then
		player:GossipComplete()
	end
	-- Priest Segment Playstyle --
	if (intid == 20) then  --Support Style
		OLDSTRAT[tostring(pUnit)].MEDIC_STYLE = 1
		pUnit:RemoveAura(35194)
		pUnit:SendChatMessage(12, 0, "Oh well back to the heals.")
		player:GossipComplete()
	end		
	if (intid == 21) then  --Damage Style
		OLDSTRAT[tostring(pUnit)].MEDIC_STYLE = 2
		pUnit:CastSpell(35194)
		pUnit:SendChatMessage(12, 0, "Time for some fun.")
		player:GossipComplete()
	end
end

function OLDSTRAT.OFFICER.Selection1(pUnit, event, player, id, intid, code)
	if intid == 1 then
		if (player:GetCoinage() < GOLD_COST_OFFICER) then
			pUnit:SendChatMessage(12, 0, "I apologize, "..player:GetName().." but you do not have the amount of money I require.")
			player:GossipComplete()
		else
			if (OLDSTRAT[player:GetName()] == nil) then OLDSTRAT[player:GetName()] = {}; end
			if (OLDSTRAT[player:GetName()].officer == nil) then OLDSTRAT[player:GetName()].officer = {0,0,0}; end
			for i,v in ipairs(OLDSTRAT[player:GetName()].officer) do
				if (v == 0) then
					OLDSTRAT[player:GetName()].officer[i] = pUnit
					break
				end
			end
			OLDSTRAT[tostring(pUnit)] = {}
			OLDSTRAT[tostring(pUnit)].ownerO = player
			OLDSTRAT[tostring(pUnit)].ownerNameO = player:GetName()
			pUnit:RegisterEvent("OLDSTRAT.OfficerOnTick", 1000, 0)
			pUnit:SetFaction(player:GetFaction())
			pUnit:SendChatMessage(12, 0, "My service and leadership, are yours, "..player:GetName()..".")
			OLDSTRAT[tostring(pUnit)].OFFICER_STYLE = DEFAULT_OFFICER_STYLE
			pUnit:SetUnitToFollow(player, math.random(1,8), 1)
			player:DealGoldCost(GOLD_COST_OFFICER)
			player:GossipComplete()
		end
			
	end
	if (intid == 3) then
		player:GossipComplete()
	end
	-- Officer Segment Playstyle --
	if (intid == 30) then  --Offensive Style
		pUnit:RemoveAura(13589)
		pUnit:RemoveAura(2457)
		pUnit:RemoveAura(48942)
		pUnit:CastSpell(2458)
		pUnit:CastSpell(54043)
		OLDSTRAT[tostring(pUnit)].OFFICER_STYLE = 1
		pUnit:SendChatMessage(12, 0, "Well looks like there will be some blood spilled.")
		pUnit:EquipWeapons(51481, 1, 1)
		player:GossipComplete()
	end		
	if (intid == 31) then  --Defensive Style
		pUnit:RemoveAura(13589)
		pUnit:RemoveAura(2458)
		pUnit:RemoveAura(54043)
		pUnit:CastSpell(2457)
		pUnit:CastSpell(48942)
		OLDSTRAT[tostring(pUnit)].OFFICER_STYLE = 2
		pUnit:SendChatMessage(12, 0, "Sometimes the best offense is an excellent defense.")
		pUnit:EquipWeapons(47314, 45587, 1)
		player:GossipComplete()
	end

	if (intid == 32) then  --Support Style
		pUnit:RemoveAura(2457)
		pUnit:RemoveAura(48942)
		pUnit:RemoveAura(2458)
		pUnit:RemoveAura(54043)
		pUnit:CastSpell(13589)
		OLDSTRAT[tostring(pUnit)].OFFICER_STYLE = 3
		pUnit:SendChatMessage(12, 0, "Very well, I will provide additional support for you.")
		pUnit:EquipWeapons(45442, 45877, 1)
		player:GossipComplete()
	end
end

RegisterUnitGossipEvent(WARRIOR_ENTRY, 1, "OLDSTRAT.WARRIOR.Speak1")
RegisterUnitGossipEvent(WARRIOR_ENTRY, 2, "OLDSTRAT.WARRIOR.Selection1")

RegisterUnitGossipEvent(MEDIC_ENTRY, 1, "OLDSTRAT.HEALER.Speak1")
RegisterUnitGossipEvent(MEDIC_ENTRY, 2, "OLDSTRAT.HEALER.Selection1")

RegisterUnitGossipEvent(OFFICER_ENTRY, 1, "OLDSTRAT.OFFICER.Speak1")
RegisterUnitGossipEvent(OFFICER_ENTRY, 2, "OLDSTRAT.OFFICER.Selection1")

--===============================================================================================--
--                           COMBAT HANDLER FOR STANDARD WARRIORS                                --
--===============================================================================================--
--Balance Style						
local THUNDER_CLAP    	 = 58975
local STANDARD_CLEAVE  	 = 30619
local DEMORAL_SHOUT      = 29584
local MORTAL_STRIKE	  	 = 19643
local RETALIATION 	  	 = 22857

--Defensive Style
local SUNDER_ARMOR    	 = 27991
local SHIELD_BASH     	 = 41180
local SHIELD_WALL	  	 = 29390
local DISARM		  	 = 30013
local TAUNT	          	 = 37486

--Aggressive Style
local BLADESTORM	  	 = 63784
local RECKLESSNESS		 = 13847
local SLICE_STRIKES      = 30470
local SLAM               = 52026
local REND               = 29574

local Warrior_Balance    = {THUNDER_CLAP, STANDARD_CLEAVE, DEMORAL_SHOUT, MORTAL_STRIKE, RETALIATION}
local Warrior_Defensive  = {SUNDER_ARMOR, SHIELD_BASH, SHIELD_WALL, DISARM, TAUNT}						
local Warrior_Aggressive = {BLADESTORM, RECKLESSNESS, SLICE_STRIKES, SLAM, REND}

local Warrior_Taunts  = {"This ends now!", "You stand no match against my blade!", "I fear no death!", "For the city of Stratholme!", "Your insolence amuses me.", 
			            "I grow tired of these games!", "Is this truly my entertainment?", "Your blood shall quench my blade!", "Death fears me!", "Fun time!"}
						
function OLDSTRAT.WARRIOR.OnAggro1(pUnit, event)
	pUnit:SetUInt32Value(0x52, 0) --UNIT_NPC_FLAGS
	local speechCheck = math.random(1, 100)
	if (speechCheck <= 32) then
		local yellSay = math.random(1, 2)
		if yellSay == 1 then
			yellSay = 12
		else
			yellSay = 14
		end
		local i = math.random(1, 10)
		pUnit:SendChatMessage(yellSay, 0, Warrior_Taunts[i])
	end
	pUnit:RegisterEvent("OLDSTRAT.WARRIOR.Select1", 7000, 0)
end

function OLDSTRAT.WARRIOR.Select1(pUnit, event)
	if (OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE == 1) then
		OLDSTRAT.WARRIOR.Balance1(pUnit, event)
	elseif (OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE == 2) then
		OLDSTRAT.WARRIOR.Defensive1(pUnit, event)
	elseif (OLDSTRAT[tostring(pUnit)].WARRIOR_STYLE == 3) then
		OLDSTRAT.WARRIOR.Aggressive1(pUnit, event)
	end
end

function OLDSTRAT.WARRIOR.Balance1(pUnit, event)
	local target = pUnit:GetMainTank()
	if (target == nil) then return; end
	local b = math.random(1, 5)
	if (b ~= 3) and (b ~= 5) then
		pUnit:FullCastSpellOnTarget(Warrior_Balance[b], target)
	else
		pUnit:CastSpell(Warrior_Balance[b])
	end
end

function OLDSTRAT.WARRIOR.Defensive1(pUnit, event)
	local target = pUnit:GetMainTank()
	if (target == nil) then return; end
	local d = math.random(1, 5)
	if (d ~= 3) then
		pUnit:FullCastSpellOnTarget(Warrior_Defensive[d], target)
	else
		pUnit:CastSpell(Warrior_Defensive[d])
	end
end

function OLDSTRAT.WARRIOR.Aggressive1(pUnit, event)
	local target = pUnit:GetMainTank()
	if (target == nil) then return; end
	local a = math.random(1, 5)
	if (a ~= 2) and (a ~= 3) then
		pUnit:FullCastSpellOnTarget(Warrior_Aggressive[a], target)
	else
		pUnit:CastSpell(Warrior_Aggressive[a])
	end
end

RegisterUnitEvent(WARRIOR_ENTRY, 1, "OLDSTRAT.WARRIOR.OnAggro1")
--===============================================================================================--
--                           COMBAT HANDLER FOR STANDARD HEALERS                                 --
--===============================================================================================--
local Medic_Taunts  = {"Oh well, another battle to fight.", "Always wtith the fighting and then me with the healing.", "This should be a fun sight.", "For the city of Stratholme!", 
			            "I get no respect whatsoever.", "Is this truly my entertainment?"}
						
--Healing Style						
local SHIELD  	         = 47753
local HOLY_LIGHT         = 32769
local CHAIN_HEAL	  	 = 42477
--TODO: rez

--Shadow Style
local MIND_BLAST   	     = 60500
local MIND_FLAY     	 = 28310
local WORD_DEATH	  	 = 41375

local Medic_Healing = {SHIELD, HOLY_LIGHT, CHAIN_HEAL}
local Medic_Shadow  = {MIND_BLAST, MIND_FLAY, WORD_DEATH}

function OLDSTRAT.HEALER.OnAggro1(pUnit, event)
	pUnit:SetUInt32Value(0x52, 0) --UNIT_NPC_FLAGS
	local speechCheck = math.random(1, 100)
	if (speechCheck <= 32) then
		local yellSay = math.random(1, 2)
		if yellSay == 1 then
			yellSay = 12
		else
			yellSay = 14
		end
		local i = math.random(1, 6)
		pUnit:SendChatMessage(yellSay, 0, Medic_Taunts[i])
	end
	pUnit:RegisterEvent("OLDSTRAT.HEALER.Select1", 8000, 0)
end

function OLDSTRAT.HEALER.Select1(pUnit)
	if (OLDSTRAT[tostring(pUnit)].MEDIC_STYLE == 1) then
		OLDSTRAT.HEALER.Healing1(pUnit)
	elseif (OLDSTRAT[tostring(pUnit)].MEDIC_STYLE == 2) then
		OLDSTRAT.HEALER.Shadow1(pUnit)
	end
end

function OLDSTRAT.HEALER.Healing1(pUnit)
	local target = pUnit:GetRandomFriend()
	for i=1,10 do
		if (target ~= nil) then break; end
		target = pUnit:GetRandomFriend()
	end
	if (OLDSTRAT[tostring(pUnit)].owner:GetHealthPct() < 30) then target = OLDSTRAT[tostring(pUnit)].owner; end
	if (target == nil) then target = pUnit; end
	local h = math.random(1, 3)
	pUnit:FullCastSpellOnTarget(Medic_Healing[h], target)
end

function OLDSTRAT.HEALER.Shadow1(pUnit)
	local target = pUnit:GetMainTank()
	if (target == nil) then return; end
	local s = math.random(1, 3)		
	pUnit:FullCastSpellOnTarget(Medic_Shadow[s], target)
end

RegisterUnitEvent(MEDIC_ENTRY, 1, "OLDSTRAT.HEALER.OnAggro1")

-- TODO: Officers
--===============================================================================================--
--                           COMBAT HANDLER FOR STANDARD OFFICER                                 --
--===============================================================================================--
local Officer_Taunts  = {"Lets get this over with!", "This amuses me!", "I fear death is your only option!", "My blade will meet your throat!", "Your insolence amuses me.", 
			            "Enough of these distractions!", "Is this truly my entertainment?", "My blade yerns to cut!", "Let's go over your situation!", "Play time!"}
						
--Offensive Style--
local OFFICER_SABER_LASH         = 71021
local OFFICER_DEAFENING_ROAR     = 38850
local OFFICER_PIERCE_ARMOR       = 38187
local OFFICER_DARK_STRIKE        = 45271
--Defensive Style--
local OFFICER_SHIELD_SLAM        = 29684
local OFFICER_MORTAL_STRIKE      = 44268
local OFFICER_DEVASTATE          = 57795
local OFFICER_SUNDER_ARMOR       = 65936
--Support Style--
local OFFICER_HOLY_LIGHT         = 29562
local OFFICER_POWER_SHIELD       = 66099
local OFFICER_CHAIN_HEAL	  	 = 42477
local OFFICER_SMITE              = 71842

local Officer_AggressiveStore = {OFFICER_SABER_LASH, OFFICER_DEAFENING_ROAR, OFFICER_PIERCE_ARMOR, OFFICER_DARK_STRIKE}
local Officer_DefensiveStore  = {OFFICER_SHIELD_SLAM, OFFICER_MORTAL_STRIKE, OFFICER_DEVASTATE, OFFICER_SUNDER_ARMOR}
local Officer_SupportStore    = {OFFICER_HOLY_LIGHT, OFFICER_POWER_SHIELD, OFFICER_CHAIN_HEAL, OFFICER_SMITE}

function OLDSTRAT.OFFICER.OnAggro1(pUnit, event)
	pUnit:SetUInt32Value(0x52, 0)
	local speechCheck = math.random(1, 100)
	if (speechCheck <= 32) then
		local yellSay = math.random(1, 2)
		if yellSay == 1 then
			yellSay = 12
		else
			yellSay = 14
		end
		local i = math.random(1, 10)
		pUnit:SendChatMessage(yellSay, 0, Warrior_Taunts[i])
	end
	pUnit:RegisterEvent("OLDSTRAT.OFFICER.Select1", 7000, 0)
end


function OLDSTRAT.OFFICER.Select1(pUnit, event)
	if (OLDSTRAT[tostring(pUnit)].OFFICER_STYLE == 1) then
		OLDSTRAT.OFFICER.Offense1(pUnit, event) -- run offense
	elseif (OLDSTRAT[tostring(pUnit)].OFFICER_STYLE == 2) then
		OLDSTRAT.OFFICER.Defensive1(pUnit, event) -- run defense
	elseif (OLDSTRAT[tostring(pUnit)].OFFICER_STYLE == 3) then
		OLDSTRAT.OFFICER.Support1(pUnit, event) -- run support
	end
end

function OLDSTRAT.OFFICER.Offense1(pUnit, event)
	local target = pUnit:GetMainTank()
	if (target == nil) then return; end
	local o = math.random(1, 4)
	if (o ~= 1) and (o ~= 3) and (o ~= 4) then
		pUnit:FullCastSpellOnTarget(Officer_AggressiveStore[o], target)
	else
		pUnit:CastSpell(Officer_AggressiveStore[o])
	end
end

function OLDSTRAT.OFFICER.Defensive1(pUnit, event)
	local target = pUnit:GetMainTank()
	if (target == nil) then return; end
	local d = math.random(1, 4)
	pUnit:FullCastSpellOnTarget(Officer_DefensiveStore[d], target)
end

function OLDSTRAT.OFFICER.Support1(pUnit, event)
	local target = pUnit:GetRandomFriend()
	for i=1,10 do
		if (target ~= nil) then break; end
		target = pUnit:GetRandomFriend()
	end
	if (OLDSTRAT[tostring(pUnit)].ownerO:GetHealthPct() < 40) then target = OLDSTRAT[tostring(pUnit)].ownerO; end
	if (target == nil) then target = pUnit; end
	local s = math.random(1, 4)
	pUnit:FullCastSpellOnTarget(Officer_SupportStore[s], target)
end

RegisterUnitEvent(OFFICER_ENTRY, 1, "OLDSTRAT.OFFICER.OnAggro1")

**Owner of the Serenade of Sorrow Funserver**
My Most Recent Video: The Book of Kidou
Posted Image
0

#2 User is offline   hypersniper 

  • Advanced Member
  • Group: Retired
  • Posts: 227
  • Joined: 21-November 08
  • Gender:Male

Posted 23 December 2009 - 04:10 AM

Updated/fixed version: http://doubleh.pastebin.com/f6196913e
Please don't PM me asking to fix, correct or look-over your scripts. Please post a new thread in the Lua Scripting section so others can learn and help.
0

#3 User is offline   Ogchaos 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 404
  • Joined: 30-September 09

Posted 23 December 2009 - 04:51 AM

Very nice script,

Question:

1: When will this script be fully finished? (Officer implemented + SQL's Added)
0

#4 User is offline   HalestormXV 

  • The Ultimatum
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,031
  • Joined: 07-June 08
  • Gender:Male

Posted 23 December 2009 - 08:53 AM

Updated first post, and as for the actual Merc releases, I decided not to release those because it takes away from the customization. You can make the merc anything you want and link this script to them. There is no set stats to give the mercs. You can use WoW-V's Mob creator to make them if you like.
**Owner of the Serenade of Sorrow Funserver**
My Most Recent Video: The Book of Kidou
Posted Image
0

#5 User is offline   kreegoth 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 381
  • Joined: 28-November 08
  • Location:Outlands

Posted 23 December 2009 - 09:03 AM

Forgive me for asking this if it is a stupid question. But is there a way to make it so that you can have a merc of every level. Yes i know this would require 160 creatures. But it would check the Players level and give them the appropriate level merc?
0

#6 User is offline   HalestormXV 

  • The Ultimatum
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,031
  • Joined: 07-June 08
  • Gender:Male

Posted 23 December 2009 - 09:10 AM

You would have to create 160 different mercenaries but yes it is possible but will require some modifications to the script...160 to be precise.
**Owner of the Serenade of Sorrow Funserver**
My Most Recent Video: The Book of Kidou
Posted Image
0

#7 User is offline   kreegoth 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 381
  • Joined: 28-November 08
  • Location:Outlands

Posted 23 December 2009 - 10:12 AM

Very nice script BTW halestorm you and Hyper have outdone yourself.

In testing this script I have so far found two issues.

1) Sometimes the Npc will stop following the player and become "placed" where it is. Then you have to pull Npcs to it for it to attack them. After attacking them it will return to the spot it stopped at ( NOT its spawn point )

2) The npcs dont seem to be casting any spells. however the priest does shadowform and the warrior does change stances.
merc.lua:369: attempt to index local "friend" <a nil value>
merc.lua:67: attempt to index field `?` <a nil value>
merc.lua:69: attempt to index field `?` <a nil value>

I have a Trin database i converted the creature names and proto for.. it has entries for their bots program that has a npc created for a warrior class and a priest and a DPS class for each level from 1-80 ( 240 entries total )

With some work i could edit it so that its just the Priest and warrior ones and post them here if you want then would it be possible for you to add it into the Script?

Also as a suggestion it may make more sense to use a static Npc to perform the gossip and then have that Npc spawn the mercenary that follows the player as the way it is atm only 1 mercenary can be active of a type at a time. So unless its an instance there can only be 1 mercenary. You have to wait for the merc to die and respawn before another player can use it.

If thats my fault somehow in how i made it please let me know.
0

#8 User is offline   Ogchaos 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 404
  • Joined: 30-September 09

Posted 23 December 2009 - 10:48 AM

View PostHalestormXV, on 23 December 2009 - 08:53 AM, said:

Updated first post, and as for the actual Merc releases, I decided not to release those because it takes away from the customization. You can make the merc anything you want and link this script to them. There is no set stats to give the mercs. You can use WoW-V's Mob creator to make them if you like.


That's a good point, Well do you when the script will be completely finished?


Quote

Very nice script BTW halestorm you and Hyper have outdone yourself.

In testing this script I have so far found two issues.

1) Sometimes the Npc will stop following the player and become "placed" where it is. Then you have to pull Npcs to it for it to attack them. After attacking them it will return to the spot it stopped at ( NOT its spawn point )

2) The npcs dont seem to be casting any spells.
merc.lua:369: attempt to index local "friend" <a nil value>

I have a Trin database i converted the creature names and proto for.. it has entries for their bots program that has a npc created for a warrior class and a priest and a DPS class for each level from 1-80 ( 240 entries total )

With some work i could edit it so that its just the Priest and warrior ones and post them here if you want then would it be possible for you to add it into the Script?

Also as a suggestion it may make more sense to use a static Npc to perform the gossip and then have that Npc spawn the mercenary that follows the player as the way it is atm only 1 mercenary can be active of a type at a time. So unless its an instance there can only be 1 mercenary. You have to wait for the merc to die and respawn before another player can use it.

If thats my fault somehow in how i made it please let me know.


I can confirm these bugs, also I'm sure any improvements made to this script will be greatly appreciated, I for one would appreciate the level suggestion stated above being implemented.
0

#9 User is offline   kreegoth 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 381
  • Joined: 28-November 08
  • Location:Outlands

Posted 23 December 2009 - 02:26 PM

I know this isnt the correct section for crash dumps
but im posting this here as im almost 100% positive it was from this script

Crashdump
	AIInterface();
	virtual ~AIInterface();

	// Misc
	void Init(Unit *un, AIType at, MovementType mt);
	void Init(Unit *un, AIType at, MovementType mt, Unit *owner); // used for pets
	Unit *GetUnit() { return m_Unit; }
	Unit *GetPetOwner() { return m_PetOwner; }
	void DismissPet();
--->	void SetUnitToFollow(Unit* un) { UnitToFollow = un; };
	void SetUnitToFear(Unit* un)  { UnitToFear = un; };
	void SetFollowDistance(float dist) { FollowDistance = dist; };
	void SetUnitToFollowAngle(float angle) { m_fallowAngle = angle; }
	bool setInFront(Unit* target);
	ARCEMU_INLINE Unit* getUnitToFollow() { return UnitToFollow; }
	void setCreatureState(CreatureState state){ m_creatureState = state; }
	ARCEMU_INLINE uint8 getAIState() { return static_cast<uint8>( m_AIState ); }
	ARCEMU_INLINE uint8 getAIType() { return static_cast<uint8>( m_AIType ); }
    void SetAIType( AIType at ){ m_AIType = at; }
	ARCEMU_INLINE uint8 getCurrentAgent() { return static_cast<uint8>( m_aiCurrentAgent ); }
	void setCurrentAgent(AI_Agent agent) { m_aiCurrentAgent = agent; }
	uint32	getThreatByGUID(uint64 guid);


Callstack
 	LUAScripting.dll!ArcLuna<WorldPacket>::thunk(lua_State * L=0x225f2358)  Line 202 + 0x10 bytes	C++
 	LUAScripting.dll!luaD_precall(lua_State * L=0x225f2358, lua_TValue * func=0x22b4c300, int nresults=0)  Line 319 + 0x14 bytes	C
 	LUAScripting.dll!luaV_execute(lua_State * L=0x225f2358, int nexeccalls=1)  Line 587 + 0x14 bytes	C
 	LUAScripting.dll!luaD_call(lua_State * L=0x225f2358, lua_TValue * func=0x22b4c2d0, int nResults=0)  Line 377 + 0xb bytes	C
 	LUAScripting.dll!f_call(lua_State * L=0x225f2358, void * ud=0x3afbfbe4)  Line 800 + 0x16 bytes	C
 	LUAScripting.dll!luaD_rawrunprotected(lua_State * L=0x225f2358, void (lua_State *, void *)* f=0x22522a60, void * ud=0x3afbfbe4)  Line 118 + 0x1d bytes	C
 	LUAScripting.dll!luaD_pcall(lua_State * L=0x225f2358, void (lua_State *, void *)* func=0x22522a60, void * u=0x3afbfbe4, int old_top=32, int ef=0)  Line 463 + 0x11 bytes	C
 	LUAScripting.dll!lua_pcall(lua_State * L=0x225f2358, int nargs=4, int nresults=0, int errfunc=0)  Line 821 + 0x20 bytes	C
 	LUAScripting.dll!LuaEngine::OnUnitEvent(Unit * pUnit=0x1ac77ab8, const char * FunctionName=0x22bc7768, unsigned int EventType=2, Unit * pMiscUnit=0x00000000, unsigned int Misc=0, int Misc2=0, float Misc3=0.00000000, bool Yes=false, ItemPrototype * Misc4=0x00000000)  Line 473 + 0x13 bytes	C++
 	LUAScripting.dll!LuaCreature::OnCombatStop(Unit * mTarget=0x00000000)  Line 1689	C++
 	arcemu-world.exe!AIInterface::HandleEvent(unsigned int event=1, Unit * pUnit=0x2be61008, unsigned int misc1=0)  Line 403	C++
 	arcemu-world.exe!AIInterface::_UpdateCombat(unsigned int p_time=109)  Line 1073	C++
 	arcemu-world.exe!AIInterface::Update(unsigned int p_time=109)  Line 749	C++
 	arcemu-world.exe!Unit::Update(unsigned int p_time=109)  Line 705	C++
 	arcemu-world.exe!Creature::Update(unsigned int p_time=)  Line 275	C++
 	arcemu-world.exe!MapMgr::_PerformObjectDuties()  Line 1522	C++
 	arcemu-world.exe!MapMgr::Do()  Line 1355	C++
 	arcemu-world.exe!MapMgr::run()  Line 1276 + 0x8 bytes	C++
 	arcemu-world.exe!thread_proc(void * param=0x1a615948)  Line 264 + 0x7 bytes	C++
 	kernel32.dll!7d4dfe37() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	


autos
+		this	0x00000000 {m_canMove=??? m_WayPointsShowing=??? m_WayPointsShowBackwards=??? ...}	AIInterface * const
+		un	0x1ab38e30 {periodic_target=0 m_spellProto=0x040fdb8d targets=[0]() ...}	Unit *


locals
+		this	0x00000000 {m_canMove=??? m_WayPointsShowing=??? m_WayPointsShowBackwards=??? ...}	AIInterface * const
+		un	0x1ab38e30 {periodic_target=0 m_spellProto=0x040fdb8d targets=[0]() ...}	Unit *


If you think this is not the correct place for this as it does not relate to the script feel free to have a mod move it.. but the chances seem high, never saw it before implementing the script and half the callstack is Lua related.
0

#10 User is offline   hypersniper 

  • Advanced Member
  • Group: Retired
  • Posts: 227
  • Joined: 21-November 08
  • Gender:Male

Posted 23 December 2009 - 09:02 PM

Yes I'm working on the script now, getting some weird results with tables and whatnot but ill keep you updated
Please don't PM me asking to fix, correct or look-over your scripts. Please post a new thread in the Lua Scripting section so others can learn and help.
0

#11 User is offline   kreegoth 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 381
  • Joined: 28-November 08
  • Location:Outlands

Posted 23 December 2009 - 09:13 PM

Let me know Hyper as soon as i see it updated here ill re-add it and test it again to let ya know how it goes
0

#12 User is offline   hypersniper 

  • Advanced Member
  • Group: Retired
  • Posts: 227
  • Joined: 21-November 08
  • Gender:Male

Posted 24 December 2009 - 12:19 AM

Here's an updated one - it should be working alright, I was still personally getting some issues when they died but I'm not sure whether that's the script or a different internal issue. Anyway, most things should be good now:
http://doubleh.pastebin.com/f55c8d13e
Changed:
- Went from checking for nils and using table.remove to simply using 0 to represent no mercenary (this is safer while looping)
- Modified spells part a fair bit (hopefully they will cast more spells now)
Please don't PM me asking to fix, correct or look-over your scripts. Please post a new thread in the Lua Scripting section so others can learn and help.
0

#13 User is offline   kreegoth 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 381
  • Joined: 28-November 08
  • Location:Outlands

Posted 24 December 2009 - 01:37 AM

Still seem to be having trouble with the spells.. Warrior doesnt seem to do any while the priest appears to be casting Blast Wave or something which is not one of the listed spells in the script...Have never seen the priest heal either.

Also the Warrior Npc gives a message saying UNIT(########) when you talk to him everytime?

Also if you hire the mercenaries and leave the zone it seems that you are unable to rent another set until the server has been restarted as the npcs simply say to you after that "Hey there, How can I help you?"

This above issue also happens even if the npcs die. So i guess its still broken in that respect.

Atm can use the script 1 time then the Npcs will no longer talk to anyone.
0

#14 User is offline   hypersniper 

  • Advanced Member
  • Group: Retired
  • Posts: 227
  • Joined: 21-November 08
  • Gender:Male

Posted 24 December 2009 - 01:39 AM

Sigh. Im really over this. But I guess I'll look at it some more. Thank you.

Edit: Oh and the unit sending that message was a debug thing by me, feel free to remove :lol:

Edit2: Well spells are working now. I'll post the script at the end of my fixes.

http://doubleh.pastebin.com/f1d8b1d8e

This one should be just about it. However, for some strange reason, weird errors are occurring due to having 2 units of the same entry dying nearby, seems to be some sort of pUnit corruption going on. That's a problem for another time, though. For now, only have 1 of each type of mercenary. So 1 warrior and 1 healer. I even did the zoning-test and it worked fine. Modified the "SHIELD" spell as it was cleave by typo, and changed it to Divine Aegis. Also all spells and spell-modes are working.

It's actually quite cool when it works ;)
Please don't PM me asking to fix, correct or look-over your scripts. Please post a new thread in the Lua Scripting section so others can learn and help.
0

#15 User is offline   kreegoth 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 381
  • Joined: 28-November 08
  • Location:Outlands

Posted 24 December 2009 - 09:44 AM

Very nice updates Hyper looks good now!
0

#16 User is offline   HalestormXV 

  • The Ultimatum
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,031
  • Joined: 07-June 08
  • Gender:Male

Posted 24 December 2009 - 11:08 AM

Re-edited first post with fixes.
**Owner of the Serenade of Sorrow Funserver**
My Most Recent Video: The Book of Kidou
Posted Image
0

#17 User is offline   trulaypirata 

  • Member
  • Pip
  • Group: Members
  • Posts: 40
  • Joined: 08-June 08
  • Gender:Male
  • Location:Córdoba, Capital del Cuarteto (arg)
  • Interests:Warcraft.
  • Server OS:Windows

Posted 24 December 2009 - 12:48 PM

I have a VERY dumb question... sorry

Where o how i can recruit the mercenaries?
:(
...
0

#18 User is offline   kreegoth 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 381
  • Joined: 28-November 08
  • Location:Outlands

Posted 24 December 2009 - 05:43 PM

As stated Tru you have to make them yourself.


But it seems i was hasty in my earlier prognosis..

Bots crash server on combat occaisionally.
0

#19 User is offline   trulaypirata 

  • Member
  • Pip
  • Group: Members
  • Posts: 40
  • Joined: 08-June 08
  • Gender:Male
  • Location:Córdoba, Capital del Cuarteto (arg)
  • Interests:Warcraft.
  • Server OS:Windows

Posted 24 December 2009 - 07:17 PM

Finally i get it work! Looks pretty cool!!! :(

I havent crashes but when change the stance the merc stop following.

A Double Thanks to Hal & Hyp por this script!! Sorry for me bad english.
...
0

#20 User is offline   Ogchaos 

  • Interested
  • PipPipPipPip
  • Group: Members
  • Posts: 404
  • Joined: 30-September 09

Posted 24 December 2009 - 07:32 PM

BUG'S:

- Crashes occur, No crash dumps? (Reported by Ogchaos)
- Bots crash server on combat occaisionally. (Reported by kreegoth)
- When you try to change the mercenary's stance, the mercenary's no longer follow, this also happens to me. (Reported by trulaypirata)

0

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • 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