Page 1 of 1

on the fly changing projectile?

Posted: Wed Dec 08, 2004 4:29 pm
by Elgan

Code: Select all

hid:
iprintln "change"

		local.player=parm.other
		local.randnum = randomint 1000
		local.player weaponcommand dual targetname ("weap" + local.randnum)
		local.weap = $("weap" + local.randnum)
		// local.weap.targetname = ""

		iprintln local.weap

		local.weap.projetile = "models/arrow/project__explode.tik"

		local.weap.dmprojetile = "models/arrow/project__explode.tik"

		
end
//alternate
		parm.other take models/weapons/bazooka.tik
		
		local.player give models/weapons/bazooka2.tik

end

can i do anything like that? is there a way?

Posted: Wed Dec 08, 2004 6:27 pm
by jv_map
Yes I think you can change the projectile, not literally 'on the fly' but changes would take effect next time the weapon is fired. You just gotta spell it right (projectile ;)) and also use local.weap projectile someprojectile.tik instead of local.weap.projectile = someprojectile.tik :)

Posted: Wed Dec 08, 2004 6:44 pm
by Elgan
oops ( :wink:

:shock: :mrgreen: dman spelling. i tried that way first but i obv spelt it wrong .tut

Posted: Wed Jan 26, 2005 4:07 pm
by Rookie One.pl
I don't want to start a new topic so I'll post my question here.

I've got a custom weapon that shoots a custom projectile. What I'd like to do is when someone fires this weapon, replace the projectile with a health box (which IS NOT a projectile). I've done this so far:

Code: Select all

main:
   (...)
   level waittill spawn
   thread projectileWatch
   (...)
end

projectileWatch:
   local.trg = spawn trigger_multiple
   local.trg.spawnflags = 16
   local.trg.origin = (0 0 0)
   local.trg setsize (-8192 -8192 -8192) (8192 8192 8192)
   while (1) {
      local.trg waittill trigger
      local.prjctl = parm.other
      if (local.prjctl.model = "models/projectiles/my_custom_projectile.tik")
      {
         local.healthbox = spawn models/items/item_25_healthbox.tik origin local.prjctl.origin angles local.prjctl.angles
         local.healthbox item_droptofloor
         local.healthbox set_respawn 0
      }
      waitframe
   }
end
However, this doesn't work... :( Any ideas?

Posted: Wed Jan 26, 2005 9:48 pm
by Rookie One.pl
Sorted the above thing out... Should be:

Code: Select all

main:
   (...)
   level waittill spawn
   thread projectileWatch
   (...)
end

projectileWatch:
   local.trg = spawn trigger_multiple spawnflags 20 origin ( 0 0 0 ) angles ( 0 0 0 )
   local.trg setsize ( -8192 -8192 -8192 ) ( 8192 8192 8192 )
   while (1) {
      local.trg waittill trigger
      local.prjctl = parm.other
      if (local.prjctl.model == "models/projectiles/my_custom_projectile.tik")
      {
         local.healthbox = spawn models/items/item_25_healthbox.tik origin local.prjctl.origin angles local.prjctl.angles
         local.healthbox item_droptofloor
         local.healthbox set_respawn 0
         local.prjctl delete
      }
      waitframe
   }
end

Posted: Thu Jan 27, 2005 6:22 am
by Grassy
To Rookie One
Thats a big trigger, does it cover the whole map?

To Elgan,
So how did you go with your problem mate? Any news?

Grassy

Posted: Thu Jan 27, 2005 9:13 am
by Elgan
as aboive it worked i just spelt projectile wrong.

Posted: Thu Jan 27, 2005 9:13 am
by Rookie One.pl
Grassy wrote:To Rookie One
Thats a big trigger, does it cover the whole map?
Yeah, that's what I wanted to achieve. :) I looked up the farthest values on the grid in Radiant and that's how I got these dimensions.

Posted: Thu Jan 27, 2005 9:30 am
by Elgan
if its custom stuff why dont u just make a new projectile tik of a healthbox that is a projectile and shoot it.

Posted: Thu Jan 27, 2005 1:56 pm
by Rookie One.pl
Because if I set the model to healthcanteen.skd, the game crashes when I click fire. :? Already tried a few ways to do this including changing the explosion fx tik to the health canteen, but it doesn't give you any health, disappears after some 5 seconds and tends to levitate in the air. :?