Jump to content

Welcome to Gaming On Steroids Forums
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account
Photo

Object in OnCreateObj can not use in CastTargetSpell

OnCreateObj CastTargetSpell

  • Please log in to reply
11 replies to this topic

#1
ilovesona

ilovesona

    Sona's wife

  • Contributor
  • 1,096 posts
OnCreateObj(function(Object)
  if IsInDistance(600, GetOrigin(Object)) then
    PrintChat(string.format("<font color='#00ff00'>CreatedObject = %s</font>",GetObjectBaseName(Object)));
    CastTargetSpell(Object, _E)
  end
end)

I use kata with this script, I want cast E when I put a ward.

 

This code print my ward to chat well, but not cast E at all.

 

Wf4WE70.png


Edited by ilovesona, 25 August 2015 - 06:01 .

  • 0

#2
Deftsu

Deftsu

    donthackourgames

  • Ex-Core Dev
  • PipPipPip
  • 4,812 posts
OnCreateObj(function(Object)
  if IsInDistance(600, GetOrigin(Object)) then
    PrintChat(string.format("<font color='#00ff00'>CreatedObject = %s</font>",GetObjectBaseName(Object)));
    CastTargetSpell(Object, _E)
  end
end)

I use kata with this script, I want cast E when I put a ward.

 

This code print my ward to chat well, but not cast E at all.

 

Wf4WE70.png

 

test without Print ^^


  • 0

#3
ilovesona

ilovesona

    Sona's wife

  • Contributor
  • 1,096 posts

test without Print ^^

have you tried it?

 

same result here.... :fappa:


  • 0

#4
Deftsu

Deftsu

    donthackourgames

  • Ex-Core Dev
  • PipPipPip
  • 4,812 posts

have you tried it?

 

same result here.... :fappa:

i tried with draven Q and nothing :S


  • 0

#5
ilovesona

ilovesona

    Sona's wife

  • Contributor
  • 1,096 posts

i tried with draven Q and nothing :S

draven Q is not targetable object :fappa:


  • 0

#6
Outbreak

Outbreak

    Advanced Member

  • Members
  • 48 posts

As i said in SB you can't cast spells too fast otherwise it may or not cast. I've fixed it by adding a small delay to cast and also checking for the right object.

require('Inspired')


local myHero = GetMyHero()

OnCreateObj(function(Object) 
	local name = GetObjectBaseName(Object):lower()
	if name == "yellowtrinket" or name == "sightward" or name == "visionward" then		
		if CanUseSpell(myHero,_E) == READY then						
			DelayAction(
				function()					
					CastTargetSpell(Object, _E)
				end,
			200)
		end
	end
end)

  • 1

#7
Deftsu

Deftsu

    donthackourgames

  • Ex-Core Dev
  • PipPipPip
  • 4,812 posts

draven Q is not targetable object :fappa:

MoveToXYZ didn't work :fappa:


  • 0

#8
ilovesona

ilovesona

    Sona's wife

  • Contributor
  • 1,096 posts

MoveToXYZ didn't work :fappa:

not test yet, but as you see, I can get the obj pos, I think it work.....


  • 0

#9
Deftsu

Deftsu

    donthackourgames

  • Ex-Core Dev
  • PipPipPip
  • 4,812 posts

OnCreateObj(function(Object)
    local name = GetObjectBaseName(Object):lower()
    if name == "draven_base_q_reticle_self.troy" then                
            DelayAction(
                function()                    
                    MoveToXYZ(Object.x, Object.y, Object.z)
                end,
            200)
        end
    end
end)

 

tried GetOrigin(Object) for the Move still the same :S


  • 0

#10
Cloud

Cloud

    KAPPA

  • Ex-Staff
  • PipPipPip
  • 1,498 posts
OnCreateObj(function(Object)
    local name = GetObjectBaseName(Object):lower()
    if name == "draven_base_q_reticle_self.troy" then                
            DelayAction(
                function()                    
                    MoveToXYZ(Object.x, Object.y, Object.z)
                end,
            200)
        end
    end
end)

tried GetOrigin(Object) for the Move still the same :S

 

I tried yesterday and it did not work. (2hours of trying before rage kicked in and made me delete the file.)


  • 0

#11
Feretorix

Feretorix

    Administrator

  • Administrators
  • 3,141 posts
You should stop trying to move/cast in OnCreateObj event!

This event is only used to "store" in array objects which were recently created.

With that table array "store" you should check it "OnLoop" if you got the object you wished for or not and then move to it, cast spells to it or do whatever you wish for!
  • 0

#12
ilovesona

ilovesona

    Sona's wife

  • Contributor
  • 1,096 posts

You should stop trying to move/cast in OnCreateObj event!

This event is only used to "store" in array objects which were recently created.

With that table array "store" you should check it "OnLoop" if you got the object you wished for or not and then move to it, cast spells to it or do whatever you wish for!

ok, so the best way is save all valid object, and check it in OnLoop.

 

The problem is what column should we check, I currently use IsVisible and work well.

 

check my ward jump script for detail

http://gamingonstero...mple-ward-jump/

 

 

But I think we need a more reliable way to check object is "created" or even a new api OnObjectCreated.


Edited by ilovesona, 27 August 2015 - 04:33 .

  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users