Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name Rainbow Bolts
- @persist O:entity Inc TrailLength Bolts:array Count Rangers:array ParentEnt:entity
- runOnTick(1)
- if(first()) {
- ParentEnt = noentity()
- TrailLength = 80
- Rangers = array()
- for(I = 1, TrailLength) {
- holoCreate(I , entity():pos() + vec(I*10,0,50))
- holoScale(I, vec(1,1,7))
- holoModel(I, "hq_cone")
- holoAng(I, ang(0,0,0))
- }
- Inc = 0
- O = owner()
- }
- findByClass("crossbow_bolt")
- findSortByDistance(find():owner():pos())
- findExcludePlayerProps("*")
- findIncludePlayerProps("*")
- Bolts = findToArray()
- Count = Bolts:count()
- if(changed(find():pos()) & !ParentEnt:isValid()) {
- if(Inc !=TrailLength ){
- Inc += 1
- holoPos(Inc, find():pos())
- holoColor(Inc, hsv2rgb(360*curtime()/5%360,1,1))
- holoAng(Inc, find():angles()+ang(90,0,0))
- holoScale(Inc, vec(1,1,20))
- }
- if(changed(Inc) & Inc == TrailLength) {
- Inc -= TrailLength
- }
- }
- for(I = 1, Bolts:count()) {
- if(Bolts[I, entity]:isValid()) {
- rangerFilter(owner())
- rangerFilter(Bolts[I, entity])
- Rangers[I, ranger] = rangerOffset(150,Bolts[I,entity]:pos(),Bolts[I,entity]:forward())
- }
- if(changed(Rangers[I , ranger]:hit()) & Rangers[I, ranger]:hit()) {
- ParentEnt = Rangers[I, ranger]:entity()
- print(Rangers[I, ranger]:entity():model())
- print("hit")
- }
- }
- if(changed(ParentEnt) & ParentEnt:isValid()) {
- ParentEnt:setMaterial("models/debug/debugwhite")
- }
- if(ParentEnt:isValid()) {
- if(changed(ParentEnt:pos()) | changed(ParentEnt:angles())) {
- Inc += 1
- ParentEnt:setColor(hsv2rgb(360*curtime()/5%360,1,1))
- holoPos(Inc, ParentEnt:pos())
- holoColor(Inc, hsv2rgb(360*curtime()*3%360,1,1))
- holoAng(Inc, ParentEnt:angles()+ang(0,0,0))
- holoScale(Inc, vec(1,1,1))
- holoMaterial(Inc, "models/debug/debugwhite")
- holoModel(Inc, ParentEnt:model())
- if(changed(Inc) & Inc == TrailLength) {
- Inc -= TrailLength
- }
- }
- }
Add Comment
Please, Sign In to add comment