FA

[Pokemon] Summon Attack

Por Faisher, 13 de dez. de 2010 em Globalevents e Spells

script
5
2.9k
FaisherF
13 de dezembro de 2010 às 19:04

When monsters appears then go attack to player but with this system you have no errors.

Go to creaturescripts/scripts/ create a lua file called attackpokemon.lua and put this:

function onStatsChange(cid, attacker, type, combat, value)
local s = getCreatureSummons(cid)
if type == STATSCHANGE_HEALTHLOSS then	
if isMonster(attacker) then
	if #s == 1 then
	doMonsterSetTarget(attacker, s[1])
	doCreatureAddHealth(cid, value)
	end
end
end
return true
end

 

Creaturescripts.xml

<event type="statschange" name="AttackPokemon" event="script" value="name.lua"/>

 

 

Now go to login.lua and put:

 

registerCreatureEvent(cid, "AttackPokemon")

 

 

 

Bye bye :D

1391
13 de dezembro de 2010 às 19:13

If I understood with this system when a wild pokemon appears it wouldn't attack the trainer.

Only the trainer's pokemon right ?

FaisherF
13 de dezembro de 2010 às 19:32

Yes.

brun123B
13 de dezembro de 2010 às 20:07

The attacked pokemon (wild) will only change target after it loses some life, because you used the function onStatsChange.

Try making it with onAttack / onCombat, and it will change once you click to attack it.

FaisherF
14 de dezembro de 2010 às 04:06

Is the same, if you loose hp, you will be healed.