Smoke Grenade Depleted

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
Firefox
Colour Sergeant
Posts: 90
Joined: Sun May 07, 2006 3:23 pm
Location: USA
Contact:

Smoke Grenade Depleted

Post by Firefox »

Hello,
I am making a smoke grenade mod for my clan I am just wondering, how would I script the smokenade so that when it gets depleted it would display a messege "Your Smoke Grenade has been Depleted!"

Thanks,
Firefox
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 »

Well, there are 2 ways.

One is very simple and kind of cheatish - you just wait for the moment the player tosses the nade, wait for a certain amount of time and show him a message that it has ran out of smoke. However, this will require changes every time the smoke nades' life times are changed as well.

The other one is more tricky, because you need to track the nade owner and keep this information between two entities (the thing is that the projectile model is removed after 4 seconds and then the explosion model is spawned, which means you can't keep any info in the entity itself). This would require implementing some kind of level-wide event queue and calling scripts from inside of TIKI files.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
Firefox
Colour Sergeant
Posts: 90
Joined: Sun May 07, 2006 3:23 pm
Location: USA
Contact:

Post by Firefox »

well ok,
Doesnt it already make it so that if u make the smoke deadly and u walk through your own and kills you? Couldnt you modify this to make it messege you after a certain amount of time about your own smoke? (I think this would still reqiure map script change tho)

Plus what command would I use to make the smoke messege. Im thinking that when you throw it after a certain amount of time it displays a messege but only to you.

Thanks,
Firefox
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 »

Sorry m8, but I did not understand a word of what you said. :? Could you rephrase?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
Firefox
Colour Sergeant
Posts: 90
Joined: Sun May 07, 2006 3:23 pm
Location: USA
Contact:

Post by Firefox »

ok let me retype this.... darn....


Ok.... scartch that it won't work.

well basicly what I would like to know is what I should put in the script so it would display a messege after a the grenade is triggered to release smoke.
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 »

So basically you want it done for you? :?

Well, first, you'd have to call the script by inserting:

Code: Select all

first exec global/yourscriptsname.scr
In the server section of the idle animation in the smoke nade's TIKI file. Then in the script you can just insert this:

Code: Select all

main:
   parm.owner commanddelay 33 iprint "Your smoke grenade has depleted" // smoke nades last for 33 seconds
end
Commanddelay is more efficient and secure than waiting because it already adds the event to the entity but with a forward timestamp. :)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
Firefox
Colour Sergeant
Posts: 90
Joined: Sun May 07, 2006 3:23 pm
Location: USA
Contact:

Post by Firefox »

k thanks! :P
User avatar
Firefox
Colour Sergeant
Posts: 90
Joined: Sun May 07, 2006 3:23 pm
Location: USA
Contact:

Post by Firefox »

Ok one more thing this isnt working out fer me...

I have 3 files
-M18_Smoke_Grenade.tik
-M18_Smoke_Grenade_base.txt
-M18_Smoke_Grenade_Start.tik

Which one should I put it in? I suspect
-M18_Smoke_Grenade_base.txt

but im not sure heres what I have in there

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
setup
{
scale 0.52 // Set default scale to 16/30.5 since world is in 16 units per foot and model is in cm's
path models/weapons/M18_smoke_grenade
skelmodel M18_smoke_grenade.skd
surface m18_smoke_gren shader M18_smoke_gren
surface pin shader M18_smoke_gren
}

init
{
server
{
classname Weapon
weapontype grenade
name "M18 Smoke Grenade"
rank 540 540
weaponsubtype 1 // differentiates smoke grenades from regular grenades

pickupsound smokegrenade_snd_pickup
ammopickupsound smokegrenade_snd_pickup_ammo
noammosound m2frag_snd_noammo

// Holstering info
// holstertag "Bip01 Spine1"
// holsteroffset "3.12 10.5 3.64"
// holsterangles "20 -40 0"
// holsterScale 1.0

// Primary fire type info (fast, arcing throw)
firetype projectile
ammotype "smokegrenade"
projectile models/projectiles/M18_smoke_grenade_primary.tik
semiauto
clipsize 1
ammorequired 1
firedelay 0.75
maxchargetime 4.0
minchargetime 0.6
crosshair 1
quiet // don't notify AI of it being fired
autoputaway 1 // automatically put the weapon away when out of ammo
usenoammo 0 // don't allow it to be used when it has no ammo
movementspeed 1.0

sp startammo 1
dm startammo 0
sprealism startammo 1
dmrealism startammo 0

// Secondary fire type info (more controllable, straight throw)
shareclip
secondary firetype projectile
secondary ammotype "smokegrenade"
secondary projectile models/projectiles/M18_smoke_grenade.tik
secondary clipsize 1
secondary ammorequired 1
secondary firedelay 0.75
secondary maxchargetime 1.5
secondary minchargetime 0.5

// AI animation group info
weapongroup grenade
}
client
{
cache models/projectiles/M18_smoke_grenade_primary.tik
cache models/projectiles/M18_smoke_grenade.tik
}
}

animations
{
raise M18_smoke_grenade.skc
{
// if we're pulling out grenades, we've definatly got 'em
server
{
enter surface all -nodraw
}
}
idle M18_smoke_grenade.skc
{
server
{
enter surface all -nodraw

}
}

// this should make sure that it doesn't look like there's a grenade in hand when you don't have one
idle_empty M18_smoke_grenade.skc
{
server
{
enter surface all +nodraw
}
}

charge M18_smoke_grenade_charge.skc
{
server
{
8 surface pin +nodraw
}
client
{
enter sound smokegrenade_snd_grenade_pull weapon

8 tagspawn tag_pin
(
count 1
model models/ammo/grenade_pin.tik
life 1
randvelaxis range 25 30 0 0
accel 0 0 -330
avelocity crandom 30 crandom 30 crandom 30
)
}
}

secondarycharge M18_smoke_grenade_charge.skc
{
server
{
8 surface pin +nodraw
}
client
{
enter sound smokegrenade_snd_grenade_pull weapon

8 tagspawn tag_pin
(
count 1
model models/ammo/grenade_pin.tik
life 1
randvelaxis range 25 30 0 0
accel 0 0 -330
avelocity crandom 30 crandom 30 crandom 30
)
}
}

fire M18_smoke_grenade.skc
{
server
{
first shoot
first surface all +nodraw
}
client
{
first sound smokegrenade_snd_grenade_throw weapon
}
}
secondaryfire M18_smoke_grenade.skc
{
server
{
first shoot secondary
first surface all +nodraw
}
client
{

first exec global/smokenade.scr
first sound smokegrenade_snd_grenade_throw weapon

}
}

reload M18_smoke_grenade.skc
{
server
{
first sound smokegrenade_snd_reload weapon
first surface all -nodraw

}
}
}
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

The red is what I put in

is this right?

sorry for being a noob......lol
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 »

I wrote server section, not client section.

And use the model from models/projectiles instead of models/weapon.

Geez. :roll:
Last edited by Rookie One.pl on Wed Jun 28, 2006 4:26 pm, edited 1 time in total.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
Firefox
Colour Sergeant
Posts: 90
Joined: Sun May 07, 2006 3:23 pm
Location: USA
Contact:

Post by Firefox »

o dang sry I read that before but forgot...... :oops:
thanks
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

complete hijack but could commandelay be used in scripts such as burst-fire mods and such? i know wait freezes your controls while it executes the script.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
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 »

Yeah. :) As I said, it adds the event to entity's event queue but with a forward timestamp, which makes it being executed with delay without blocking the thread.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply