Using scripting to pick up objects?...

Mapping support for the Source engine.
User avatar
Posts: 322

Using scripting to pick up objects?...

Post by insane3004 » 26 Dec 2016, 22:13

So let's say I have a prop_physics called "event_saw_prop"... How would I go about making it so that a player could pick it up?... Like the mines in the Holdout mutation...

I've looked it up... I've looked at other mods to have it... And there is something very obvious I must be missing, because I've had no luck thus far...
"..."

The Neverglades
End of the Line
Haunting Grounds - Sawrunner

User avatar
Posts: 158

Re: Using scripting to pick up objects?...

Post by greenhood » 27 Dec 2016, 07:23

Probably with custom vscript atached to entity or replace gnome model with your custom model.

User avatar
Posts: 627

Re: Using scripting to pick up objects?...

Post by Roflmahwafflz » 28 Dec 2016, 05:27

Are you looking for something like what Neil was working on a few years back?
https://www.youtube.com/watch?v=fL1s1h_NGBA

His system was able to pickup prop_physics and brush entity physics and throw/propel or set it down. He ran it using a global script so every prop_physics was movable, but if you obtained the script it might be possible to put a filter on it somehow?

The only detractor into looking into this was it was made using a custom scripting utility as opposed to what was available at the time, I believe it was called Hammercode; I think he and rayman developed it. Not sure if the features of their utility were implemented with valve's overhaul of vscripts.

Im sure Rayman would be able to help you, I think he is still around somewhere.
I used to link my maps I have published here, but the list got too long so to keep my posts shorter in length I removed the links.

User avatar
Posts: 98

Re: Using scripting to pick up objects?...

Post by Rectus » 28 Dec 2016, 11:23

The pickup feature in Holdout works by adding a function called "CanPickupObject" in the game mode VScript. The game calls this function every time you try to use a physics prop, and if it returns true, you pick it up. The game passes a handle to the prop to the function, so you'll have to add some logic in there to determine which props to allow. See holdout.nut line 107 for an example.

This feature is only enabled for mutations, but it's possible to make it work with normal game modes as well by adding a mode script for them (e.g. coop.nut) with the function in it.

The system Neil made is completely separate, and it's still available in VSLib.


Return to Source SDK