- Joined
- Oct 21, 2006
- Messages
- 3,224
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Shotgun shoot

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Attack (Shotgun)

Actions


-------- Set variables --------


Set Point1 = (Position of (Triggering unit))


Set Point2 = (Point1 offset by 20.00 towards (Facing of (Triggering unit)) degrees)


Set Point3 = (Target point of ability being cast)


-------- Set ammunition --------


Set Ammo_Shotgun_used[(Player number of (Owner of (Triggering unit)))] = (Ammo_Shotgun_used[(Player number of (Owner of (Triggering unit)))] + 1)


Set Ammo_Shotgun_cur[(Player number of (Owner of (Triggering unit)))] = (Ammo_Shotgun_cur[(Player number of (Owner of (Triggering unit)))] - 1)


Player - Set (Owner of (Triggering unit)) Food used to Ammo_Shotgun_cur[(Player number of (Owner of (Triggering unit)))]


-------- Create bullet 1 - Mid --------


Unit - Create 1 Bullet Shotgun for (Owner of (Triggering unit)) at Point2 facing (Angle from Point2 to Point3) degrees


Unit - Add a 0.50 second Generic expiration timer to (Last created unit)


Unit - Turn collision for (Last created unit) Off


Unit - Add Crow Form to (Last created unit)


Unit Group - Add (Last created unit) to Bullets_Shotgun


Animation - Change (Last created unit) flying height to 60.00 at 0.00


Set Temp_Real = (Facing of (Last created unit))


-------- Create bullet 2 - Top --------


Unit - Create 1 Bullet Shotgun for (Owner of (Triggering unit)) at Point2 facing (Temp_Real + 5.00) degrees


Unit - Add a 0.50 second Generic expiration timer to (Last created unit)


Unit - Turn collision for (Last created unit) Off


Unit - Add Crow Form to (Last created unit)


Unit Group - Add (Last created unit) to Bullets_Shotgun


Animation - Change (Last created unit) flying height to 60.00 at 0.00


-------- Create bullet 3 - Bot --------


Unit - Create 1 Bullet Shotgun for (Owner of (Triggering unit)) at Point2 facing (Temp_Real - 5.00) degrees


Unit - Add a 0.50 second Generic expiration timer to (Last created unit)


Unit - Turn collision for (Last created unit) Off


Unit - Add Crow Form to (Last created unit)


Unit Group - Add (Last created unit) to Bullets_Shotgun


Animation - Change (Last created unit) flying height to 60.00 at 0.00


Trigger - Turn on Shotgun bullet loop <gen>


-------- Remove leaks --------


Custom script: call RemoveLocation(udg_Point1)


Custom script: call RemoveLocation(udg_Point2)


Custom script: call RemoveLocation(udg_Point3)
Shotgun bullet loop

Events


Time - Every 0.02 seconds of game time

Conditions

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Bullets_Shotgun is empty) Equal to False



Then - Actions




-------- Pick all units in Bullets_Shotgun --------




Unit Group - Pick every unit in Bullets_Shotgun and do (Actions)





Loop - Actions






-------- Set variables and move picked bullet --------






Set Temp_Unit = (Picked unit)






Set Point1 = (Position of Temp_Unit)






Set Point2 = (Point1 offset by 30.00 towards (Facing of Temp_Unit) degrees)






Unit - Move Temp_Unit instantly to Point2






-------- Check for nearby enemies --------






Set Temp_UnitGroup = (Units within 150.00 of Temp_Point matching (((Unit-type of (Matching unit)) Not equal to Player) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Picked unit))) Equal to True))))






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Number of units in Temp_UnitGroup) Greater than 0







Then - Actions








Set WhichTarget = (Random unit from Temp_UnitGroup)








-------- Pick and damage random enemy --------








Unit - Cause Temp_Unit to damage WhichTarget, dealing (Random real number between 20.00 and 30.00) damage of attack type Chaos and damage type Normal








Special Effect - Create a special effect attached to the chest of WhichTarget using Objects\Spawnmodels\Undead\UndeadBlood\UndeadBloodGhoul.mdl








Special Effect - Destroy (Last created special effect)








Unit - Kill Temp_Unit







Else - Actions






-------- Remove leaks --------






Custom script: call RemoveLocation(udg_Point1)






Custom script: call RemoveLocation(udg_Point2)






Custom script: call DestroyGroup(udg_Temp_UnitGroup)



Else - Actions




Trigger - Turn off (This trigger)
Yup.So the only action you are performing is a couple of shots and it drops fps?
Twice.Are you sure you opened the map I sent you (you maybe opened yours instead). It doesn't drop for me.
But the fps stays on low even if there arent any bullets so that cant be the problem.On a side note, use a higher tick, e.g. 0.03 - 0.05, with a higher offset value, so that it doesn't look visually different.