Login  Register
 



Post new topicReply to topic
 
Author Message
 PostPosted: 21 Apr, 2012 
 

Joined: 31 Mar, 2011
Posts: 128
Location: Hanoi, Vietnam
Offline
Hi all, my question is how to order a attached unit attack a enemy by script. It look like
Code:
IssueAttack({self}, enemy)

I tried above but there was nothing happened.


Top
 Profile  
 PostPosted: 21 Apr, 2012 
 

Joined: 26 Feb, 2009
Posts: 2996
Offline
you have to store handles to the attached units...

like self.AttachedUnits = { unit1 = attachedunit1, unit2 = attachedunit2 }

you then use that to get the handle to the unit like

IssueAttack({self.AttachedUnits.unit1}, target)

self in your senario is the unit that all the others are attached to.. IE the base unit.
you dont want that unit you want the attached units... :)

_________________
Domino.
______________


Top
 Profile  
 PostPosted: 21 Apr, 2012 
 

Joined: 31 Mar, 2011
Posts: 128
Location: Hanoi, Vietnam
Offline
Domino wrote:
you have to store handles to the attached units...

like self.AttachedUnits = { unit1 = attachedunit1, unit2 = attachedunit2 }

you then use that to get the handle to the unit like

IssueAttack({self.AttachedUnits.unit1}, target)

self in your senario is the unit that all the others are attached to.. IE the base unit.
you dont want that unit you want the attached units... :)


I also did as you said but nothing happened. The script I posted in #1 post is just for reference, it's not in my unit's lua file. Maybe, there are somethings wrong with my script. I'm checking it. Thank you, Domino


Top
 Profile  
 PostPosted: 21 Apr, 2012 
 

Joined: 26 Feb, 2009
Posts: 2996
Offline
Hi,

There could be a problem with the attached units, im not 100% sure how attached units behave when ordered to attack something, because they are attached to a unit..
i guess its dependant on how your attaching them,

if your using the POD method, then they will attack the enemy however if your using

self:AttachToBone(-1, attachToUnit, -1)

then they might not work as expected,
this is the part im unsure of the outcome..

_________________
Domino.
______________


Top
 Profile  
 PostPosted: 21 Apr, 2012 
 

Joined: 31 Mar, 2011
Posts: 128
Location: Hanoi, Vietnam
Offline
Yeah, I used POD method but I made some mistakes.


Top
 Profile  
 PostPosted: 21 Apr, 2012 
 

Joined: 26 Feb, 2009
Posts: 2996
Offline
cool,

well post some code if you get stuck :)

_________________
Domino.
______________


Top
 Profile  
 PostPosted: 21 Apr, 2012 
 

Joined: 31 Mar, 2011
Posts: 128
Location: Hanoi, Vietnam
Offline
One more question: Does game crash(or error) if I created both projectile and unit having same TypeClass?
For example: AAA0001 unit(has aaa0001_unit.bp) and AAA0001 projectile(aaa0001_proj.bp)


Top
 Profile  
 PostPosted: 21 Apr, 2012 
 

Joined: 31 Mar, 2011
Posts: 128
Location: Hanoi, Vietnam
Offline
Domino wrote:
cool,

well post some code if you get stuck :)


I tried to find out what's wrong with my script but it's not necessary now. I found another approaching method that is better than pld one. Thank for your concerning.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic



Quick Tools

Search for:
Jump to:  

© 2002-2010 Gas Powered Games Corp. All Rights Reserved. Gas Powered Games is the exclusive trademark of Gas Powered Games Corp.
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
 
Home| Games | Company | News & Press | Support
  Terms of Use   |    Copyright Information   |    Privacy Policy