• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Request for custom outfits and scripts for NPC!

Seanr

New Member
Joined
Jul 11, 2011
Messages
167
Reaction score
3
Location
Mo Town
Hey, I am new to this website but I haven't found any help anywhere else.

I want to add custom outfits into my server like, Hero, Necromancer, and others like the barbarian outfits and this is self explanatory.

However, I need help scripting an NPC who will make these outfits appear in a player's "Change Outfit" option after the player gives the NPC a special item. I don't want the outfits going away when the player changes to a different outfit or goes invis or whatever. I want the player to be able to go to that outfit at any time if he/she chooses to change outfits.

Also, if anyone can help me script raids for creatures to drop these items that would be helpful.

Sincerely,
Sean
 
Hey, I am new to this website but I haven't found any help anywhere else.

I want to add custom outfits into my server like, Hero, Necromancer, and others like the barbarian outfits and this is self explanatory.

However, I need help scripting an NPC who will make these outfits appear in a player's "Change Outfit" option after the player gives the NPC a special item. I don't want the outfits going away when the player changes to a different outfit or goes invis or whatever. I want the player to be able to go to that outfit at any time if he/she chooses to change outfits.

Also, if anyone can help me script raids for creatures to drop these items that would be helpful.

Sincerely,
Sean

Ok, I just made this script for you, hope this is what you are looking for :D

go to data/XML/outfits.xml
probably the last lines will look something like this:
Lua:
	<outfit id="35" access="5" premium="yes">
		<list gender="0-3" lookType="302" name="God"/>
	</outfit>
</outfits>

Now, before </outfits> and below the last </outfit>
add this:
Lua:
	<outfit id="aa" quest="yyyyy" premium="yes">
		<list gender="0" lookType="xx" name="Name"/>
		<list gender="1" lookType="zz" name="Name"/>
	</outfit>
Now, change the
Code:
outfit id="aa"
to the number of you last outfit +1 for example if it was 33 make this new one 34

Code:
quest="yyyyy"
change those y's to a storage value, any number you want, like 15255, or whatever, just be sure it is not used for any other quests...

Code:
lookType="xx"
Code:
lookType="zz"
change the xx and the zz to the lookType of the monster you want, it can be found at the monster.xml file...

Code:
name="Name"
change the Name (the second one) to the name of the outfit like, hero, elf, etc

Ok, now you created your outfit...
Lets make the NPC that will give the player the outfit...


go to data/npc and make a new xml file, name it as you want and place this inside:
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Name" script="data/npc/scripts/outfiter.lua" walkinterval="2000" floorchange="0">
<mana now="800" max="800"/>
<health now="200" max="200"/>
<look type="133" head="114" body="119" legs="132" feet="114"/>
<parameters>
       <parameter key="message_greet" value="Hello, |PLAYERNAME|."/>
        <parameter key="message_farewell" value="Farewell, |PLAYERNAME|"/>
		<parameter key="message_walkaway" value="Farewell, |PLAYERNAME|" />
    </parameters>
</npc>

change
Code:
name="Name"
to whatever you want the npc name to be, it must be the same name as the file...

now go to data/npc/scripts make a new lua file and name it outfiter
place this inside:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid



local configs = {
        
        ItemId = 2455,
        ItemCount = 1,
        Storage = 2321,

        }


if(msgcontains(msg, 'outfit')) then
        if (getPlayerStorageValue(cid, configs.Storage) > 0) then
		selfSay('You already have this outfit.', cid)
		talkState[talkUser] = 0
	else
		selfSay('Do you have all the items for the new outfit ?', cid) 
			talkState[talkUser] = 1
	end
		else
			if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
                		if (getPlayerItemCount(cid, configs.ItemId) == configs.ItemCount) then
                        		doPlayerRemoveItem(cid, configs.ItemId, configs.ItemCount)
                        		setPlayerStorageValue(cid, configs.Storage, 1)
					doSendMagicEffect(getPlayerPosition(cid), 12)
					selfSay('Congratz, you now have a brand new outfit.', cid)
					talkState[talkUser] = 0
                else
                	selfSay('You don\'t have all the items.', cid)
			talkState[talkUser] = 0
		end

	end
		return TRUE
	end
end
                
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

now change this:
Code:
local configs = {
        
        ItemId = 2548,
        ItemCount = 1,
        Storage = 224789,

        }
Code:
ItemId = 2548
change that 2548 to the id of the item you want.

Code:
Itemcount = 1
change that it to the amount of that items it will be needed

Code:
Storage = 24789
change that 24789 to the same code you have put on the outfits.xml on quest="yyyyy"

Hope it helps :D
 
I got this when I tried what you gave me:

[Error - LuaScriptInterface::loadFile] data/npc/scripts/outfiter.lua:46: '>' expeced near 'm'
[Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/outfiter.lua
data/npc /scripts/outfiter.lua: '>' expected near 'm'


What do I do? :s

- - - Updated - - -

B
U
M
P
 
I'm sorry for the delay to answer you, I couldn't log-in for some days...

Try this script:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
 
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
 
 
 
local configs = {
 
        ItemId = 2455,
        ItemCount = 1,
        Storage = 2321
 
        }
 
 
if(msgcontains(msg, 'outfit')) then
        if (getPlayerStorageValue(cid, configs.Storage) > 0) then
		selfSay('You already have this outfit.', cid)
		talkState[talkUser] = 0
	else
		selfSay('Do you have all the items for the new outfit ?', cid) 
			talkState[talkUser] = 1
	end
		else
			if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
                		if (getPlayerItemCount(cid, configs.ItemId) == configs.ItemCount) then
                        		doPlayerRemoveItem(cid, configs.ItemId, configs.ItemCount)
                        		setPlayerStorageValue(cid, configs.Storage, 1)
					doSendMagicEffect(getPlayerPosition(cid), 12)
					selfSay('Congratz, you now have a brand new outfit.', cid)
					talkState[talkUser] = 0
                else
                	selfSay('You don\'t have all the items.', cid)
			talkState[talkUser] = 0
		end
 
	end
		return TRUE
	end
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Okay the NPC takes item and sparkles appear on player but outfit is not added? what you think?
 
Last edited:
You need to add the outfit...
Lua:
doPlayerAddOutfit(cid, xxx)

Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
 
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
 
local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
 
 
 
local configs = {
 
        ItemId = 2455,
        ItemCount = 1,
        Storage = 2321
 
        }
 
 
if(msgcontains(msg, 'outfit')) then
        if (getPlayerStorageValue(cid, configs.Storage) > 0) then
		selfSay('You already have this outfit.', cid)
		talkState[talkUser] = 0
	else
		selfSay('Do you have all the items for the new outfit ?', cid) 
			talkState[talkUser] = 1
	end
		else
			if(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
                		if (getPlayerItemCount(cid, configs.ItemId) == configs.ItemCount) then
                        		doPlayerRemoveItem(cid, configs.ItemId, configs.ItemCount)
                        		setPlayerStorageValue(cid, configs.Storage, 1)
                                              doPlayerAddOutfit(cid, xxx)
					doSendMagicEffect(getPlayerPosition(cid), 12)
					selfSay('Congratz, you now have a brand new outfit.', cid)
					talkState[talkUser] = 0
                else
                	selfSay('You don\'t have all the items.', cid)
			talkState[talkUser] = 0
		end
 
	end
		return TRUE
	end
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Okay this works and players will receive outfit but I still get this error:

[Error - Npc interface]
data/npc/scripts/outfiter.lua:eek:nCreatureSay
Description:
<luaDoPlayerAddOutfit> Player not found

and I wanna add bonuses to these outfits like addon bonuses for outfits with addons and i tried giving my first custom outfit bonuses but I think this error stops it.

- - - Updated - - -

BUMP
 
Okay the NPC takes item and sparkles appear on player but outfit is not added? what you think?

Sorry for the delay to answer... I think you did something wrong on the outfits.xml
the npc is working just fine here, you don't need to use the command "doPlayerAddOutfit"

check the storage values, maybe there is a wrong number somewhere... it might be causing the problem
 
Bump

- - - Updated - - -

Sorry for the delay to answer... I think you did something wrong on the outfits.xml
the npc is working just fine here, you don't need to use the command "doPlayerAddOutfit"

check the storage values, maybe there is a wrong number somewhere... it might be causing the problem

Can you check my post on first page near bottom? i get outfts and can switch through them fine but can't add bonuses to them? The storage values are correct :/
 
Last edited:
Bump

- - - Updated - - -



Can you check my post on first page near bottom? i get outfts and can switch through them fine but can't add bonuses to them? The storage values are correct :/

I don´t know what you mean by bonuses, could you be more specific please ?
Sorry
 
Like some OTs have addon bonuses that give you skills or ML or resistance to elements when you wear them or even give more health or mana. I want to add those bonuses to these outfits but they won't work..
 
Well, that is completely different story...
But, it is very simple...

As we are using a storage value to check if the player can wear that outfit or not, you just have to check if the player has that storage value again, in a new action, and if it does then do whatever you want.. as simple as that
For exemple:
Lua:
if getPlayerStorageValue(cid, storage) > 0 then
whatever you want here
end
return true
end
as simple as that...
Remember that it should be a onLogin function, and you must register it...

Just to make it clear, I´ll make you an example...
go to creaturescripts/scripts
create a new lua file name it whatever you want and place this code inside:
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
 
local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150)
setConditionParam(condition, CONDITION_PARAM_BUFF, true)
setCombatCondition(combat, condition)

function onLogin(cid, var)
local storage = 1443332
         if isPlayer(cid) and getPlayerStorageValue(cid, storage) > 0 then
var = numberToVariant(cid)
            doCombat(cid, combat, var)
         end
         return true
end
then go to login.lua and add this:
Lua:
registerCreatureEvent(cid, "zzzz")
change zzzz to whatever you want

then go to creaturescripts.xml and add this:
Lua:
<event type="login" name="zzzz" event="script" value="name_of_file.lua"/>
just change the zzzz to same thing you placed at login.lua and change name_of_file to whatever you named your .lua file..

Just so you know, this scrip will increase the distance skill by 50%

Hope it helps =)
 
You have been very helpful but I have a couple questions left probably, one question is that, did I need to add "registerCreatureEvent(cid, "zzzz")" for all of the outfits before? into login.lua?

if getPlayerStorageValue(cid, storage) > 0 then
whatever you want here
end
return true
end

@ up, Do I need to add this into creaturescripts and then into login for all my custom outfits?

The script you gave me increased distance but when I changed to my custom outfits or any outfit it goes away.
 
Last edited:
You have been very helpful but I have a couple questions left probably, one question is that, did I need to add "registerCreatureEvent(cid, "zzzz")" for all of the outfits before? into login.lua?

if getPlayerStorageValue(cid, storage) > 0 then
whatever you want here
end
return true
end

@ up, Do I need to add this into creaturescripts and then into login for all my custom outfits?

The script you gave me increased distance but when I changed to my custom outfits or any outfit it goes away.

did I need to add "registerCreatureEvent(cid, "zzzz")" for all of the outfits before? into login.lua?
every action that you make on creaturescripts and is a login, death, look, etc function you have to register them in other to work...


Do I need to add this into creaturescripts and then into login for all my custom outfits?
I don´t know if I´m understanding what you are saying...
you have to add that code to the action file, the .lua file... This code has nothing to do with login.lua or creaturescripts.xml... If that is what you are asking...

The script you gave me increased distance but when I changed to my custom outfits or any outfit it goes away.
I really don't understand what you are saying...
Could you explain it a bit more for me please ?
I'm sorry....
 
[Error - Npc interface]
data/npc/scripts/outfiter.luanCreatureSay
Description:
<luaDoPlayerAddOutfit> Player not found


I just need to know why this happens? and if there is any other way besides the above /\ to add bonuses.
 
[Error - Npc interface]
data/npc/scripts/outfiter.luanCreatureSay
Description:
<luaDoPlayerAddOutfit> Player not found


I just need to know why this happens? and if there is any other way besides the above /\ to add bonuses.

I told you to remove it...
It is happening because you are using wavoz script..
Not that he script is wrong, but it wont work for the things you want to do... Use mine and you will be just fine
do not use:
Lua:
doPlayerAddOutfit(cid, xxx)


There might be a way.. But I can't think of any now...
What is wrong with doing it by the way I told you ?
Is there any problem ? Maybe I can help :)
 
when I do not include "doPlayerAddOutfit(cid, xxx)" The player does not get the outfit.

Here is my outfit.xml. Take a look.





<?xml version="1.0"?>
<outfits>
<outfit id="1">
<list gender="0" lookType="136" name="Citizen">
<attribute speed="5"/>
<stats maxHealth="100"/>
</list>
<list gender="1" lookType="128" name="Citizen">
<attribute speed="5"/>
<stats maxHealth="100"/>
</list>
</outfit>

<outfit id="2">
<list gender="0" lookType="137" name="Hunter">
<skills dist="3"/>
</list>
<list gender="1" lookType="129" name="Hunter">
<skills dist="3"/>
</list>
</outfit>

<outfit id="3">
<list gender="0" lookType="138" name="Mage">
<stats magLevel="2"/>
<stats maxMana="200"/>
</list>
<list gender="1" lookType="130" name="Mage">
<stats magLevel="2"/>
<stats maxMana="200"/>
</list>
</outfit>

<outfit id="4">
<list gender="0" lookType="139" name="Knight">
<skills sword="3"/>
</list>
<list gender="1" lookType="131" name="Knight">
<skills sword="3"/>
</list>
</outfit>

<outfit id="5" premium="no">
<list gender="0" lookType="141" name="Summoner">
<stats magLevel="2"/>
<stats maxMana="100"/>
</list>
<list gender="1" lookType="133" name="Summoner">
<stats magLevel="2"/>
<stats maxMana="100"/>
</list>
</outfit>

<outfit id="6" premium="no">
<list gender="0" lookType="142" name="Warrior">
<skills sword="3"/>
</list>
<list gender="1" lookType="134" name="Warrior">
<skills sword="3"/>
</list>
</outfit>

<outfit id="7" premium="no">
<list gender="0" lookType="147" name="Barbarian">
<skills axe="3"/>
</list>
<list gender="1" lookType="143" name="Barbarian">
<skills axe="3"/>
</list>
</outfit>

<outfit id="8" premium="no">
<list gender="0" lookType="148" name="Druid">
<stats magLevel="2"/>
</list>
<list gender="1" lookType="144" name="Druid">
<stats magLevel="2"/>
</list>
</outfit>

<outfit id="9" premium="no">
<list gender="0" lookType="149" name="Wizard">
<stats magLevel="1"/>
<stats maxMana="100"/>
</list>
<list gender="1" lookType="145" name="Wizard">
<stats magLevel="1"/>
<stats maxMana="100"/>
</list>
</outfit>

<outfit id="10" premium="no">
<list gender="0" lookType="150" name="Oriental">
<attribute speed="5"/>
<stats maxHealth="200"/>
<stats maxMana="200"/>
</list>
<list gender="1" lookType="146" name="Oriental">
<attribute speed="5"/>
<stats maxHealth="200"/>
<stats maxMana="200"/>
</list>
</outfit>

<outfit id="11" premium="no">
<list gender="0" lookType="155" name="Pirate">
<stats maxHealth="100"/>
<skills club="3"/>
</list>
<list gender="1" lookType="151" name="Pirate">
<stats maxHealth="100"/>
<skills club="3"/>
</list>
</outfit>

<outfit id="12" premium="no" >
<list gender="0" lookType="156" name="Assassin">
<attribute speed="5"/>
<skills dist="2"/>
</list>
<list gender="1" lookType="152" name="Assassin">
<attribute speed="5"/>
<skills dist="2"/>
</list>
</outfit>

<outfit id="13" premium="no" >
<list gender="0" lookType="157" name="Beggar">
<stats maxHealth="200"/>
</list>
<list gender="1" lookType="153" name="Beggar">
<stats maxHealth="200"/>
</list>
</outfit>

<outfit id="14" premium="no" >
<list gender="0" lookType="158" name="Shaman">
<stats magLevel="2"/>
</list>
<list gender="1" lookType="154" name="Shaman">
<stats magLevel="2"/>
</list>
</outfit>

<outfit id="15" premium="no" >
<list gender="0" lookType="269" name="Nightmare">
<skills shielding="8"/>
</list>
<list gender="1" lookType="268" name="Nightmare">
<skills shielding="8"/>
</list>
</outfit>

<outfit id="16" premium="no">
<list gender="0" lookType="270" name="Jester">
<stats maxMana="100"/>
<attribute speed="5"/>
<stats maxHealth="100"/>
</list>
<list gender="1" lookType="273" name="Jester">
<stats maxMana="100"/>
<attribute speed="5"/>
<stats maxHealth="100"/>
</list>
</outfit>

<outfit id="17" premium="yes" >
<list gender="0" lookType="279" name="Brotherhood">
<stats magLevel="2"/>
<stats maxHealth="300"/>
</list>
<list gender="1" lookType="278" name="Brotherhood">
<stats magLevel="2"/>
<stats maxHealth="300"/>
</list>
</outfit>

<outfit id="18" premium="yes" >
<list gender="0" lookType="288" name="Demonhunter">
<attribute speed="10"/>
<stats maxHealth="200"/>
</list>
<list gender="1" lookType="289" name="Demonhunter">
<attribute speed="10"/>
<stats maxHealth="200"/>
</list>
</outfit>

<outfit id="19" premium="yes">
<list gender="0" lookType="366" name="Wayfarer">
<attribute speed="15"/>
<skills dist="2"/>
</list>
<list gender="1" lookType="367" name="Wayfarer">
<attribute speed="15"/>
<skills dist="2"/>
</list>
</outfit>

<outfit id="20" quest="16438" premium="yes">
<list gender="0-3" lookType="73" name="Hero"/>
</outfit>

<outfit id="21" quest="16439" premium="yes">
<list gender="0" lookType="58" name="Exorcist">
<stats magLevel="2"/>
<stats maxMana="200"/>
</list>
<list gender="1" lookType="9" name="Nobody">
<stats magLevel="2"/>
<stats maxMana="200"/>
</list>
</outfit>

<outfit id="22" quest="16440" premium="yes">
<list gender="0-3" lookType="255" name="Berserker"/>
</outfit>

<outfit id="23" quest="16441" premium="yes">
<list gender="0" lookType="264" name="Brutetamer">
</list>
<list gender="1" lookType="253" name="Wildman">
</list>
</outfit>

<outfit id="24" quest="16442" premium="yes">
<list gender="0-3" lookType="254" name="Swordsman"/>
</outfit>

<outfit id="25" quest="16443" premium="yes">
<list gender="0-3" lookType="359" name="Dark Fury"/>
</outfit>
</outfits>
 
Last edited:
Back
Top