def func_train(*qwp_extra): if not qc.self.speed: qc.self.speed = 100 if not qc.self.target: qc.objerror('func_train without a target') if not qc.self.dmg: qc.self.dmg = 2 if qc.self.sounds == 0: qc.self.noise = ('misc/null.wav') engine.precache_sound('misc/null.wav') qc.self.noise1 = ('misc/null.wav') engine.precache_sound('misc/null.wav') elif qc.self.sounds == 1: qc.self.noise = ('plats/train2.wav') engine.precache_sound('plats/train2.wav') qc.self.noise1 = ('plats/train1.wav') engine.precache_sound('plats/train1.wav') qc.self.cnt = 1 qc.self.solid = defs.SOLID_BSP qc.self.movetype = defs.MOVETYPE_PUSH qc.self.blocked = train_blocked qc.self.use = train_use qc.self.classname = 'train' qc.self.setmodel(qc.self.model) qc.setsize(qc.self, qc.self.mins, qc.self.maxs) qc.setorigin(qc.self, qc.self.origin) # start trains on the second frame, to make sure their targets have had # a chance to spawn qc.self.nextthink = qc.self.ltime + 0.1 qc.self.think = func_train_find
def W_FireGrenade(*qwp_extra): qc.self.currentammo = qc.self.ammo_rockets = qc.self.ammo_rockets - 1 qc.self.sound(defs.CHAN_WEAPON, 'weapons/grenade.wav', 1, defs.ATTN_NORM) qc.msg_entity = qc.self qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK) qc.newmis = qc.spawn() qc.newmis.owner = qc.self qc.newmis.movetype = defs.MOVETYPE_BOUNCE qc.newmis.solid = defs.SOLID_BBOX qc.newmis.classname = 'grenade' qc.newmis.cnt = 0 # set newmis speed qc.makevectors(qc.self.v_angle) if qc.self.v_angle.x: qc.newmis.velocity = qc.v_forward * 600 + qc.v_up * 200 + crandom() * qc.v_right * 10 + crandom() * qc.v_up * 10 else: qc.newmis.velocity = qc.self.aim(10000) qc.newmis.velocity *= 600 qc.newmis.velocity %= Vector(None, None, 200) qc.newmis.avelocity = Vector(300, 300, 300) qc.newmis.angles = qc.vectoangles(qc.newmis.velocity) qc.newmis.touch = GrenadeTouch # set newmis duration qc.newmis.nextthink = qc.time + 2.5 qc.newmis.think = GrenadeExplode qc.newmis.setmodel('progs/grenade.mdl') qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0)) qc.setorigin(qc.newmis, qc.self.origin)
def item_armorInv(*qwp_extra): qc.self.touch = armor_touch engine.precache_model('progs/armor.mdl') qc.self.setmodel('progs/armor.mdl') qc.self.skin = 2 qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 56)) StartItem()
def item_health(*qwp_extra): qc.self.touch = health_touch if qc.self.spawnflags & H_ROTTEN: engine.precache_model('maps/b_bh10.bsp') engine.precache_sound('items/r_item1.wav') qc.self.setmodel('maps/b_bh10.bsp') qc.self.noise = 'items/r_item1.wav' qc.self.healamount = 15 qc.self.healtype = 0 elif qc.self.spawnflags & H_MEGA: engine.precache_model('maps/b_bh100.bsp') engine.precache_sound('items/r_item2.wav') qc.self.setmodel('maps/b_bh100.bsp') qc.self.noise = 'items/r_item2.wav' qc.self.healamount = 100 qc.self.healtype = 2 else: engine.precache_model('maps/b_bh25.bsp') engine.precache_sound('items/health1.wav') qc.self.setmodel('maps/b_bh25.bsp') qc.self.noise = 'items/health1.wav' qc.self.healamount = 25 qc.self.healtype = 1 qc.setsize(qc.self, Vector(0, 0, 0), Vector(32, 32, 56)) StartItem()
def plat_spawn_inside_trigger(*qwp_extra): trigger = engine.world tmin = Vector(0, 0, 0) tmax = Vector(0, 0, 0) # # middle trigger # trigger = qc.spawn() trigger.touch = plat_center_touch trigger.movetype = defs.MOVETYPE_NONE trigger.solid = defs.SOLID_TRIGGER trigger.enemy = qc.self tmin = qc.self.mins + Vector(25, 25, 0) tmax = qc.self.maxs - Vector(25, 25, -8) tmin %= Vector(None, None, tmax.z - (qc.self.pos1.z - qc.self.pos2.z + 8)) if qc.self.spawnflags & PLAT_LOW_TRIGGER: tmax %= Vector(None, None, tmin.z + 8) if qc.self.size.x <= 50: tmin %= Vector((qc.self.mins.x + qc.self.maxs.x) / 2, None, None) tmax %= Vector(tmin.x + 1, None, None) if qc.self.size.y <= 50: tmin %= Vector(None, (qc.self.mins.y + qc.self.maxs.y) / 2, None) tmax %= Vector(None, tmin.y + 1, None) qc.setsize(trigger, tmin, tmax)
def weapon_supershotgun(*qwp_extra): engine.precache_model('progs/g_shot.mdl') qc.self.setmodel('progs/g_shot.mdl') qc.self.weapon = defs.IT_SUPER_SHOTGUN qc.self.netname = 'Double-barrelled Shotgun' qc.self.touch = weapon_touch qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 56)) StartItem()
def weapon_supernailgun(*qwp_extra): engine.precache_model('progs/g_nail2.mdl') qc.self.setmodel('progs/g_nail2.mdl') qc.self.weapon = defs.IT_SUPER_NAILGUN qc.self.netname = 'Super Nailgun' qc.self.touch = weapon_touch qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 56)) StartItem()
def weapon_rocketlauncher(*qwp_extra): engine.precache_model('progs/g_rock2.mdl') qc.self.setmodel('progs/g_rock2.mdl') qc.self.weapon = 3 qc.self.netname = 'Rocket Launcher' qc.self.touch = weapon_touch qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 56)) StartItem()
def weapon_lightning(*qwp_extra): engine.precache_model('progs/g_light.mdl') qc.self.setmodel('progs/g_light.mdl') qc.self.weapon = 3 qc.self.netname = 'Thunderbolt' qc.self.touch = weapon_touch qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 56)) StartItem()
def TossWeapon(*qwp_extra): if defs.deathmatch != 1: return # only in deathmatch 1 if (qc.self.weapon == defs.IT_AXE) or (qc.self.weapon == defs.IT_SHOTGUN) or (qc.self.weapon == defs.IT_GRAPPLE): return item = qc.spawn() item.owner = qc.self qc.makevectors(qc.self.v_angle) qc.setorigin(item, qc.self.origin + Vector(0, 0, 16)) item.velocity = qc.self.aim(1000) item.velocity *= 500 item.flags = defs.FL_ITEM item.solid = defs.SOLID_TRIGGER item.movetype = defs.MOVETYPE_BOUNCE if qc.self.weapon == defs.IT_SUPER_SHOTGUN: item.setmodel("progs/g_shot.mdl") item.weapon = defs.IT_SUPER_SHOTGUN item.netname = "Double-barrelled Shotgun" item.classname = "weapon_supershotgun" qc.self.items -= defs.IT_SUPER_SHOTGUN elif qc.self.weapon == defs.IT_NAILGUN: item.setmodel("progs/g_nail.mdl") item.weapon = defs.IT_NAILGUN item.netname = "nailgun" item.classname = "weapon_nailgun" qc.self.items -= defs.IT_NAILGUN elif qc.self.weapon == defs.IT_SUPER_NAILGUN: item.setmodel("progs/g_nail2.mdl") item.weapon = defs.IT_SUPER_NAILGUN item.netname = "Super Nailgun" item.classname = "weapon_supernailgun" qc.self.items -= defs.IT_SUPER_NAILGUN elif qc.self.weapon == defs.IT_GRENADE_LAUNCHER: item.setmodel("progs/g_rock.mdl") item.weapon = 3 item.netname = "Grenade Launcher" item.classname = "weapon_grenadelauncher" qc.self.items -= defs.IT_GRENADE_LAUNCHER elif qc.self.weapon == defs.IT_ROCKET_LAUNCHER: item.setmodel("progs/g_rock2.mdl") item.weapon = 3 item.netname = "Rocket Launcher" item.classname = "weapon_rocketlauncher" qc.self.items -= defs.IT_ROCKET_LAUNCHER elif qc.self.weapon == defs.IT_LIGHTNING: item.setmodel("progs/g_light.mdl") item.weapon = 3 item.netname = "Thunderbolt" item.classname = "weapon_lightning" qc.self.items -= defs.IT_LIGHTNING qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56)) item.touch = Team_weapon_touch item.think = subs.SUB_Remove item.nextthink = qc.time + 120 qc.self.weapon = weapons.W_BestWeapon() weapons.W_SetCurrentAmmo()
def weapon_nailgun(*qwp_extra): if defs.deathmatch <= 3: engine.precache_model('progs/g_nail.mdl') qc.self.setmodel('progs/g_nail.mdl') qc.self.weapon = defs.IT_NAILGUN qc.self.netname = 'nailgun' qc.self.touch = weapon_touch qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 56)) StartItem()
def weapon_grenadelauncher(*qwp_extra): if defs.deathmatch <= 3: engine.precache_model('progs/g_rock.mdl') qc.self.setmodel('progs/g_rock.mdl') qc.self.weapon = 3 qc.self.netname = 'Grenade Launcher' qc.self.touch = weapon_touch qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 56)) StartItem()
def MakeLink(*qwp_extra): qc.newmis = qc.spawn() qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE qc.newmis.solid = defs.SOLID_NOT qc.newmis.owner = qc.self # SELF is the hook! qc.newmis.avelocity = Vector(200, 200, 200) qc.newmis.setmodel('progs/bit.mdl') qc.setorigin(qc.newmis, qc.self.origin) qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0)) return qc.newmis
def spawn_field(fmins, fmaxs, *qwp_extra): trigger = qc.spawn() trigger.movetype = defs.MOVETYPE_NONE trigger.solid = defs.SOLID_TRIGGER trigger.owner = qc.self trigger.touch = door_trigger_touch t1 = fmins t2 = fmaxs qc.setsize(trigger, t1 - Vector(60, 60, 8), t2 + Vector(60, 60, 8)) return (trigger)
def item_artifact_envirosuit(*qwp_extra): qc.self.touch = powerup_touch engine.precache_model('progs/suit.mdl') engine.precache_sound('items/suit.wav') engine.precache_sound('items/suit2.wav') qc.self.noise = 'items/suit.wav' qc.self.setmodel('progs/suit.mdl') qc.self.netname = 'Biosuit' qc.self.items = defs.IT_SUIT qc.setsize(qc.self, Vector(-16, -16, -24), Vector(16, 16, 32)) StartItem()
def item_artifact_invisibility(*qwp_extra): qc.self.touch = powerup_touch engine.precache_model('progs/invisibl.mdl') engine.precache_sound('items/inv1.wav') engine.precache_sound('items/inv2.wav') engine.precache_sound('items/inv3.wav') qc.self.noise = 'items/inv1.wav' qc.self.setmodel('progs/invisibl.mdl') qc.self.netname = 'Ring of Shadows' qc.self.items = defs.IT_INVISIBILITY qc.setsize(qc.self, Vector(-16, -16, -24), Vector(16, 16, 32)) StartItem()
def W_FireSuperSpikes(*qwp_extra): qc.self.sound(defs.CHAN_WEAPON, 'weapons/spike2.wav', 1, defs.ATTN_NORM) qc.self.attack_finished = qc.time + 0.2 qc.self.currentammo = qc.self.ammo_nails = qc.self.ammo_nails - 2 dir = qc.self.aim(1000) launch_spike(qc.self.origin + Vector(0, 0, 16), dir) qc.newmis.touch = superspike_touch qc.newmis.classname = 'spike' qc.newmis.setmodel('progs/s_spike.mdl') qc.setsize(qc.newmis, defs.VEC_ORIGIN, defs.VEC_ORIGIN) qc.msg_entity = qc.self qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK)
def item_artifact_super_damage(*qwp_extra): qc.self.touch = powerup_touch engine.precache_model('progs/quaddama.mdl') engine.precache_sound('items/damage.wav') engine.precache_sound('items/damage2.wav') engine.precache_sound('items/damage3.wav') qc.self.noise = 'items/damage.wav' qc.self.setmodel('progs/quaddama.mdl') qc.self.netname = 'Quad Damage' qc.self.items = defs.IT_QUAD qc.setsize(qc.self, Vector(-16, -16, -24), Vector(16, 16, 32)) StartItem()
def item_artifact_invulnerability(*qwp_extra): qc.self.touch = powerup_touch engine.precache_model('progs/invulner.mdl') engine.precache_sound('items/protect.wav') engine.precache_sound('items/protect2.wav') engine.precache_sound('items/protect3.wav') qc.self.noise = 'items/protect.wav' qc.self.setmodel('progs/invulner.mdl') qc.self.netname = 'Pentagram of Protection' qc.self.items = defs.IT_INVULNERABILITY qc.setsize(qc.self, Vector(-16, -16, -24), Vector(16, 16, 32)) StartItem()
def spawn_tdeath(org, death_owner, *qwp_extra): death = qc.spawn() death.classname = 'teledeath' death.movetype = defs.MOVETYPE_NONE death.solid = defs.SOLID_TRIGGER death.angles = Vector(0, 0, 0) qc.setsize(death, death_owner.mins - Vector(1, 1, 1), death_owner.maxs + Vector(1, 1, 1)) qc.setorigin(death, org) death.touch = tdeath_touch death.nextthink = qc.time + 0.1 death.think = subs.SUB_Remove death.owner = death_owner qc.force_retouch = 2 # make sure even still objects get hit
def CopyToBodyQue(ent, *qwp_extra): global bodyque_head bodyque_head.angles = ent.angles bodyque_head.model = ent.model bodyque_head.modelindex = ent.modelindex bodyque_head.frame = ent.frame bodyque_head.colormap = ent.colormap bodyque_head.movetype = ent.movetype bodyque_head.velocity = ent.velocity bodyque_head.flags = 0 qc.setorigin(bodyque_head, ent.origin) qc.setsize(bodyque_head, ent.mins, ent.maxs) bodyque_head = bodyque_head.owner
def ThrowHead(gibname, dm, *qwp_extra): qc.self.setmodel(gibname) qc.self.frame = 0 qc.self.nextthink = -1 qc.self.movetype = defs.MOVETYPE_BOUNCE qc.self.takedamage = defs.DAMAGE_NO qc.self.solid = defs.SOLID_NOT qc.self.view_ofs = Vector(0, 0, 8) qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 56)) qc.self.velocity = VelocityForDamage(dm) qc.self.origin %= Vector(None, None, qc.self.origin.z - 24) qc.self.flags -= qc.self.flags & defs.FL_ONGROUND qc.self.avelocity = weapons.crandom() * Vector(0, 600, 0)
def fire_fly(*qwp_extra): fireball = qc.spawn() fireball.solid = defs.SOLID_TRIGGER fireball.movetype = defs.MOVETYPE_TOSS fireball.velocity = Vector((random.random() * 100) - 50, (random.random() * 100) - 50, qc.self.speed + (random.random() * 200)) fireball.classname = 'fireball' fireball.setmodel('progs/lavaball.mdl') qc.setsize(fireball, Vector(0, 0, 0), Vector(0, 0, 0)) qc.setorigin(fireball, qc.self.origin) fireball.nextthink = qc.time + 5 fireball.think = subs.SUB_Remove fireball.touch = fire_touch qc.self.nextthink = qc.time + (random.random() * 5) + 3 qc.self.think = fire_fly
def item_rockets(*qwp_extra): qc.self.touch = ammo_touch if qc.self.spawnflags & WEAPON_BIG2: engine.precache_model('maps/b_rock1.bsp') qc.self.setmodel('maps/b_rock1.bsp') qc.self.aflag = 10 else: engine.precache_model('maps/b_rock0.bsp') qc.self.setmodel('maps/b_rock0.bsp') qc.self.aflag = 5 qc.self.weapon = 3 qc.self.netname = 'rockets' qc.setsize(qc.self, Vector(0, 0, 0), Vector(32, 32, 56)) StartItem()
def item_spikes(*qwp_extra): qc.self.touch = ammo_touch if qc.self.spawnflags & WEAPON_BIG2: engine.precache_model('maps/b_nail1.bsp') qc.self.setmodel('maps/b_nail1.bsp') qc.self.aflag = 50 else: engine.precache_model('maps/b_nail0.bsp') qc.self.setmodel('maps/b_nail0.bsp') qc.self.aflag = 25 qc.self.weapon = 2 qc.self.netname = 'nails' qc.setsize(qc.self, Vector(0, 0, 0), Vector(32, 32, 56)) StartItem()
def SpawnMeatSpray(org, vel, *qwp_extra): missile = qc.spawn() missile.owner = qc.self missile.movetype = defs.MOVETYPE_BOUNCE missile.solid = defs.SOLID_NOT qc.makevectors(qc.self.angles) missile.velocity = vel missile.velocity %= Vector(None, None, missile.velocity.z + 250 + 50 * random.random()) missile.avelocity = Vector(3000, 1000, 2000) # set missile duration missile.nextthink = qc.time + 1 missile.think = subs.SUB_Remove missile.setmodel('progs/zom_gib.mdl') qc.setsize(missile, Vector(0, 0, 0), Vector(0, 0, 0)) qc.setorigin(missile, org)
def launch_spike(org, dir, *qwp_extra): qc.newmis = qc.spawn() qc.newmis.owner = qc.self qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE qc.newmis.solid = defs.SOLID_BBOX qc.newmis.cnt = 0 qc.newmis.angles = qc.vectoangles(dir) qc.newmis.touch = spike_touch qc.newmis.classname = 'spike' qc.newmis.think = subs.SUB_Remove qc.newmis.nextthink = qc.time + 6 qc.newmis.setmodel('progs/spike.mdl') qc.setsize(qc.newmis, defs.VEC_ORIGIN, defs.VEC_ORIGIN) qc.setorigin(qc.newmis, org) qc.newmis.velocity = dir * 1000
def item_cells(*qwp_extra): qc.self.touch = ammo_touch if qc.self.spawnflags & WEAPON_BIG2: engine.precache_model('maps/b_batt1.bsp') qc.self.setmodel('maps/b_batt1.bsp') qc.self.aflag = 12 else: engine.precache_model('maps/b_batt0.bsp') qc.self.setmodel('maps/b_batt0.bsp') qc.self.aflag = 6 qc.self.weapon = 4 qc.self.netname = 'cells' qc.setsize(qc.self, Vector(0, 0, 0), Vector(32, 32, 56)) StartItem()
def func_plat(*qwp_extra): t = engine.world if not qc.self.t_length: qc.self.t_length = 80 if not qc.self.t_width: qc.self.t_width = 10 if qc.self.sounds == 0: qc.self.sounds = 2 # FIX THIS TO LOAD A GENERIC PLAT SOUND if qc.self.sounds == 1: engine.precache_sound('plats/plat1.wav') engine.precache_sound('plats/plat2.wav') qc.self.noise = 'plats/plat1.wav' qc.self.noise1 = 'plats/plat2.wav' if qc.self.sounds == 2: engine.precache_sound('plats/medplat1.wav') engine.precache_sound('plats/medplat2.wav') qc.self.noise = 'plats/medplat1.wav' qc.self.noise1 = 'plats/medplat2.wav' qc.self.mangle = qc.self.angles qc.self.angles = Vector(0, 0, 0) qc.self.classname = 'plat' qc.self.solid = defs.SOLID_BSP qc.self.movetype = defs.MOVETYPE_PUSH qc.setorigin(qc.self, qc.self.origin) qc.self.setmodel(qc.self.model) qc.setsize(qc.self, qc.self.mins, qc.self.maxs) qc.self.blocked = plat_crush if not qc.self.speed: qc.self.speed = 150 # pos1 is the top position, pos2 is the bottom qc.self.pos1 = qc.self.origin qc.self.pos2 = qc.self.origin if qc.self.height: qc.self.pos2 %= Vector(None, None, qc.self.origin.z - qc.self.height) else: qc.self.pos2 %= Vector(None, None, qc.self.origin.z - qc.self.size.z + 8) qc.self.use = plat_trigger_use plat_spawn_inside_trigger() # the "start moving" trigger if qc.self.targetname: qc.self.state = defs.STATE_UP qc.self.use = plat_use else: qc.setorigin(qc.self, qc.self.pos2) qc.self.state = defs.STATE_BOTTOM
def make_bubbles(*qwp_extra): bubble = qc.spawn() bubble.setmodel('progs/s_bubble.spr') qc.setorigin(bubble, qc.self.origin) bubble.movetype = defs.MOVETYPE_NOCLIP bubble.solid = defs.SOLID_NOT bubble.velocity = Vector(0, 0, 15) bubble.nextthink = qc.time + 0.5 bubble.think = bubble_bob bubble.touch = bubble_remove bubble.classname = 'bubble' bubble.frame = 0 bubble.cnt = 0 qc.setsize(bubble, Vector(-8, -8, -8), Vector(8, 8, 8)) qc.self.nextthink = qc.time + random.random() + 0.5 qc.self.think = make_bubbles
def fire_fly(*qwp_extra): fireball = engine.world fireball = qc.spawn() fireball.solid = defs.SOLID_TRIGGER fireball.movetype = defs.MOVETYPE_TOSS fireball.velocity = Vector(0, 0, 1000) fireball.velocity %= Vector((random.random() * 100) - 50, None, None) fireball.velocity %= Vector(None, (random.random() * 100) - 50, None) fireball.velocity %= Vector(None, None, qc.self.speed + (random.random() * 200)) fireball.classname = 'fireball' fireball.setmodel('progs/lavaball.mdl') qc.setsize(fireball, Vector(0, 0, 0), Vector(0, 0, 0)) qc.setorigin(fireball, qc.self.origin) fireball.nextthink = qc.time + 5 fireball.think = subs.SUB_Remove fireball.touch = fire_touch qc.self.nextthink = qc.time + (random.random() * 5) + 3 qc.self.think = fire_fly
def misc_explobox2(*qwp_extra): oldz = 0 qc.self.solid = defs.SOLID_BBOX qc.self.movetype = defs.MOVETYPE_NONE engine.precache_model('maps/b_exbox2.bsp') qc.self.setmodel('maps/b_exbox2.bsp') qc.setsize(qc.self, Vector(0, 0, 0), Vector(32, 32, 32)) engine.precache_sound('weapons/r_exp3.wav') qc.self.health = 20 qc.self.th_die = barrel_explode qc.self.takedamage = defs.DAMAGE_AIM qc.self.origin %= Vector(None, None, qc.self.origin.z + 2) oldz = qc.self.origin.z qc.droptofloor() if oldz - qc.self.origin.z > 250: engine.dprint('item fell out of level at ') engine.dprint(str(qc.self.origin)) engine.dprint('\012') qc.self.remove()
def item_flag_team1(*qwp_extra): if not defs.deathmatch or not (engine.cvar('teamplay') & TEAM_CAPTURE_FLAG): qc.self.remove() return qc.self.steam = TEAM_COLOR1 qc.self.items = defs.IT_KEY2 engine.precache_model('progs/flag.mdl') qc.self.setmodel('progs/flag.mdl') qc.self.skin = 0 engine.precache_sound('misc/flagtk.wav') # flag taken engine.precache_sound('misc/flagcap.wav') # flag capture engine.precache_sound('doors/runetry.wav') qc.self.noise = 'misc/flagtk.wav' qc.self.noise1 = 'doors/runetry.wav' qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 74)) qc.self.nextthink = qc.time + 0.2 # items start after other solids qc.self.think = place_flag
def DeathBubblesSpawn(*qwp_extra): if qc.self.owner.waterlevel != 3: return bubble = qc.spawn() bubble.setmodel('progs/s_bubble.spr') qc.setorigin(bubble, qc.self.owner.origin + Vector(0, 0, 24)) bubble.movetype = defs.MOVETYPE_NOCLIP bubble.solid = defs.SOLID_NOT bubble.velocity = Vector(0, 0, 15) bubble.nextthink = qc.time + 0.5 bubble.think = misc.bubble_bob bubble.classname = 'bubble' bubble.frame = 0 bubble.cnt = 0 qc.setsize(bubble, Vector(-8, -8, -8), Vector(8, 8, 8)) qc.self.nextthink = qc.time + 0.1 qc.self.think = DeathBubblesSpawn qc.self.air_finished += 1 if qc.self.air_finished >= qc.self.bubble_count: qc.self.remove()
def DropBackpack(*qwp_extra): item = engine.world if not (qc.self.ammo_shells + qc.self.ammo_nails + qc.self.ammo_rockets + qc.self.ammo_cells): return # nothing in it item = qc.spawn() item.origin = qc.self.origin - Vector(0, 0, 24) item.items = qc.self.weapon if item.items == defs.IT_AXE: item.netname = 'Axe' elif item.items == defs.IT_SHOTGUN: item.netname = 'Shotgun' elif item.items == defs.IT_SUPER_SHOTGUN: item.netname = 'Double-barrelled Shotgun' elif item.items == defs.IT_NAILGUN: item.netname = 'Nailgun' elif item.items == defs.IT_SUPER_NAILGUN: item.netname = 'Super Nailgun' elif item.items == defs.IT_GRENADE_LAUNCHER: item.netname = 'Grenade Launcher' elif item.items == defs.IT_ROCKET_LAUNCHER: item.netname = 'Rocket Launcher' elif item.items == defs.IT_LIGHTNING: item.netname = 'Thunderbolt' else: item.netname = None item.ammo_shells = qc.self.ammo_shells item.ammo_nails = qc.self.ammo_nails item.ammo_rockets = qc.self.ammo_rockets item.ammo_cells = qc.self.ammo_cells item.velocity %= Vector(None, None, 300) item.velocity %= Vector(-100 + (random.random() * 200), None, None) item.velocity %= Vector(None, -100 + (random.random() * 200), None) item.flags = defs.FL_ITEM item.solid = defs.SOLID_TRIGGER item.movetype = defs.MOVETYPE_TOSS item.setmodel('progs/backpack.mdl') qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56)) item.touch = BackpackTouch item.nextthink = qc.time + 120 # remove after 2 minutes item.think = subs.SUB_Remove
def item_key2(*qwp_extra): if qc.world.worldtype == 0: engine.precache_model('progs/w_g_key.mdl') qc.self.setmodel('progs/w_g_key.mdl') qc.self.netname = 'gold key' if qc.world.worldtype == 1: engine.precache_model('progs/m_g_key.mdl') qc.self.setmodel('progs/m_g_key.mdl') qc.self.netname = 'gold runekey' if qc.world.worldtype == 2: engine.precache_model('progs/b_g_key.mdl') qc.self.setmodel('progs/b_g_key.mdl') qc.self.netname = 'gold keycard' key_setsounds() qc.self.touch = key_touch qc.self.items = defs.IT_KEY2 qc.setsize(qc.self, Vector(-16, -16, -24), Vector(16, 16, 32)) StartItem()
def Do_DropRune(flag, *qwp_extra): item = qc.spawn() item.origin = qc.self.origin - Vector(0, 0, 24) item.player_flag = flag item.velocity = Vector((random.random() * 1000) - 500, (random.random() * 1000) - 500, 400) item.flags = defs.FL_ITEM item.solid = defs.SOLID_TRIGGER item.movetype = defs.MOVETYPE_TOSS if flag & defs.ITEM_RUNE1_FLAG: item.setmodel('progs/end1.mdl') elif flag & defs.ITEM_RUNE2_FLAG: item.setmodel('progs/end2.mdl') elif flag & defs.ITEM_RUNE3_FLAG: item.setmodel('progs/end3.mdl') elif flag & defs.ITEM_RUNE4_FLAG: item.setmodel('progs/end4.mdl') qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56)) item.touch = RuneTouch item.nextthink = qc.time + 120 # if no one touches it in two minutes, # respawn it somewhere else, so inaccessible ones will come 'back' item.think = RuneRespawn
def TeamDropFlag(flg, *qwp_extra): p = flg.owner engine.bprint(defs.PRINT_HIGH, p.netname) if p.steam == TEAM_COLOR1: engine.bprint( defs.PRINT_HIGH, ' \354\357\363\364 the \302\314\325\305 flag!\012') # blue else: engine.bprint(defs.PRINT_HIGH, ' \354\357\363\364 the \322\305\304 flag!\012') # red p.effects -= p.effects & (defs.EF_FLAG1 | defs.EF_FLAG2) flg.origin = p.origin - Vector(0, 0, 24) flg.cnt = FLAG_DROPPED flg.velocity %= Vector(None, None, 300) flg.velocity %= Vector(0, None, None) flg.velocity %= Vector(None, 0, None) flg.flags = defs.FL_ITEM flg.solid = defs.SOLID_TRIGGER flg.movetype = defs.MOVETYPE_TOSS flg.setmodel(flg.mdl) qc.setsize(qc.self, Vector(-16, -16, 0), Vector(16, 16, 74)) # return it after so long flg.super_time = qc.time + TEAM_CAPTURE_FLAG_RETURN_TIME
def misc_teleporttrain(*qwp_extra): if not qc.self.speed: qc.self.speed = 100 if not qc.self.target: qc.objerror('func_train without a target') qc.self.cnt = 1 qc.self.solid = defs.SOLID_NOT qc.self.movetype = defs.MOVETYPE_PUSH qc.self.blocked = train_blocked qc.self.use = train_use qc.self.avelocity = Vector(100, 200, 300) qc.self.noise = ('misc/null.wav') engine.precache_sound('misc/null.wav') qc.self.noise1 = ('misc/null.wav') engine.precache_sound('misc/null.wav') engine.precache_model('progs/teleport.mdl') qc.self.setmodel('progs/teleport.mdl') qc.setsize(qc.self, qc.self.mins, qc.self.maxs) qc.setorigin(qc.self, qc.self.origin) # start trains on the second frame, to make sure their targets have had # a chance to spawn qc.self.nextthink = qc.self.ltime + 0.1 qc.self.think = func_train_find
def Throw_Grapple(*qwp_extra): if qc.self.hook_out: # reject subsequent calls from player.qc return qc.msg_entity = qc.self qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK) # chain out sound (loops) qc.self.sound(defs.CHAN_WEAPON, 'weapons/chain1.wav', 1, defs.ATTN_NORM) qc.newmis = qc.spawn() qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE qc.newmis.solid = defs.SOLID_BBOX qc.newmis.owner = qc.self # newmis belongs to me qc.self.hook = qc.newmis # This is my newmis qc.newmis.classname = 'hook' qc.makevectors(qc.self.v_angle) qc.newmis.velocity = qc.v_forward * 800 qc.newmis.avelocity = Vector(0, 0, -500) qc.newmis.touch = Anchor_Grapple qc.newmis.think = Build_Chain qc.newmis.nextthink = qc.time + 0.1 # don't jam newmis and links into same packet qc.newmis.setmodel('progs/star.mdl') qc.setorigin(qc.newmis, qc.self.origin + qc.v_forward * 16 + Vector(0, 0, 16)) qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0)) qc.self.hook_out = defs.TRUE
def W_FireRocket(*qwp_extra): qc.self.currentammo = qc.self.ammo_rockets = qc.self.ammo_rockets - 1 qc.self.sound(defs.CHAN_WEAPON, 'weapons/sgun1.wav', 1, defs.ATTN_NORM) qc.msg_entity = qc.self qc.WriteByte(defs.MSG_ONE, defs.SVC_SMALLKICK) qc.newmis = qc.spawn() qc.newmis.owner = qc.self qc.newmis.movetype = defs.MOVETYPE_FLYMISSILE qc.newmis.solid = defs.SOLID_BBOX qc.newmis.classname = 'missile' qc.newmis.cnt = 0 # set newmis speed qc.makevectors(qc.self.v_angle) qc.newmis.velocity = qc.self.aim(1000) qc.newmis.velocity *= 1000 qc.newmis.angles = qc.vectoangles(qc.newmis.velocity) qc.newmis.touch = T_MissileTouch # set newmis duration qc.newmis.nextthink = qc.time + 5 qc.newmis.think = subs.SUB_Remove qc.newmis.setmodel('progs/missile.mdl') qc.setsize(qc.newmis, Vector(0, 0, 0), Vector(0, 0, 0)) qc.setorigin(qc.newmis, qc.self.origin + qc.v_forward * 8 + Vector(0, 0, 16))
def item_sigil(*qwp_extra): if not qc.self.spawnflags: qc.objerror('no spawnflags') engine.precache_sound('misc/runekey.wav') qc.self.noise = 'misc/runekey.wav' if qc.self.spawnflags & 1: engine.precache_model('progs/end1.mdl') qc.self.setmodel('progs/end1.mdl') if qc.self.spawnflags & 2: engine.precache_model('progs/end2.mdl') qc.self.setmodel('progs/end2.mdl') if qc.self.spawnflags & 4: engine.precache_model('progs/end3.mdl') qc.self.setmodel('progs/end3.mdl') if qc.self.spawnflags & 8: engine.precache_model('progs/end4.mdl') qc.self.setmodel('progs/end4.mdl') qc.self.touch = sigil_touch qc.setsize(qc.self, Vector(-16, -16, -24), Vector(16, 16, 32)) StartItem()
def TossWeapon(*qwp_extra): if defs.deathmatch != 1: return # only in deathmatch 1 if (qc.self.weapon == defs.IT_AXE) or (qc.self.weapon == defs.IT_SHOTGUN) or (qc.self.weapon == defs.IT_GRAPPLE): return item = qc.spawn() item.owner = qc.self qc.makevectors(qc.self.v_angle) qc.setorigin(item, qc.self.origin + Vector(0, 0, 16)) item.velocity = qc.self.aim(1000) item.velocity *= 500 item.flags = defs.FL_ITEM item.solid = defs.SOLID_TRIGGER item.movetype = defs.MOVETYPE_BOUNCE if qc.self.weapon == defs.IT_SUPER_SHOTGUN: item.setmodel('progs/g_shot.mdl') item.weapon = defs.IT_SUPER_SHOTGUN item.netname = 'Double-barrelled Shotgun' item.classname = 'weapon_supershotgun' qc.self.items -= defs.IT_SUPER_SHOTGUN elif qc.self.weapon == defs.IT_NAILGUN: item.setmodel('progs/g_nail.mdl') item.weapon = defs.IT_NAILGUN item.netname = 'nailgun' item.classname = 'weapon_nailgun' qc.self.items -= defs.IT_NAILGUN elif qc.self.weapon == defs.IT_SUPER_NAILGUN: item.setmodel('progs/g_nail2.mdl') item.weapon = defs.IT_SUPER_NAILGUN item.netname = 'Super Nailgun' item.classname = 'weapon_supernailgun' qc.self.items -= defs.IT_SUPER_NAILGUN elif qc.self.weapon == defs.IT_GRENADE_LAUNCHER: item.setmodel('progs/g_rock.mdl') item.weapon = 3 item.netname = 'Grenade Launcher' item.classname = 'weapon_grenadelauncher' qc.self.items -= defs.IT_GRENADE_LAUNCHER elif qc.self.weapon == defs.IT_ROCKET_LAUNCHER: item.setmodel('progs/g_rock2.mdl') item.weapon = 3 item.netname = 'Rocket Launcher' item.classname = 'weapon_rocketlauncher' qc.self.items -= defs.IT_ROCKET_LAUNCHER elif qc.self.weapon == defs.IT_LIGHTNING: item.setmodel('progs/g_light.mdl') item.weapon = 3 item.netname = 'Thunderbolt' item.classname = 'weapon_lightning' qc.self.items -= defs.IT_LIGHTNING qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56)) item.touch = Team_weapon_touch item.think = subs.SUB_Remove item.nextthink = qc.time + 120 qc.self.weapon = weapons.W_BestWeapon() weapons.W_SetCurrentAmmo()
def movetarget_f(*qwp_extra): if not qc.self.targetname: qc.objerror('monster_movetarget: no targetname') qc.self.solid = defs.SOLID_TRIGGER qc.self.touch = t_movetarget qc.setsize(qc.self, Vector(-8, -8, -8), Vector(8, 8, 8))
def TossBackpack(*qwp_extra): # If we don't have any ammo, return (except AXE/GRAPPLE) if qc.self.currentammo <= 0: if qc.self.weapon != defs.IT_AXE and qc.self.weapon != defs.IT_GRAPPLE: return item = qc.spawn() # See if you have the Shotgun or Super Shotgun on if (qc.self.weapon == defs.IT_SHOTGUN) or (qc.self.weapon == defs.IT_SUPER_SHOTGUN): if qc.self.ammo_shells >= 20: item.ammo_shells = 20 qc.self.ammo_shells -= 20 else: item.ammo_shells = qc.self.ammo_shells qc.self.ammo_shells = 0 # See if you have neither the Shotgun or Super Shotgun if not (qc.self.items & defs.IT_SHOTGUN) and not (qc.self.items & defs.IT_SUPER_SHOTGUN): if qc.self.ammo_shells >= 20: item.ammo_shells = 20 qc.self.ammo_shells -= 20 else: item.ammo_shells = qc.self.ammo_shells qc.self.ammo_shells = 0 # See if we are using a nailgun if (qc.self.weapon == defs.IT_NAILGUN) or (qc.self.weapon == defs.IT_SUPER_NAILGUN): if qc.self.ammo_nails >= 20: item.ammo_nails = 20 qc.self.ammo_nails -= 20 else: item.ammo_nails = qc.self.ammo_nails qc.self.ammo_nails = 0 # Check to see if we have neither nailgun if not (qc.self.items & defs.IT_NAILGUN) and not (qc.self.items & defs.IT_SUPER_NAILGUN): if qc.self.ammo_nails >= 20: item.ammo_nails = 20 qc.self.ammo_nails -= 20 else: item.ammo_nails = qc.self.ammo_nails qc.self.ammo_nails = 0 # See if we are using a grenade or rocket launcher if (qc.self.weapon == defs.IT_GRENADE_LAUNCHER) or (qc.self.weapon == defs.IT_ROCKET_LAUNCHER): if qc.self.ammo_rockets >= 10: item.ammo_rockets = 10 qc.self.ammo_rockets -= 10 else: item.ammo_rockets = qc.self.ammo_rockets qc.self.ammo_rockets = 0 # See if we have neither the Grenade or rocket launcher if not (qc.self.items & defs.IT_GRENADE_LAUNCHER) and not ( qc.self.items & defs.IT_ROCKET_LAUNCHER): if qc.self.ammo_rockets >= 10: item.ammo_rockets = 10 qc.self.ammo_rockets -= 10 else: item.ammo_rockets = qc.self.ammo_rockets qc.self.ammo_rockets = 0 # See if we're using the lightning gun if qc.self.weapon == defs.IT_LIGHTNING: if qc.self.ammo_cells >= 20: item.ammo_cells = 20 qc.self.ammo_cells -= 20 else: item.ammo_cells = qc.self.ammo_cells qc.self.ammo_cells = 0 # see if we don't have the lightning gun if not (qc.self.items & defs.IT_LIGHTNING): if qc.self.ammo_cells >= 20: item.ammo_cells = 20 qc.self.ammo_cells -= 20 else: item.ammo_cells = qc.self.ammo_cells qc.self.ammo_cells = 0 if not item.ammo_shells and not item.ammo_nails and not item.ammo_rockets and not item.ammo_cells: # we didn't put anything in item.remove() return item.owner = qc.self qc.makevectors(qc.self.v_angle) qc.setorigin(item, qc.self.origin + Vector(0, 0, 16)) item.velocity = qc.self.aim(1000) item.velocity *= 500 item.flags = defs.FL_ITEM item.solid = defs.SOLID_TRIGGER item.movetype = defs.MOVETYPE_BOUNCE item.setmodel('progs/backpack.mdl') qc.setsize(item, Vector(-16, -16, 0), Vector(16, 16, 56)) item.touch = items.BackpackTouch item.nextthink = qc.time + 120 # remove after 2 minutes item.think = subs.SUB_Remove weapons.W_SetCurrentAmmo()
def PutClientInServer(*qwp_extra): global modelindex_eyes global modelindex_player spot = engine.world s = None qc.self.classname = 'player' qc.self.health = 100 qc.self.takedamage = defs.DAMAGE_AIM qc.self.solid = defs.SOLID_SLIDEBOX qc.self.movetype = defs.MOVETYPE_WALK qc.self.show_hostile = 0 qc.self.max_health = 100 qc.self.flags = defs.FL_CLIENT qc.self.air_finished = qc.time + 12 qc.self.dmg = 2 # initial water damage qc.self.super_damage_finished = 0 qc.self.radsuit_finished = 0 qc.self.invisible_finished = 0 qc.self.invincible_finished = 0 qc.self.effects = 0 qc.self.invincible_time = 0 DecodeLevelParms() weapons.W_SetCurrentAmmo() qc.self.attack_finished = qc.time qc.self.th_pain = player.player_pain qc.self.th_die = player.PlayerDie qc.self.deadflag = defs.DEAD_NO # paustime is set by teleporters to keep the player from moving a while qc.self.pausetime = 0 spot = SelectSpawnPoint() qc.self.origin = spot.origin + Vector(0, 0, 1) qc.self.angles = spot.angles qc.self.fixangle = defs.TRUE # turn this way immediately # oh, this is a hack! qc.self.setmodel('progs/eyes.mdl') modelindex_eyes = qc.self.modelindex qc.self.setmodel('progs/player.mdl') modelindex_player = qc.self.modelindex qc.setsize(qc.self, defs.VEC_HULL_MIN, defs.VEC_HULL_MAX) qc.self.view_ofs = Vector(0, 0, 22) # Mod - Xian (May.20.97) # Bug where player would have velocity from their last kill qc.self.velocity = Vector(0, 0, 0) player.player_stand1() qc.makevectors(qc.self.angles) triggers.spawn_tfog(qc.self.origin + qc.v_forward * 20) triggers.spawn_tdeath(qc.self.origin, qc.self) # Set Rocket Jump Modifiers if qc.stof(qc.world.infokey('rj')) != 0: defs.rj = qc.stof(qc.world.infokey('rj')) if defs.deathmatch == 4: qc.self.ammo_shells = 0 if qc.stof(qc.world.infokey('axe')) == 0: qc.self.ammo_nails = 255 qc.self.ammo_shells = 255 qc.self.ammo_rockets = 255 qc.self.ammo_cells = 255 qc.self.items |= defs.IT_NAILGUN qc.self.items |= defs.IT_SUPER_NAILGUN qc.self.items |= defs.IT_SUPER_SHOTGUN qc.self.items |= defs.IT_ROCKET_LAUNCHER # self.items = self.items | IT_GRENADE_LAUNCHER; qc.self.items |= defs.IT_LIGHTNING qc.self.items = qc.self.items - (qc.self.items & (defs.IT_ARMOR1 | defs.IT_ARMOR2 | defs.IT_ARMOR3)) + defs.IT_ARMOR3 qc.self.armorvalue = 200 qc.self.armortype = 0.8 qc.self.health = 250 qc.self.items |= defs.IT_INVULNERABILITY qc.self.invincible_time = 1 qc.self.invincible_finished = qc.time + 3 if defs.deathmatch == 5: qc.self.ammo_nails = 80 qc.self.ammo_shells = 30 qc.self.ammo_rockets = 10 qc.self.ammo_cells = 30 qc.self.items |= defs.IT_NAILGUN qc.self.items |= defs.IT_SUPER_NAILGUN qc.self.items |= defs.IT_SUPER_SHOTGUN qc.self.items |= defs.IT_ROCKET_LAUNCHER qc.self.items |= defs.IT_GRENADE_LAUNCHER qc.self.items |= defs.IT_LIGHTNING qc.self.items = qc.self.items - (qc.self.items & (defs.IT_ARMOR1 | defs.IT_ARMOR2 | defs.IT_ARMOR3)) + defs.IT_ARMOR3 qc.self.armorvalue = 200 qc.self.armortype = 0.8 qc.self.health = 200 qc.self.items |= defs.IT_INVULNERABILITY qc.self.invincible_time = 1 qc.self.invincible_finished = qc.time + 3