Wratox1
Member
- Reaction score
- 22
Hello, i have some problem with my map, i have a spell, which creates a bullet:
and when a bullet is created, it is moved with this trigger:
and since the bullets will move until it hits an enemy, or it enters the black area outside the playable map area, i created this trigger(to prevent fatal error that occurs when a unit enters that black area):
but the problem is, when i some bullets and then comes to the black area, theyre supposed to be removed, and they are removed, but then it starts to lag heavily, but just for some seconds, then it goes back to normal.(atleast it has something to do with the bullets)
can anyone figure out why this is happening?
Trigger:
- machinegun
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Machinegun
- Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- machinegunammo[(Player number of (Owner of (Triggering unit)))] Greater than or equal to 5
- Then - Actions
- For each (Integer bulletint[(Player number of (Owner of (Triggering unit)))]) from 1 to 5, do (Actions)
- Loop - Actions
- Set bulletcreatepoint = (Position of (Triggering unit))
- Set bulletcreatefacing = (Facing of (Triggering unit))
- Set machinegunammo[(Player number of (Owner of (Triggering unit)))] = (machinegunammo[(Player number of (Owner of (Triggering unit)))] - 1)
- Unit - Create 1 machinegun bullet for (Owner of (Triggering unit)) at bulletcreatepoint facing bulletcreatefacing degrees
- Unit Group - Add (Last created unit) to bulletsinmap
- Custom script: call RemoveLocation(udg_bulletcreatepoint)
- Wait 0.10 seconds
- Loop - Actions
- For each (Integer bulletint[(Player number of (Owner of (Triggering unit)))]) from 1 to 5, do (Actions)
- Else - Actions
- Set tmp_group = (Player group((Owner of (Triggering unit))))
- Game - Display to tmp_group the text: |cffff0000Ammo is o...
- Custom script: call DestroyForce(udg_tmp_group)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Events
and when a bullet is created, it is moved with this trigger:
Trigger:
- bullet move
- Events
- Time - Every 0.03 seconds of game time
- Conditions
- Actions
- Unit Group - Pick every unit in bulletsinmap and do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Or - Any (Conditions) are true
- Conditions
- (Unit-type of (Picked unit)) Equal to machinegun bullet
- Conditions
- Or - Any (Conditions) are true
- Then - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Unit-type of (Picked unit)) Equal to machinegun bullet
- Then - Actions
- Set bulletspeed = 30.00
- Else - Actions
- If - Conditions
- Set bulletposition = (Position of (Picked unit))
- Set bulletfacing = (Facing of (Picked unit))
- Set bulletmoveto = (bulletposition offset by bulletspeed towards bulletfacing degrees)
- Unit - Move (Picked unit) instantly to bulletmoveto, facing bulletfacing degrees
- Unit - Add a 8.00 second Generic expiration timer to (Last created unit)
- Custom script: call RemoveLocation(udg_bulletposition)
- Custom script: call RemoveLocation(udg_bulletmoveto)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Unit Group - Pick every unit in bulletsinmap and do (Actions)
- Events
and since the bullets will move until it hits an enemy, or it enters the black area outside the playable map area, i created this trigger(to prevent fatal error that occurs when a unit enters that black area):
Trigger:
- bulletproof
- Events
- Unit - A unit enters topside <gen>
- Unit - A unit enters rightside <gen>
- Unit - A unit enters leftside <gen>
- Unit - A unit enters downside <gen>
- Conditions
- Or - Any (Conditions) are true
- Conditions
- (Unit-type of (Triggering unit)) Equal to machinegun bullet
- Conditions
- Or - Any (Conditions) are true
- Actions
- Unit - Remove (Triggering unit) from the game
- Events
but the problem is, when i some bullets and then comes to the black area, theyre supposed to be removed, and they are removed, but then it starts to lag heavily, but just for some seconds, then it goes back to normal.(atleast it has something to do with the bullets)
can anyone figure out why this is happening?