XenoBot Forums - Powered by vBulletin

User Tag List

Results 1 to 7 of 7

Thread: Help on this sio/mas res script

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7

    Join Date
    Jun 2012
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pixie_frigo View Post
    hehe you're welcome
    But on things like this I would use in ipairs then you can't make small annoying mistakes like that ^^ Just tips !
    But looks better then my scripts a few months back haha
    thanks for the tips dude, I'm still trying to wrap my head around ipars, but i'll try to use them anyway.

    Offtopic: do you think anyone would be interested in a directional spell script i made? the code is even worse than this one, but it works pretty well. (I also got lazy and didn't implement aoe runes or single target spells, but that should be easy enough), or do you guys mind taking a look at it?



    EDIT: Here it is anyway.

    Code:
    --Pacman's shitty area spell caster thingamajig
    spell = {}
    area = {}
    
    
    
    --CONFIG
    spell[1] = {words = "exevo frigo hur",
    			manacost = 25,
    			area = {{0,0,0,1},
    					{0,1,1,1},
    					{1,1,1,1},
    					{0,1,1,1},
    					{0,0,0,1}},
    			creaturecount = 2}
    			
    spell[2] = {words = "exevo gran frigo hur",
    			manacost = 170,
    			area = {{0,1,1},
    					{1,1,1},
    					{0,1,1}},
    			creaturecount = 1}			
    
    
    
    		
    		
    --initializing shit (i'm too shit at lua to know how to do this for sure inside the script :C)
    e = 0
    n = 0
    s = 0
    w = 0
    largest = 0	  
    
    print("Pacman's shit directional spell caster thingamajig")
    
    function inarea(posc, sn)
    	sarea = spell[sn].area
    	compensatey = math.ceil((#sarea/2))
    	for y =1, #sarea do
    		for x=1, #sarea[1] do
    			if sarea[y][x] > 0 then
    				correctedy = y - compensatey
    				if posc.x == Self.Position().x + x and posc.y == Self.Position().y + correctedy then
    					e = e  + sarea[y][x]
    				end
    				if posc.x == Self.Position().x - x and posc.y == Self.Position().y + correctedy then
    					w = w + sarea[y][x]
    				end
    				if posc.x == Self.Position().x + correctedy and posc.y == Self.Position().y + x then
    					s = s + sarea[y][x]
    				end
    				if posc.x == Self.Position().x + correctedy and posc.y == Self.Position().y - x then
    					n = n + sarea[y][x]
    				end				
    			end
    		end
    	end
    end
    
    	
    		
    function findtargets(sn)
    	local creatures = Self.GetSpectators(false)
    	for i = 1, #creatures do
    		local cre = creatures[i]
    		if cre:isMonster() then
    			local crepos = cre:Position()
    			inarea(cre:Position(), sn)
    		end
    	end
    	largest = e
    	dir = "east"
    	if largest < s then
    		largest = s
    		dir = "south"
    	end
    	if largest < w then
    		largest = w
    		dir = "west"
    	end
    	if largest < n then
    		largest = n
    		dir = "north"
    	end
    	scount = spell[sn].creaturecount
    	swords = spell[sn].words
    	if largest >= scount and Self.CanCastSpell(swords) then
    		castaspell = true
    	end
    	e = 0
    	n = 0
    	s = 0
    	w = 0
    	largest = 0
    end
    					
    
    
    while true do
    	for sn = 1, #spell do
    		findtargets(sn)
    		if castaspell then
    			Walker.Delay(1200)
    			setTargetingEnabled(false)
    			wait(200, 300)
    			Self.Turn(dir)
    			wait(300, 400)
    			Self.Cast(spell[sn].words, spell[sn].manacost)
    			wait(300, 400)
    			setTargetingEnabled(true)
    			wait(1600, 1900)
    			castaspell = false
    		end
    		wait(200, 400)
    	end
    end
    Last edited by Slayer2k91; 06-26-2013 at 09:17 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •