Raised This Month: $51 Target: $400
 12% 

SourceMod Commands with triggers in hammer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Atgood125
Junior Member
Join Date: Feb 2011
Old 01-22-2012 , 09:51   SourceMod Commands with triggers in hammer
Reply With Quote #1

I'm trying to create a level in tf2, and i cant figure out how to get a trigger to do a sourcemod command to the person who activated the trigger. The command is sm_giveitem, and i want it to have it give a certain item to the activator, how can i do so?
Atgood125 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-22-2012 , 09:56   Re: SourceMod Commands with triggers in hammer
Reply With Quote #2

So should this work only certain players or anyone ?
Bacardi is offline
Atgood125
Junior Member
Join Date: Feb 2011
Old 01-22-2012 , 10:01   Re: SourceMod Commands with triggers in hammer
Reply With Quote #3

Any player that steps into the trigger.
Atgood125 is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 01-22-2012 , 10:20   Re: SourceMod Commands with triggers in hammer
Reply With Quote #4

You're going to have to use sdkhooks for this.
__________________
Dr. McKay is offline
Atgood125
Junior Member
Join Date: Feb 2011
Old 01-22-2012 , 10:34   Re: SourceMod Commands with triggers in hammer
Reply With Quote #5

Can you further explain how i would need to use sdkhooks?
Atgood125 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-22-2012 , 11:44   Re: SourceMod Commands with triggers in hammer
Reply With Quote #6

I have done now without sdkhooks...

Ok, I made test map. Hope you can open that file and compile with Hammer.
You see how I made trigger_multiple
Just move ...steam/steamapps/account/sourcesdk_content/tf/mapsrc/

MAP
So I added trigger_multiple, give it name "map_test_trigger_123".
Set reset delay 10 seconds (so they can't spam it)
Then I added outputs:
OnTrigger
map_test_trigger_123
(trigger own name)
FireUser1


Plugin
Here simple plugin. It slap player 1 dmg when touch trigger. (sm_slap #userid 1)
- Plugin hook event teamplay_round_start to find trigger_multiple again because most entyties reset when game start.
- Find all trigger_multiple from map and check targetname.
- When targetname match, stop looking further triggers and hook trigger output.
- Then when player touch trigger, pam.
test trigger output


Hope not too difficult.
Somebody else could do better way

*edit
You better have test server where installed MM:S, SM and map
Attached Files
File Type: zip tf_test.zip (1.6 KB, 163 views)
File Type: sp Get Plugin or Get Source (test.sp - 466 views - 1.0 KB)

Last edited by Bacardi; 01-22-2012 at 11:55. Reason: Get targetname, not check
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-28-2012 , 08:12   Re: SourceMod Commands with triggers in hammer
Reply With Quote #7

For @Snaggle

How change player gravity when inside trigger and outside trigger...
I test using trigger_multiple outputs
- "OnEndTouch"
- "OnStartTouch"

There could happen when player is inside trigger and round restart (players spawn), gravity not change on player.
So I added more code to trace player when inside trigger and check it when player spawn.

And avoid log spam, I use SM function to straight change plaeyr gravity instead admin command.
code
Attached Files
File Type: sp Get Plugin or Get Source (test.sp - 610 views - 1.9 KB)
File Type: zip tf_test.zip (1.8 KB, 127 views)
Bacardi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:01.


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