Welcome, Guest. Please login or register. Did you miss your activation email?

* TUTORIAL SECTION RULES

This section is for SMOD TUTORIALS & GUIDES ONLY.
You may create a new topic in the appropriate area to share your tutorial. If you post anything off-topic here you will be temp-banned. This is so we don't hassle the moderators too much, they are volunteers.

If you need help with a tutorial, post a reply in its thread . Do not start a new topic for help here!

Author Topic: [SMOD] Weapons/Ammo/Suit on Player Spawn  (Read 5228 times)

0 Members and 1 Guest are viewing this topic.

Offline BIZ

  • 32-Bit Hobo
  • *
  • *
  • +0% chance to make useful post
  • BIZ hides in shadows.
    • BSNOOCH.COM
[SMOD] Weapons/Ammo/Suit on Player Spawn
« on: October 12, 2009, 05:25:46 AM »
I know some people have trouble making sure the player has weapons, ammo, and even the HEV suit when they spawn on a custom map in SMOD. The SMOD author simply spawned the items at the players starting origin, but sometimes that doesn't work. This system is almost fool-proof and should be real easy to customize for all of you copy+paste warriors.

Created - 10.07.09



SUREFIRE WEAPONS ON PLAYER SPAWN


I. THE CODE


To start with here is the code you need, please note that this is just an example:

   
Code: [Select]
"entities" {

    "instant_trig" {
    "keyvalues" {
    "timer" "0.1"
    "label" "starting_equipment"
    }
    }

    "point_servercommand" {
    "keyvalues" {
    "targetname" "player_equipment"
    }
    }
    }

    "entities:starting_equipment" {

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "sk_citizen_health 120"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_suit"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give weapon_smg1"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_ammo_smg1;give item_ammo_smg1;give item_ammo_smg1"
    }

II. ENTITIES SECTION

For this code you need to place two entries under the "entities" section of your mapadd.

   
Code: [Select]
"instant_trig" {
    "keyvalues" {
    "timer" "0.1"
    "label" "starting_equipment"
    }
    }

If placed under the "entities" section, this trigger is ran as soon as the map begins. It will call a series of events which will give the player weapons and items amongst other things.

   
Code: [Select]
"point_servercommand" {
    "keyvalues" {
    "targetname" "player_equipment"
    }
    }

This is the backbone of this script, it needs to be spawned at map start, so the "entities" section is the ideal place for it. It will basically let you access the developer console without actually pulling it up.

Once you have these two entities in place, it is time to setup the labeled entity group you set in the trigger.

II. STARTING_EQUIPMENT

This section is where you give the player his weapons/items/ammo. We use an "event" entity that basically works like you are using the console. So you can run pretty much any console command this way. I gave some examples here, you can by all means have more or less events than what I included.

IT IS IMPORTANT TO NOTE: You only need to change the "value" arguement!

   
Code: [Select]
"event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "sk_citizen_health 120"
    }

This an example of how to set a CVAR. Anything you want can be set here, from combine soldier health to infinity ammo cheats!

   
Code: [Select]
"event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_suit"
    }

Here is an example of how to give an item. In this case the HEV suit which enables the flashlight/HUD/sprinting amongst other things. You never have to worry about missing the player this way.

   
Code: [Select]
"event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give weapon_smg1"
    }

An example of how to give the player a weapon. You can give as many or as few weapons as you want.

   
Code: [Select]
"event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_ammo_smg1;give item_ammo_smg1;give item_ammo_smg1"
    }

This is an example of how to give multiple items with one "event" entity. You simply seperate the values with a semicolon ( ; ). You can have as many as you want I believe.

III. FINAL EXAMPLE

Here are two versions of the same Player Loadout. A version with a single "event" and a version with multiple "events". You can decide which version is easier for you to use. I personally use a combonation of both.

SHORT VERSION

   
Code: [Select]
"entities" {

    "instant_trig" {
    "keyvalues" {
    "timer" "0.1"
    "label" "starting_equipment"
    }
    }

    "point_servercommand" {
    "keyvalues" {
    "targetname" "player_equipment"
    }
    }
    }

    "entities:starting_equipment" {

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_suit;give weapon_crowbar;give weapon_physcannon;give weapon_pistol;give weapon_smg1;give weapon_frag;give weapon_frag;give item_battery;give item_battery;give item_ammo_pistol;give item_ammo_pistol;give item_ammo_smg1;give item_ammo_smg1"
    }
    }

LONG VERSION

   
Code: [Select]
"entities" {

    "instant_trig" {
    "keyvalues" {
    "timer" "0.1"
    "label" "starting_equipment"
    }
    }

    "point_servercommand" {
    "keyvalues" {
    "targetname" "player_equipment"
    }
    }
    }

    "entities:starting_equipment" {

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_suit"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give weapon_crowbar"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give weapon_physcannon"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give weapon_pistol"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give weapon_smg1"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give weapon_frag"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give weapon_frag"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_battery"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_battery"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_ammo_pistol"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_ammo_pistol"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_ammo_smg1"
    }

    "event" {
    "targetname" "player_equipment"
    "action" "command"
    "value" "give item_ammo_smg1"
    }
    }
« Last Edit: July 21, 2011, 12:51:49 AM by BIZ »

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal