AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Couple a questions in one post. (https://forums.alliedmods.net/showthread.php?t=5846)

Trp. Jed 09-14-2004 17:22

Couple a questions in one post.
 
Figured I'l put them all in one..

1) Is it possible to detect what caused damage to a player? For example, if you were shot and lost 10hp, is there an event or something that can be trapped that will return the name or ID os the weapon that hit you?

2) Akin to the above, I'm wondering if its possible to detect if damage to you was caused by a grenade and if its possible to trap when a grenade explosion takes place and get the location where it occured.

3) Looking at a couple of sprite related plugins, is it possible in some way to make the sprite only visible to a certain playing? The idea being that when you place your crosshairs over a player you see a sprite for them but no-one else can, when you move away it goes.

Freecode 09-14-2004 17:36

1/2. Yes. Damage/Death event

3. Dont think so

Trp. Jed 09-14-2004 17:45

O.K. Another quick one...

Whats the best techique to "throw" a model in the same way as a grenade? I.E use triggers the event (say via a bind) and a model is thrown with a certain velocity in the direction their aiming. I know gibs work in a similar way and correctly bounce off walls and come to rest on floors so I'm assuming theres some sort of function that can do this?

Freecode 09-14-2004 17:47

u wanna change grenades model?

Trp. Jed 09-14-2004 17:55

No, I want to retain them, I just want to create my own function which effectively "fires" off a model as it it were a grenade.

Freecode 09-14-2004 17:58

create an entity set its movetype and its model.

Trp. Jed 09-14-2004 18:31

OK so let me see if I've got your right...

Code:

new iThrowable = create_entity( <classname> )
entity_set_model( iThrowable, <model name> )

new Float:fOrigin[3]
entity_get_vector( id, EV_VEC_origin, fOrigin )
entity_set_origin( iPlayerSprite, fOrigin )

entity_set_int( iThrowable, EV_INT_movetype, MOVETYPE_BOUNCE )
entity_set_int( iThrowable, EV_INT_solid, SOLID_NOT )

I think thats what you said, i.e create the entity, set its model, origina dn movetype. But how do I actually "throw" it in the direction the user is aiming at at a certain velocity?

Oh I forgot to ask, what classname should I use for the entirty? info_target?

twistedeuphoria 09-14-2004 18:37

On #3 doesn't WAR3FT have sprites that only the player aiming at the certain player can see? (The race sprites)

Trp. Jed 09-14-2004 18:43

Don't know, need to look into that.

Johnny got his gun 09-15-2004 02:12

You can try to set the entity's velocity in order to "give it a kick in the right direction":

Code:
entity_set_vector(yourentity, EV_VEC_velocity, {0.0, 0.0, 100.0})

...would send it straight up with a velocity of "100.0" in this case. It's like X*Z*Y, where Y is up and down.


All times are GMT -4. The time now is 17:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.