Ir para conteúdo

Featured Replies

Postado

BOM dia, Criei um tópico para que pudesse concluir um script aqui em casa.  Tentei desta maneira, Mais não consigo termina-lo, fazendo com que as conditions funcione em monstros.

Resumindo, é um script de bleed e conditions que funciona por ataque, eu ja completei ele bastante. Ja ta quase um mod, kkk,.

Queria saber se onStatsChange funciona em monstros porque, a compraracão isMonster(cid) parece nao fazer efeito. Ou oque está errado? Eu fiz um recorte para montar esse sistema, Peguei outros scripts já existentes como modelo, como o Experience Weapon system by whitewolf e cykotitan.  Testando em TFS 0.4, 9.83. 

 

 

Aqui vai o meu Script que não dá conditions em monstros:  

 

è um lua do creaturescripts.



local gelocondition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(gelocondition, CONDITION_PARAM_TICKS, 2000)   
setConditionFormula(gelocondition, -0.9, 0, -0.9, 0)  

local tera = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(tera, CONDITION_PARAM_TICKS, 4000)
setConditionParam(tera, CONDITION_PARAM_BUFF, true)
setConditionParam(tera, CONDITION_PARAM_SKILL_CLUBPERCENT, 80)
setConditionParam(tera, CONDITION_PARAM_SKILL_SWORDPERCENT, 80)
setConditionParam(tera, CONDITION_PARAM_SKILL_AXEPERCENT, 80)
setConditionParam(tera, CONDITION_PARAM_SKILL_DISTANCEPERCENT, 80)
setConditionParam(tera, CONDITION_PARAM_SKILL_DISTANCEPERCENT, 80)
setConditionParam(tera, CONDITION_PARAM_SKILL_SHIELDPERCENT, 80)


local manaup = createConditionObject(CONDITION_FOOD)
setConditionParam(manaup, CONDITION_PARAM_TICKS, 5000)
setConditionParam(manaup, CONDITION_PARAM_BUFF, true)
setConditionParam(manaup, CONDITION_PARAM_MANAGAIN, 15)
setConditionParam(manaup, CONDITION_PARAM_MANATICKS, 1000)

local healthup = createConditionObject(CONDITION_FOOD)
setConditionParam(healthup, CONDITION_PARAM_TICKS, 5000)
setConditionParam(healthup, CONDITION_PARAM_BUFF, true)
setConditionParam(healthup, CONDITION_PARAM_HEALTHGAIN, 5)
setConditionParam(healthup, CONDITION_PARAM_HEALTHTICKS, 1000)      
			
	local area = createCombatArea(
	{
	{0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0},
	{0, 0, 3, 0, 0},
	{0, 0, 0, 0, 0},
	{0, 0, 0, 0, 0}
	})
			


					
					local bleedaxe = createConditionObject(CONDITION_BLEEDING)
                    setConditionParam(bleedaxe, CONDITION_PARAM_DELAYED, 1)
                    local damageTable1 = {
                         {math.random(3), -(math.random(25))},
                         {math.random(3), -(math.random(15))},
                         {math.random(3), -(math.random(5))},
                          }
                    for i = 1, #damageTable1 do
                    local t = damageTable1[i]
                    addDamageCondition(bleedaxe, t[1], 1000, t[2])
                    end	
                    
					local bleeddistance = createConditionObject(CONDITION_BLEEDING)
                    setConditionParam(bleeddistance, CONDITION_PARAM_DELAYED, 1)
                    local damageTable2 = {
                         {math.random(3), -(math.random(30))},
                         {math.random(3), -(math.random(10))},
                         {math.random(3), -(math.random(15))},
                          }
                    for i = 1, #damageTable2 do
                    local t = damageTable2[i]
                    addDamageCondition(bleeddistance, t[1], 1000, t[2])
                    end

					local fire = createConditionObject(CONDITION_FIRE)
                    setConditionParam(fire, CONDITION_PARAM_DELAYED, 1)
                    local damageTable3 = {
                         {math.random(3), -(math.random(30))},
                         {math.random(3), -(math.random(10))},
                         {math.random(3), -(math.random(15))},
                          }
                    for i = 1, #damageTable3 do
                    local t = damageTable3[i]
                    addDamageCondition(fire, t[1], 1000, t[2])
                    end											
	                
					local teradamage = createConditionObject(CONDITION_POISON)
                    setConditionParam(teradamage, CONDITION_PARAM_DELAYED, 1)
                    local damageTable4 = {
                         {1, -(math.random(9))},
                         {2, -(math.random(9))},
                         {1, -(math.random(9))},
                          }
                    for i = 1, #damageTable4 do
                    local t = damageTable4[i]
                    addDamageCondition(teradamage, t[1], 1000, t[2])
                    end	

                    local holydamage = createConditionObject(CONDITION_DAZZLED)
                    setConditionParam(holydamage, CONDITION_PARAM_DELAYED, 1)
                    local damageTable5 = {
                         {math.random(3, 13), -(math.random(2))},
                         {math.random(7, 20), -(math.random(3))},
                         {math.random(9, 27), -(math.random(4))},
                          }
                    for i = 1, #damageTable5 do
                    local t = damageTable5[i]
                    addDamageCondition(holydamage, t[1], 4000, t[2])
                    end

                    local deathdamage = createConditionObject(CONDITION_CURSED)
                    setConditionParam(deathdamage, CONDITION_PARAM_DELAYED, 1)
                    local damageTable6 = {
                         {1, -(math.random(2))},
                         {1, -(math.random(12))},
                         {1, -(math.random(26))},
						 {1, -(math.random(28))},
						 {1, -(math.random(14))},
                          }
                    for i = 1, #damageTable6 do
                    local t = damageTable6[i]
                    addDamageCondition(deathdamage, t[1], 5000, t[2])
                    end	

                    local gelo = createConditionObject(CONDITION_FREEZING)
                    setConditionParam(gelo, CONDITION_PARAM_DELAYED, 1)
                    local damageTable7 = {
                         {1, -(math.random(6))},
                         {1, -(math.random(4))},
                         {1, -(math.random(3))},
						 {1, -(math.random(2))},
                          }
                    for i = 1, #damageTable7 do
                    local t = damageTable7[i]
                    addDamageCondition(gelo, t[1], 10000, t[2])
                    end	
                    
					local monster = createConditionObject(CONDITION_BLEEDING)
                    setConditionParam(monster, CONDITION_PARAM_DELAYED, 1)
                    local damageTable8 = {
                         {1, -(math.random(2))},
                         {1, -(math.random(2))},
                         {1, -(math.random(1))},
						 {1, -(math.random(1))},
                          }
                    for i = 1, #damageTable8 do
                    local t = damageTable8[i]
                    addDamageCondition(monster, t[1], 1000, t[2])
                    end	
					
					local monstersmall = createConditionObject(CONDITION_BLEEDING)
                    setConditionParam(monstersmall, CONDITION_PARAM_DELAYED, 1)
                    local damageTable9 = {
                         {1, -(math.random(16))},
                         {1, -(math.random(14))},
                         {1, -(math.random(13))},
						 {1, -(math.random(12))},
                          }
                    for i = 1, #damageTable9 do
                    local t = damageTable9[i]
                    addDamageCondition(monstersmall, t[1], 1000, t[2])
                    end	
					
					local monsteremedium = createConditionObject(CONDITION_BLEEDING)
                    setConditionParam(monsteremedium, CONDITION_PARAM_DELAYED, 1)
                    local damageTable10 = {
                         {1, -(math.random(40, 66))},
                         {1, -(math.random(30, 44))},
                         {1, -(math.random(10, 23))},
						 {1, -(math.random(5, 18))},
                          }
                    for i = 1, #damageTable10 do
                    local t = damageTable10[i]
                    addDamageCondition(monsteremedium, t[1], 1000, t[2])
                    end	
					
					local monsterbig = createConditionObject(CONDITION_BLEEDING)
                    setConditionParam(monsterbig, CONDITION_PARAM_DELAYED, 1)
                    local damageTable11 = {
                         {1, -(math.random(60, 106))},
                         {1, -(math.random(50, 94))},
                         {1, -(math.random(40, 70))},
						 {1, -(math.random(30, 60))},
                          }
                    for i = 1, #damageTable11 do
                    local t = damageTable11[i]
                    addDamageCondition(monsterbig, t[1], 1000, t[2])
                    end	
					
					local monsterbigger = createConditionObject(CONDITION_BLEEDING)
                    setConditionParam(monsterbigger, CONDITION_PARAM_DELAYED, 1)
                    local damageTable12 = {
                         {1, -(math.random(120, 190))},
                         {1, -(math.random(100, 170))},
                         {1, -(math.random(80, 140))},
						 {1, -(math.random(60, 120))},
						 {1, -(math.random(40, 100))},
                          }
                    for i = 1, #damageTable12 do
                    local t = damageTable12[i]
                    addDamageCondition(monsterbigger, t[1], 1000, t[2])
                    end	
					
					local fire2 = createConditionObject(CONDITION_FIRE)
                    setConditionParam(fire2, CONDITION_PARAM_DELAYED, 1)
                    local damageTable13 = {
                         {math.random(3), -(math.random(30, 45))},
                         {math.random(3), -(math.random(10, 34))},
                         {math.random(3), -(math.random(15, 45))},
                          }
                    for i = 1, #damageTable13 do
                    local t = damageTable13[i]
                    addDamageCondition(fire2, t[1], 1000, t[2])
                    end
					
					local fire3 = createConditionObject(CONDITION_FIRE)
                    setConditionParam(fire3, CONDITION_PARAM_DELAYED, 1)
                    local damageTable14 = {
                         {math.random(3), -(math.random(40, 60))},
                         {math.random(3), -(math.random(50, 60))},
                         {math.random(3), -(math.random(65, 75))},
                          }
                    for i = 1, #damageTable14 do
                    local t = damageTable14[i]
                    addDamageCondition(fire3, t[1], 1000, t[2])
                    end		



function onStatsChange(cid, attacker, type, combat, value)
   if type == STATSCHANGE_HEALTHLOSS then  
    
	    if isPlayer(attacker) and isPlayer(cid) then
		    if combat ==  COMBAT_PHYSICALDAMAGE then
			
			  if getWeapon(attacker) ~= false and getCreatureStorage(cid, 65) == -1 and math.random(100) < (91) and value >= 40 then
			    local f = getItemWeaponType((getWeapon(attacker)).uid)
			    if (f == 1 or f == 3) then			       	  				    		
																				
					doCreatureSetStorage(cid, 65, 1)
			        doTargetCombatCondition(cid, bleedaxe, 255) 
				    doCreatureSetStorage(cid, 65, -1)	
			    
				
				elseif f == 4 and getDistanceBetween(getThingPos(cid), getThingPos(attacker)) >= 2 then
				    local distance = getDistanceBetween(getThingPos(cid), getThingPos(attacker))
					doCreatureSetStorage(cid, 65, 1)
			        doTargetCombatCondition(cid, bleeddistance, 255) 
				    doCreatureSetStorage(cid, 65, -1)					
			         				
				
				elseif f == 2 then
			        damage = getItemInfo((getWeapon(attacker)).itemid).attack
					doAreaCombatHealth(cid, COMBAT_PHYSICALDAMAGE, getThingPos(cid), area, -2*(tonumber(damage)), -4*(tonumber(damage)), 34)
			
			
			    end
			  end
			end 
			 
			if combat == COMBAT_FIREDAMAGE then 
			
		      if getCreatureStorage(cid, 66) == -1 and math.random(100) < (100) then
			        if value <= 150 then
				        doCreatureSetStorage(cid, 66, 1)
			            doTargetCombatCondition(cid, fire, 255)
			            doCreatureSetStorage(cid, 66, -1)
				    end
					if value > 150 and value <= 400 then
					    doCreatureSetStorage(cid, 66, 1)
			            doTargetCombatCondition(cid, fire2, 255)
			            doCreatureSetStorage(cid, 66, -1)
				    end
					if value > 400 then
					    doCreatureSetStorage(cid, 66, 1)
			            doTargetCombatCondition(cid, fire3, 255)
			            doCreatureSetStorage(cid, 66, -1)
				    end
				
				 
		      end
			end
			
			
			if combat == COMBAT_ENERGYDAMAGE then			   
			 
			   if getCreatureStorage(cid, 67) == -1 and math.random(100) < (101) and value >= 30 then
			      
				   function onGetFormulaValues(cid, level, maglevel)
	               local min = -((maglevel*1.4)+8)
	               local max = -(((level/12)+(maglevel*1.7))+13)
	               return min, max
                   end				   
				   
				   doCreatureSetStorage(cid, 67, 1)
				   doAddCondition(attacker, manaup)
				   doTargetCombatMana(atacker, cid, -(min), -(max), 1)
				   doCreatureSetStorage(cid, 67, -1)
				       for i = 1, 5 do
					   addEvent(function()
						if isCreature(attacker) then
						doSendMagicEffect(getThingPos(attacker), 12)
						end
					   end, 1 + (1000*i))
					  end 
			
			
			


			   end
			end
	    
	
	    
            if combat == COMBAT_EARTHDAMAGE  then
                
				if getCreatureStorage(cid, 68) == -1 and math.random(100) < (101) and value >= 10 then			
		            doCreatureSetStorage(cid, 68, 1)
					doTargetCombatCondition(cid, teradamage, 255)
					doAddCondition(cid, tera)
					doCreatureSetStorage(cid, 68, -1)
		        
				
				
				
				
				end
		    
								
			end
		
		    
			
			if combat == COMBAT_HOLYDAMAGE then 
		         
		        if getCreatureStorage(cid, 69) == -1 and math.random(100) < (101) and value >= 10 then
		            doCreatureSetStorage(cid, 69, 1)
					doTargetCombatCondition(cid, holydamage, 255)
					doCreatureSetStorage(cid, 69, -1)
		
		
		        
				end
		    
			end
		
		
		   
		   
		    if combat == COMBAT_DEATHDAMAGE then
			   
		        
		        if getCreatureStorage(cid, 70) == -1 and math.random(100) < (101) and value >= 10 then   
		            
					doCreatureSetStorage(cid, 70, 1)
		            doAddCondition(attacker, healthup)
				    doTargetCombatCondition(cid, deathdamage, 255)
				    doCreatureSetStorage(cid, 70, -1)
				       for i = 1, 5 do
					   addEvent(function()
						if isCreature(attacker) then
						doSendMagicEffect(getThingPos(attacker), 12)
						end
					   end, 1 + (1000*i))
					  end 
		    
			
			
			
			    
				
				
				end
			
			end


            if combat == COMBAT_ICEDAMAGE then

                if getCreatureStorage(cid, 71) == -1 and math.random(100) < (100) and value >= 10 then   
			
			        doCreatureSetStorage(cid, 71, 1)
					doAddCondition(cid, gelocondition)
					doTargetCombatCondition(cid, gelo, 255)
			        doCreatureSetStorage(cid, 71, -1)
			
			    
			
			
			    end
			
			end
		
		
		
		
		
		
		
		
		end
	    
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		if isMonster(attacker) and isPlayer(cid) then
	        if combat == COMBAT_PHYSICALDAMAGE then 
			  if math.random(100) < (90) and value >= 40 then
	             local mdmg = getCreatureMaxHealth(attacker)                   
					if mdmg > 20 and mdmg <= 50 and getCreatureStorage(cid, 72) == -1 then
				  
				  doCreatureSetStorage(cid, 72, 1)				 
				  doTargetCombatCondition(cid, monster, 255)
			      doCreatureSetStorage(cid, 72, -1)
	                end
	                
					if mdmg > 50 and mdmg <= 400 and getCreatureStorage(cid, 73) == -1 then
                  doCreatureSetStorage(cid, 73, 1)				 
				  doTargetCombatCondition(cid, monstersmall, 255)
			      doCreatureSetStorage(cid, 73, -1)
                    end
					
					if mdmg > 400 and mdmg <= 800 and getCreatureStorage(cid, 74) == -1 then
                  doCreatureSetStorage(cid, 74, 1)				 
				  doTargetCombatCondition(cid, monstermedium, 255)
			      doCreatureSetStorage(cid, 74, -1)
                    end

                   if mdmg > 800 and mdmg <= 1200 and getCreatureStorage(cid, 75) == -1 then
                  doCreatureSetStorage(cid, 75, 1)				 
				  doTargetCombatCondition(cid, monsterbig, 255)
			      doCreatureSetStorage(cid, 75, -1)
                    end
					
					 if mdmg > 1200 and getCreatureStorage(cid, 76) == -1 then
                  doCreatureSetStorage(cid, 76, 1)				 
				  doTargetCombatCondition(cid, monsterbigger, 255)
			      doCreatureSetStorage(cid, 76, -1)
                    end
				
	          end
			end
	    
		
		    if combat == COMBAT_FIREDAMAGE then
			    
				if getCreatureStorage(cid, 77) == -1 and math.random(100) < (100) then
		            if value < 150 then
					    doCreatureSetStorage(cid, 77, 1)				 
				        doTargetCombatCondition(cid, fire, 255)
			            doCreatureSetStorage(cid, 77, -1)
		            end
		            if value > 150 and value <= 400 then
					    doCreatureSetStorage(cid, 77, 1)
			            doTargetCombatCondition(cid, fire2, 255)
			            doCreatureSetStorage(cid, 77, -1)
				    end		            					
					if value > 400 then
					    doCreatureSetStorage(cid, 77, 1)
			            doTargetCombatCondition(cid, fire3, 255)
			            doCreatureSetStorage(cid, 77, -1)
				    end
		        
				
				end
		
		
		
		
		
		    end
		
		    if combat == COMBAT_ENERGYDAMAGE then
		    
			    if getCreatureStorage(cid, 78) == -1 and math.random(100) < (100) and value >= 30 then
		            
				    doCreatureSetStorage(cid, 78, 1)				
				    doTargetCombatMana(atacker, cid, -(math.random(10, 40)), -(math.random(40,90)), 1)
				    doCreatureSetStorage(cid, 78, -1)
				
				
				end
			
		    
			
			
			
			end
		
		    if combat == COMBAT_EARTHDAMAGE then
		
		        if getCreatureStorage(cid, 79) == -1 and math.random(100) < (100) and value >= 20 then
		            
					doCreatureSetStorage(cid, 79, 1)
					doTargetCombatCondition(cid, teradamage, 255)
					doAddCondition(cid, tera)
					doCreatureSetStorage(cid, 79, -1)
		
		
		        end
		
						
		    end
		
		    if combat == COMBAT_HOLYDAMAGE then
		        
				if getCreatureStorage(cid, 80) == -1 and math.random(100) < (100) and value >= 10 then
		    
		            doCreatureSetStorage(cid, 80, 1)
					doTargetCombatCondition(cid, holydamage, 255)
					doCreatureSetStorage(cid, 80, -1)
		
		
			    end
		
		    
			
			end
		
		
		
	        if combat == COMBAT_DEATHDAMAGE then
		
		
		        if getCreatureStorage(cid, 81) == -1 and math.random(100) < (100) and value >= 10 then
		            
					doCreatureSetStorage(cid, 81, 1)		           
				    doTargetCombatCondition(cid, deathdamage, 255)
				    doCreatureSetStorage(cid, 81, -1)
				       
		
		
		        
				
				
				end
			end
		
		
		
		end
	    
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
    
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	end
return true
end

E não dá nenhum erro na distro.

 

Obrigado Pela atenção. E estou a Espera se Alguém tiver interesse em ajudar.

 

EDIT 19/12:

 

Não consegui ainda fazer com que desse conditions em monstros ou players nesse script com a função onStatsChange. Quem tiver alguma opinião de como fazer para complementar para esse fim. fica a vontade para incrementar o tópico. Ele ta bem grande, mais acho que oque vale é a função. 

 

EDIT 26/12:

 

É parece que a função de Statschange, não reconhece a vida dos monstros né isso? mais como faço para que esse script se estenda também a monstros, Alguém tem solução? 

Atualmente ele funciona em PVP contra players e quando um monstro ataca, mais só. Abraços e cometem. E também se for possível, e não trabalhoso como faço para diminuir o script?  

 

Editado por lucasvtr1
Eu Procurei editar aqui em casa e consegui funcionar nos players. Mas ainda não funciona nos monstros. (veja o histórico de edições)

Postado

Esta é uma mensagem automática! Este tópico foi movido para a área correta.
Pedimos que você leia as regras do fórum.

Spoiler

This is an automated message! This topic has been moved to the correct area.
Please read the forum rules.

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo