Post your scripting questions / solutions here
Moderator: Moderators
Elgan
Site Admin
Posts: 890 Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:
Post
by Elgan » Wed Dec 08, 2004 4:29 pm
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?
jv_map
Site Admin
Posts: 6521 Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:
Post
by jv_map » Wed Dec 08, 2004 6:27 pm
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 (proje
c tile
) and also use local.weap projectile someprojectile.tik instead of local.weap.projectile = someprojectile.tik
Elgan
Site Admin
Posts: 890 Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:
Post
by Elgan » Wed Dec 08, 2004 6:44 pm
oops (
dman spelling. i tried that way first but i obv spelt it wrong .tut
Rookie One.pl
Site Admin
Posts: 2752 Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:
Post
by Rookie One.pl » Wed Jan 26, 2005 4:07 pm
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?
Rookie One.pl
Site Admin
Posts: 2752 Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:
Post
by Rookie One.pl » Wed Jan 26, 2005 9:48 pm
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
Grassy
First Lieutenant
Posts: 221 Joined: Sun Aug 22, 2004 11:36 am
Post
by Grassy » Thu Jan 27, 2005 6:22 am
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
Elgan
Site Admin
Posts: 890 Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:
Post
by Elgan » Thu Jan 27, 2005 9:13 am
as aboive it worked i just spelt projectile wrong.
Rookie One.pl
Site Admin
Posts: 2752 Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:
Post
by Rookie One.pl » Thu Jan 27, 2005 9:13 am
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.
Elgan
Site Admin
Posts: 890 Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:
Post
by Elgan » Thu Jan 27, 2005 9:30 am
if its custom stuff why dont u just make a new projectile tik of a healthbox that is a projectile and shoot it.
Rookie One.pl
Site Admin
Posts: 2752 Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:
Post
by Rookie One.pl » Thu Jan 27, 2005 1:56 pm
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.