- Joined
- Jan 29, 2007
- Messages
- 98
Ok, so I'm trying to make a system which will work like the "Locust Swarm" ability, meaning that some creatures will come out of the caster, and "circulate" him within a specific range...
(By "circulate" I mean they will move around randomly until they spot an enemy etc... You know how I mean
)
So, this is what I have atm:
And as you can see, I had a struct for the "Entity Collection", meaning the whole group on entities (Locusts) a unit "owns", but also a struct for each entity...
I could not get this to work, because I thought i'd need to extend the EntityCollection struct, and I didn't know how that works
I haven't yet tested what I have now, but I'd believe it wouldn't work very well...
And also, as you can see by the unit arrays and integer arrays, I've tried to "link" the entities of a specific cast to their caster, but I'm very unsure if I've done it correctly :S
And, I think I still need to extend EntityCollection... (Or I at least want to have a stand-alone struct for each entity so you can change their flying height and many more features for them
)
Anyone want to help me change it so it'll work as intended ? :S
(Note: I searched the forums TheHelper.net, WC3C.net and TheHiveWorkshop.com before I started working on this and I couldn't find anything like this anywhere :S If you know of a system like this, please let me know so I don't waste my time with this
)
If you need more information, or you think I've been unclear on anything please let me know and I'll fix it
(By "circulate" I mean they will move around randomly until they spot an enemy etc... You know how I mean
So, this is what I have atm:
JASS:
library EntityCol requires AutoIndex
globals
private constant integer MAX_ENTITIES = 20
endglobals
/*struct Entity
unit Entity
unit Owner
static method create takes unit owner, integer amount, real x, real y, integer unitId returns Entity
local Entity a = Entity.allocate()
local player p = GetOwningPlayer( owner )
set a.Owner = owner
set a.Entity = CreateUnit( p, unitId, x, y, bj_UNIT_FACING )
return a
endmethod
endstruct*/
struct EntityCollection// extends Entity
//group Entities = CreateGroup()
unit array Entity [ MAX_ENTITIES ]
unit Caster
integer array ID [ MAX_ENTITIES ]
static method create takes unit caster, integer number, integer unitId, real radius returns thistype
local real x = GetUnitX( caster )
local real y = GetUnitY( caster )
local thistype this = thistype.allocate(/* caster, number, x, y, unitId */)
local integer loops = 1
local player p = GetOwningPlayer( caster )
local real x2 = x + GetRandomReal( x - radius, x + radius )
local real y2 = y + GetRandomReal( y - radius, y + radius )
set this.Caster = caster
loop
exitwhen loops >= number
set Entity[ ID[ loops ]] = CreateUnit( p, unitId, x, y, bj_UNIT_FACING )
set ID[loops] = GetUnitId( caster )
call IssuePointOrder( Entity[GetUnitId( caster )], "move", x2, y2 )
//call GroupAddUnit( d.Entities, u )
endloop
return this
endmethod
endstruct
endlibrary
And as you can see, I had a struct for the "Entity Collection", meaning the whole group on entities (Locusts) a unit "owns", but also a struct for each entity...
I could not get this to work, because I thought i'd need to extend the EntityCollection struct, and I didn't know how that works
I haven't yet tested what I have now, but I'd believe it wouldn't work very well...
And also, as you can see by the unit arrays and integer arrays, I've tried to "link" the entities of a specific cast to their caster, but I'm very unsure if I've done it correctly :S
And, I think I still need to extend EntityCollection... (Or I at least want to have a stand-alone struct for each entity so you can change their flying height and many more features for them
Anyone want to help me change it so it'll work as intended ? :S
(Note: I searched the forums TheHelper.net, WC3C.net and TheHiveWorkshop.com before I started working on this and I couldn't find anything like this anywhere :S If you know of a system like this, please let me know so I don't waste my time with this
If you need more information, or you think I've been unclear on anything please let me know and I'll fix it
Last edited: