Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

Entwining eventscripts and hammer to triger events

A Tutorial for Source Engine

No ads for members. Membership is 100% free. Sign up!

Shows u how to use eventscripts to open a door in hammer.

Introduction Ok Well you are probably scratching your wondering what this tutorial is all about. Well it is quite simple. We are going to use a combination of Hammer editor and Mattie's EventScripts to trigger events in the map. For those of you who do not know what EventScripts is, I suggest you read through it and learn the basics before attempting this tutorial, as I am going to assume you have some basic knowledge when I explain the steps. All the information about EventScripts can be found here. Ok, our goal for today is to create an admin only door. The door will open when the user says a command. STEP ONE: Entities Needed Ok what you will need to do is create a door in your map, untick all the flags except for toggle and name the door Admin\_only\_door. We are also going to need a logic\_auto entity, and a point\_servercommand entity. STEP TWO: Configuring the script Ok we will need to get the basic script done before we do continue in hammer. First thing is first, open up a notepad document and add the following:
block load
{
	// Add as many as you want. People with these SteamIds will be able to access the door.
	es_xsetinfo admin_only_door_check "STEAM:X:X:XXXXXX ; STEAM:X:X:XXXXXX"
	es_xmsg Admin_door Loaded
}

event player_say
{
	if (event_var(text) == "!open") do
	{
		if (event_var(es_steamid) in server_var(admin_only_door_check) do
		{
			es_fire event_var(userid) Admin_only_door open
			es_tell event_var(userid) #multi #greenThe door #lightgreenopens!
		}
		else do
		{
			es_tell event_var(userid) #multi #greenYou lack the permission to use this command!
		}
	}
	if (event_var(text) == "!close") do
	{
		if (event_var(es_steamid) in server_var(admin_only_door_check) do
		{
			es_fire event_var(userid) Admin_only_door close
			es_tell event_var(userid) #multi #greenThe door #lightgreenopens!
		}
		else do
		{
			es_tell event_var(userid) #multi #greenYou lack the permission to use this command!
		}
	}
}
Ok now in this code you will be able to see there is a space that needs configuring. Just change the Steam ID's in there to the ones desired. What is going to happen, is when the command !open is typed by a verified steam id, it will open the door, and same for !close. Save the above script under the name: es\_admin\_door then save it into a folder called admin\_door STEP THREE: piecing it all together Create the point\_servercommand anywhere in your map and name it "Command". Now, we will get back into hammer, and create the entity logic\_auto. In this entity, we want to add the specified output:
OnMapSpawn
Command
Command
es\_load admin\_door
0.00
This tells the game to load the script on map spawn, so the server host does not need to manually put it in the cfg files etc. Summary Ok we have basically created a script giving authorization to a handful of players to open a special door. This is useful on maps like surf, zombie etc, but can be transformed into anything, like triggers etc. All the trigger work is done in the script, but the results show in the map. Anyway, I hope this helped, and if it did, leave some feed back and approve it :) Thanks guys, happy mapping/scripting.

Comments

Sign up to access this!
1-10 of 11
1
Halaman
  • 1
  • 2
Buka halaman:
  • im_the_new_guy avatar
    im_the_new_guy username pic Joined 11y ago
    Offline
    16,152 points Ranked 337th
    24 medals 2 legendary 3 rare
    • Submitted 50 Maps Medal icon
    • 10 years a member Medal icon
    • 6 years a member Medal icon
    • Returned 1000 times Medal icon
    • Submitted 20 Maps Medal icon
    • Mapper of the Month, November 2013 Medal icon
    access_time 9y
    @gippo For those of you who do not know what EventScripts is, I suggest you read through it and learn the basics before attempting this tutorial, as I am going to assume you have some basic knowledge when I explain the steps. That is what we classify as the basics; knowing where to put ur scripts...
    Creator of Hide N Seek mod
    URL to post:
  • gippo avatar
    gippo Joined 12y ago
    Offline
    225 points Ranked 54362nd
    access_time 9y
    There is a problem with this tutorial, you did not tell us what to do with the admin_door folder after saving the txt file in there. Also, is there a way to pakrat the script into the map. I would like to use an eventscripts that will make my map only playable in my server.
    Bananite
    URL to post:
  • HellRaisedSurfer avatar
    HellRaisedSurfer Joined 12y ago
    Offline
    951 points Ranked 41109th
    access_time 9y
    @Exfridos in that case its easier to: 1: Create trigger 2: give trigger settings/name 3: create logic_timer 4: set time to your delay (in seconds) 5: Add output "ontimer, trigger_teleport disable/enable" if thats what you meant, pretty simple tutorial, you could have explained the different inputs to, to explain what it does. even tho i use "equalto" instead of "=="
    Surfing Fevah!
    URL to post:
  • im_the_new_guy avatar
    im_the_new_guy username pic Joined 11y ago
    Offline
    16,152 points Ranked 337th
    24 medals 2 legendary 3 rare
    • Submitted 50 Maps Medal icon
    • 10 years a member Medal icon
    • 6 years a member Medal icon
    • Returned 1000 times Medal icon
    • Submitted 20 Maps Medal icon
    • Mapper of the Month, November 2013 Medal icon
    access_time 9y
    I'm unsure what it is you want to do. The event_var is in reference to the player who is typing !open into chat. It then checks the players steam id and fires the door to be open. So if you wanted the teleport to enable on the start of the round. You would do: [code] event round_start { es_xset rand_player 0 es getrandplayer rand_player #all es_fire server_var(rand_player) trigger_teleport enable 180 } [/code] Just post back if I missed your question completely.
    Creator of Hide N Seek mod
    URL to post:
  • Exfridos avatar
    Exfridos Joined 12y ago
    Offline
    7 medals 1 legendary 1 rare
    • 10 years a member Medal icon
    • 6 years a member Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    • 2 years a member Medal icon
    access_time 9y
    Great tutorial. I just have a question.. How do I set it up under event round_start? I'm not sure about the event_var part. Cause its not a specific player? I tried like this: event round_start { es_delayed 180 es_fire trigger_teleport enable } (note that the trigger IS named that) Do I need some kind of event_var or server_var? Thanks.
    Exi
    URL to post:
  • im_the_new_guy avatar
    im_the_new_guy username pic Joined 11y ago
    Offline
    16,152 points Ranked 337th
    24 medals 2 legendary 3 rare
    • Submitted 50 Maps Medal icon
    • 10 years a member Medal icon
    • 6 years a member Medal icon
    • Returned 1000 times Medal icon
    • Submitted 20 Maps Medal icon
    • Mapper of the Month, November 2013 Medal icon
    access_time 10y
    I'm not entirely sure if pack rat will work, personally I haven't tried. I would recommend uploading them as a pair, that way the admin can simply extract the files in the correct locations and your done.
    Creator of Hide N Seek mod
    URL to post:
  • delete_me_ avatar
    delete_me_ Joined 11y ago
    Offline
    access_time 10y
    So do you have to Pakrat the script or do you have to put it on the server?
    URL to post:
  • im_the_new_guy avatar
    im_the_new_guy username pic Joined 11y ago
    Offline
    16,152 points Ranked 337th
    24 medals 2 legendary 3 rare
    • Submitted 50 Maps Medal icon
    • 10 years a member Medal icon
    • 6 years a member Medal icon
    • Returned 1000 times Medal icon
    • Submitted 20 Maps Medal icon
    • Mapper of the Month, November 2013 Medal icon
    access_time 10y
    Haha. I am actually working on a method of being able to interact with the map as though it was all scripted. For example, walking up to a shop and selecting a weapon, and having the money come out of the players cash. Also, being able to walk into the bank and deposite money and also allowing players to purchase real estate etc using the filters in hammer and other methods in es. Fucken hard at the moment, but I think I have an idea of how to do it.
    Creator of Hide N Seek mod
    URL to post:
  • The Distraction avatar
    The Distraction Joined 10y ago
    Offline
    access_time 10y
    Yay [adds secret teleporter to map]
    Battle Medic
    URL to post:
  • im_the_new_guy avatar
    im_the_new_guy username pic Joined 11y ago
    Offline
    16,152 points Ranked 337th
    24 medals 2 legendary 3 rare
    • Submitted 50 Maps Medal icon
    • 10 years a member Medal icon
    • 6 years a member Medal icon
    • Returned 1000 times Medal icon
    • Submitted 20 Maps Medal icon
    • Mapper of the Month, November 2013 Medal icon
    access_time 10y
    As long as you edit the steam ids in the txt file it all runs off map because of the logic_auto.
    Creator of Hide N Seek mod
    URL to post:

Embed

menu
Kirim banner
Foto URL
Kode embed HTML
Kode embed BB
Kode embed markdown

Credits

Key Authors
I'm the new guy, go easy :D
Writer

Submitter

im_the_new_guy avatar
im_the_new_guy username pic Joined 11y ago
Offline
16,152 points Ranked 337th
24 medals 2 legendary 3 rare
  • Submitted 50 Maps Medal icon
  • 10 years a member Medal icon
  • 6 years a member Medal icon
  • Returned 1000 times Medal icon
  • Submitted 20 Maps Medal icon
  • Mapper of the Month, November 2013 Medal icon
im_the_new_guy avatar
im_the_new_guy

Creator
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

Details

Difficulty Level
Intermediate

Attributes

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • favorite 0
  • remove_red_eye 7.3k
  • mode_comment 12
  • access_time 10y
  • access_time 6y

More from Submitter

menu

More Mapping Tutorials