What's new

Skrypty & Kody First items

Status
Not open for further replies.

skorapro

Advanced User
Joined
Jul 3, 2011
Messages
492
Reaction score
30
w folderze mods mam plik fistitems.xml
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
	<config name="firstitems_config"><![CDATA[
		config = {
			storage = 30001,
			items = {2050, 2382}
		}
	]]></config>
	<event type="login" name="FirstItems" event="buffer"><![CDATA[
		domodlib('firstitems_config')
		if(getPlayerStorageValue(cid, config.storage) > 0) then
			return
		end

		for _, id in ipairs(config.items) do
			doPlayerAddItem(cid, id, 1)
		end

		if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then
			doPlayerAddItem(cid, 2651, 1)
		else
			doPlayerAddItem(cid, 2650, 1)
		end

		doAddContainerItem(doPlayerAddItem(cid, 1987, 1), 2674, 1)
		setPlayerStorageValue(cid, config.storage, 1)
	]]></event>
</mod>
jak go przerobi? ?eby dawa?
steel helmet
plate armor
plate legs
steel shield
i backpack a w nim:
jagged sword
steel axe
daramanian mace
snakebite rod
wand of vortex
10x crystal coins
crossbow
100x bolt
 

Eturl

We shall know no fear!
Joined
May 21, 2008
Messages
2,280
Reaction score
463
Age
32
Odp: First items

Po co bawi? si? edycj? tego pliku? Nie pro?ciej da? te itemki na postacie typu sample, bo ich wyposa?enie jest tak?e kopiowane przy zak?adaniu nowej postaci ;p
 

skorapro

Advanced User
Joined
Jul 3, 2011
Messages
492
Reaction score
30
Odp: First items

yy a gdzie jest taka posta? bo w bazie jej nie widze xD
 

GodOts

Advanced User
Joined
Oct 15, 2012
Messages
271
Reaction score
4
Odp: First items

je?eli wgra?e? acc makera, powinny by? postacie sample, typu :

Druid Sample
Sorcerer Sample
Paladin Sample
Knight Sample
Rook Sample
 

GodOts

Advanced User
Joined
Oct 15, 2012
Messages
271
Reaction score
4
Odp: First items

Ok, dobra, podaj id tych item?w
 

skorapro

Advanced User
Joined
Jul 3, 2011
Messages
492
Reaction score
30
Odp: First items

steel helmet (2457)
plate armor (2463)
plate legs (2647)
steel shield (2509)
i backpack(1988) a w nim:
jagged sword (8602)
steel axe (8601)
daramanian mace (2439)
snakebite rod (2182)
wand of vortex (2190)
10x crystal coins (2160)
crossbow (2455)
100x bolt (2543)
 

Cybulex

User
Joined
Nov 1, 2011
Messages
44
Reaction score
4
Odp: First items

[lua]<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
<config name="firstitems_config"><![CDATA[
config = {
storage = 30001,
items = {2457, 2463, 2647, 2643}

}
]]></config>
<event type="login" name="FirstItems" event="script"><![CDATA[
domodlib('firstitems_config')

function onLogin(cid)


if(getPlayerStorageValue(cid, config.storage) > 0) then
return true
end

---
local PlayerVoc = getPlayerVocation(cid)
local container = doPlayerAddItem(cid, 1988)
---

if(PlayerVoc == 1) then
doPlayerAddItem(cid, 2190, 1)
doPlayerAddItem(cid, 2509, 1)
doPlayerAddItem(cid, 2160, 10)
elseif(PlayerVoc == 2) then
doPlayerAddItem(cid, 2182, 1)
doPlayerAddItem(cid, 2509, 1)
doPlayerAddItem(cid, 2160, 10)
elseif(PlayerVoc == 3) then
doPlayerAddItem(cid, 2455, 1)
doAddContainerItem(container, 2160, 10)
doAddContainerItem(container, 2389, 5)
doPlayerAddItem(cid, 2543, 100)
elseif(PlayerVoc == 4) then
doPlayerAddItem(cid, 8602, 1)
doPlayerAddItem(cid, 2509, 1)
doPlayerAddItem(cid, 2160, 10)
doAddContainerItem(container, 8601, 1)
doAddContainerItem(container, 2439, 1)
end

for _, id in ipairs(config.items) do
doPlayerAddItem(cid, id, 1)
end

setPlayerStorageValue(cid, config.storage, 1)
return true
end
]]></event>
</mod>
[/lua]

Skrypt dodaje ci rzeczy, kt?re wymieni?e?. Dodaje tak?e ka?dej profesji leather boots (2643) oraz paladynowi 5 sper?w (2389).
Gracz otrzymuje to w estetyczny spos?b, czyli, ?e wszystkie rzeczy s? tam, gdzie powinny by? (nie ma np. but?w w r?ku lub spodni).
 
Last edited:

skorapro

Advanced User
Joined
Jul 3, 2011
Messages
492
Reaction score
30
Odp: First items

wyskoczy? b??d w konsoli:
Loading firstitems.xml...[Error - ScriptManager::loadFromXml] Cannot load mod firstitems.xml
Line: 2, Info: XML declaration allowed only at the start document

failed!
 

Cybulex

User
Joined
Nov 1, 2011
Messages
44
Reaction score
4
Odp: First items

Usu? pust? linijk? na samej g?rze. Pewnie przekopiowa?e? jak leci...
@edit:
Poprawione.
 

skorapro

Advanced User
Joined
Jul 3, 2011
Messages
492
Reaction score
30
Odp: First items

no faktycznie to przez t? linijk? :)
wszystko dzia?a elegancko, leci repucik ;)
 
Status
Not open for further replies.
Top