PDA

View Full Version : [Weapon] Get Keyvalue from player using weapon



KneeGrow
18-12-2016, 10:49 PM
The weapon I'm trying to create needs its secondary fire to change a player's keyvalue ('effects'), only I don't know how to do get or set a keyvalue.
I know what keyvalue I want to change but I don't know how to access it.

From CBasePlayer section in the angelscript documentation:

void KeyValue(KeyValueData@)
Sets keyvalue data on this entity

What is KeyValueData@ ?

fgsfds
26-12-2016, 06:42 AM
player.pev.effects

KneeGrow
06-01-2017, 01:48 PM
is that an integer value?

KernCore
06-01-2017, 02:43 PM
is that an integer value?

Yes. Please see: http://samvanheer.github.io/SC_Angelscript/docs/entvars_t.htm

pev.effects uses the EFFECTS enum: http://samvanheer.github.io/SC_Angelscript/docs/EFFECTS.htm

KneeGrow
06-01-2017, 03:06 PM
Thanks

One last thing, is there a way for the weapon to decrease its clip over time while effects keyvalue is toggled? (making a 'glow stick', but I want to drain the battery like a flashlight)
Is there a way I can use the player's default flashlight battery? If so, that would be optimal.

KernCore
06-01-2017, 03:27 PM
I'm not sure you can use the flashlight's hook or something like that.
Maybe Nero's Flashlight Plugin might give you an idea of how to it: http://forums.svencoop.com/showthread.php/43640-Plugin-Custom-Flashlight

If you want to check that, do that in ItemPreFrame() or ItemPostFrame()

Nero
22-03-2017, 11:30 AM
Aye, but you can only add a flashlight battery, not hook into the existing one. (I didn't figure it out anyway ^^) Which is why you can use both the base flashlight and the custom one. And they are on separate batteries with overlapping HUD elements. (can't move them)