[NPC]Trener
Strona 1 z 1
[NPC]Trener
Witam.
Chciałbym wam przedstawić skrypt, dzięki któremu będzie można urozmaicić swój serwer pokemon o trenerów pokemonów.
Instalacja:
1. Wchodzimy w data/npc i tworzymy plik o nazwie.xml i wklejamy to:
2. Następnie wchodzimy w data/npc/scripts i tworzymy plik odpowiadający skryptowni XML w tym przypadku Blastoise trainer.lua i wklejamy to:
3. Wchodzimy w data/monsters i tworzymy plik blastoise trainer.xml i wklejamy to:
4. W monsters.xml dodajemy linijkę:
I cieszymy się NPC'kiem z którym możemy walczyć.
Pozdrawiam.
Chciałbym wam przedstawić skrypt, dzięki któremu będzie można urozmaicić swój serwer pokemon o trenerów pokemonów.
Instalacja:
1. Wchodzimy w data/npc i tworzymy plik o nazwie.xml i wklejamy to:
- Kod:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Blastoise trainer" script="data/npc/scripts/Blastoise trainer.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="138" head="96" body="95" legs="0" feet="95" addons="0"/>
<parameters>
<parameter key="message_greet" value="Hi |PLAYERNAME|, do you want to test your habilities?" />
<parameter key="module_keywords" value="1" />
</parameters>
</npc>
2. Następnie wchodzimy w data/npc/scripts i tworzymy plik odpowiadający skryptowni XML w tym przypadku Blastoise trainer.lua i wklejamy to:
- Kod:
local nomeMonst = "Trainer's Blastoise"
local itemid = 7885
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
if getPlayerStorageValue(cid, 9755) == -1 then
if(msgcontains(msg, 'yes')) then
selfSay('Kill this pokemon to complete your task!', cid)
doCreateMonster(nomeMonst,getThingPos(cid))
talkState[talkUser] = 1
end
return true
end
if getPlayerStorageValue(cid, 9755) == 1 then
selfSay('Congrats bro, here is your prize.', cid)
doPlayerAddItem(cid, itemid,1)
setPlayerStorageValue(cid, 9755,2)
talkState[talkUser] = 0
return true
end
if getPlayerStorageValue(cid, 9755) == 2 then
selfSay('You already realized this task.', cid)
talkState[talkUser] = 0
return true
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
3. Wchodzimy w data/monsters i tworzymy plik blastoise trainer.xml i wklejamy to:
- Kod:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Trainer's Blastoise" nameDescription="a Blastoise" race="undead" experience="0" speed="280" manacost="0">
<health now="10000" max="10000"/>
<look type="55" head="0" body="0" legs="0" feet="0" corpse="5999"/>
<targetchange interval="1000" chance="1000"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="0"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="100"/>
<flag runonhealth="1"/>
</flags>
<attacks>
<attack name="melee" interval="2000" skill="60" attack="70"/>
<attack name="auraagua" interval="2000" chance="20" min="-1600" max="-2000"> </attack>
</attacks>
<defenses armor="50" defense="50">
<defense name="speed" interval="1000" chance="7" speedchange="320" duration="4000">
<attribute key="areaEffect" value="redshimmer"/>
</defense>
</defenses>
<voices interval="2000" chance="10">
<voice sentence="BLASTOISE!"/>
<voice sentence="TOISE!"/>
</voices>
<loot>
</loot>
</monster>
4. W monsters.xml dodajemy linijkę:
- Kod:
<monster name="Trainer's Blastoise" file="trainersblastoise.xml"/>
I cieszymy się NPC'kiem z którym możemy walczyć.
Pozdrawiam.
Strona 1 z 1
Permissions in this forum:
Nie możesz odpowiadać w tematach
|
|