Welcome New User Home | Forums | Register | Login | Larger Font
Main-Menu
Home
Login
Register
Add Download
Add News
Add Tutorial *
Forums

Advertise
Affiliate Store US *
Affiliate Store UK *
Affiliate Store CA *
Angry Letter Generator
Avatar Upload
Calendar of Games
Contact
Downloads
FAQs
Forums
Member List
Member Projects
News
News Grabber *
Policy
Polls
Private Messages
Reviews
Screenshot Gallery
Search
Servers - Game
Store - Shirts *
Subscribe
Topics
Tutorials
Weblinks
Tutorials
CoD Mapping
CoDUO Mapping
CoD2 Mapping
CoD4 Mapping
CoD FAQs
HL2 Mapping
HL2 FAQs
SOF1 Mapping
Crysis Mapping
Q4 Mapping
Doom 3 Mapping
Doom 3 FAQs
UT2K3 Mapping
SOF2 Mapping
SOF2 FAQs

Lightray Modeling
General Modeling
General Modding
Adobe Photoshop
Common Mapping Errors

Readme.txt Generator
Members-Online
82ndAB-Talon [Forum]
kegwad [Tutor]

2 Members and 16 Guests
Chat MODSonline
0 People Now Chatting
MODSOnline TeamSpeak

download TeamSpeak

In-The-News
Friday, Jul. 4th
MODSonair Episode 134
Thursday, Jul. 3rd
Happy 4th of July
Monday, Jun. 30th
Major Retailer Confirms 360 Price-Cut
Sunday, Jun. 29th
MODSonair 134 Live
Friday, Jun. 27th
MODSonair Episode 133
Latest Poll
Want a MODSonline Wiki for various games?
I think a Wiki would be a great addition to MODSonline. 78.67%
I could see a benefit of a Wiki. 6.67%
I think it would take away from the community. 6.67%
Wiki sites are never good. 2.67%
Wiki... isn't that Buck Roger's robot slave? 5.33%
Read More...
7 comments

Newsletter
Name:
Email:
Newsletter Archives
Your Membership
User Name:
Password:
Register.
In The Forums
help ,for a good sentence.
CoD 2 Level Desi.. Posts: (2) Views: (25) by AnythingButt
Elevator model problem
CoD Level Design.. Posts: (1) Views: (18) by Tragic
Comiler Problem
CoD 2 Level Desi.. Posts: (3) Views: (31) by jmcke149
A Lunch / Bounce pad?
CoD 4 Level Desi.. Posts: (1) Views: (20) by sinner4
Art of War Central Half-Life 2 Mods for Dummies
Tutorials: SOF1 Mapping
Mapping and modding for Soldier of Fortune.
Add your tutorial (registered users)

Rating:
Awful Rating Poor Rating Average Rating Good Rating Excellent Rating
Versions: You must be logged in to view history.
Assigning entity names
2006-10-20 16:02:20
Learn how to assign entity names.
We are not going to do anything complicated in this lesson
This is hopefully going to help you understand the assigning of entity names in a script

To illustrate this - let us imagine we have a map created in which the player has just reached a door
We want the door to open automatically and on the other side of the door is an enemy guy with a shotgun


In the map...

We will use a nyc bot so put in the map worldpawn...

key=ainame
value=tsr1

Instead of this you can put the ainame into the map title - calling the map something like...

coop_downtown_ger3.bsp

or...

Frozen_sib1.bsp

etc


The enemy guy is set to be "trigger_spawned" in his entity properties box. He has a targetname of "guy1"

We also have the door - in the map we have given it a targetname of "doorX"

In front of the door we have a trigger_once which is pointed / targetted at a script_runner


In the properties of the script runner, we have to tell it what script we are using - for the moment let us put


script = door/guy1

We can compile the map now...

-------------------------------------------------
All scripts for any map should be in a folder in user/ds or base/ds. A script runner will always "look" in the ds folder for it's scripts

Because we have pointed the script_runner in the map to door/guy1, we need a folder called user/ds/door to put our script in

When we make our script in Notepad, we will save it as guy1.ds and compile it into guy1.os and put it in the user/ds/door folder
--------------------------------------------------

OK - we are ready to make a simple script to carry out our desired actions

Use the blank script as described in Lesson 1

So - we already have the first 2 lines in our script which are...

#include "../common/header.ds"
output "C://sample/ds/test"

These lines will be present in all scripts unless you change the name of your output folder

Each script is split into 3 sections after this -

1.Declaration of variables (entities)
2.Assigning variables
3.Script proper (= animation bit)

Now - what do these mean?

Section 1 - Declaring - we are making up names for the entities to use IN THE SCRIPT - ie NOT IN THE MAP

For example - We have 2 entities that we want to manipulate - the guy and the door

In this script we only use what is called a "Local" entity (explained later)

For the script only - we will call him punk1 (remember in the map this has targetname of "guy1")

Also for the script we will call the door simply - "door" (remember in the map this has targetname of "doorX"

The names are given to make the script easier to understand - some scripts are very long and complicated

Even if you have targetnames in the MAP such as t1234 etc - these can be called more meaningful names for the script

The script looks like this now....


#include "../common/header.ds"
output "C://sample/ds/test"

local entity punk1
local entity door




So the script knows now that we have 2 items to manipulate - 2 "local entities"

We now have to tell the script what these entities are in the map. This is the assigning bit....

punk1 = find entity with targetname "guy1"
door = find entity with targetname "doorX"

Now - every time we refer to punk1 or door in our script - it (the script) will know that we are talking about the guy1 and doorX in the map

Now for some scripting proper...


Use entity punk1


This is the simplest command and can be used to "fire" anything in the map. Because we have "used" an enemy entity that is trigger_spawned - he appears in the map now - As soon as the trigger_once in the map is touched, the enemy bot will appear behind the door

Next line....

use entity door

This triggers the door the same as if it had been triggered by a button etc so the door just opens. Let us add a simple "wait" command between the guy appearing and the door opening - only 2 seconds or so. The line would be

wait 2 seconds

So far our complete script looks like this...
--------------------------------------------------

#include "../common/header.ds"
output "C://sample/ds/test"

local entity punk1
local entity door

punk1 = find entity with targetname "guy1"
door = find entity with targetname "doorX"

use entity punk1
wait 2 seconds
use entity door

--------------------------------------------------

We can save this now as guy1.ds and compile it - put it in the ds/door folder and run the map....

Try it...

You will notice that the door opens and the guy just stands there - this is because he is "tied" to the script and is waiting for another command- we need to "release" him to go about his business (of killing you)

So we use a special command that will be explained in more detail later

For now just add the line...

animate entity punk1 performing action SCRIPT_RELEASE

Since this script is only used once in the map - we can "exit" the script now with the simple command...

exit

So our completed script is now...
----------------------------------------------------------
#include "../common/header.ds"
output "C://sample/ds/test"

local entity punk1
local entity door

punk1 = find entity with targetname "guy1"
door = find entity with targetname "doorX"

use entity punk1
wait 2 seconds
use entity door

animate entity punk1 performing action SCRIPT_RELEASE

exit
---------------------------------------------------------


Compile this and replace the script in the ds/door folder and run the map again

After a 2 second delay, the door will open and the guy will be on the other side and will immediately attack you

Notice the beauty of scripting here - you can change things and try many different scripts without changing the map at all - you only need to alter the script and reload the same map. Also - many maps can point a script runner to the same script - ie you only need 1 script to try the same effect in many maps

Try making a script that triggers 4 guys - don't worry about making many doors

If you have understood things so far it should now be easy for you to trigger events with time delays etc

Maybe you would like to trigger a sound then open a door and 5 enemy run in a room and start shooting....etc etc etc

Many things are possible with just these basic commands


To understand better, look at some of the declare/assign sections of tsr1 scripts (included in SoFSDK/sample/ds/tsr1 folder)
Try to follow through some of the scripts and figure out what they do

You - like me - will find many commands to try and copy/paste into your own scripts

Indeed - understanding just the script runners can add to your maps

You may find - for example - a script in sof that makes a thunder sound
All you need is the pathname to the script
You do not need to know how the script is written to use it
In your map you would only need to trigger the same script with a trigger + script runner and Voila! Thunder in your map...

Hope this helps...

Demise RDAM

All logos and trademarks and information in this site are property of MODSonline LLC © 2008.
The comments are property of their posters.
RSS news feeds for MODSonline.com can be found News.php.
Intergi
Partners
My Topsites List
Frag Universe
XoXide
Call of Duty Headquarters
Battle for Europe COD2
modbase.be
The Firing Box
Websites4Clans
Ask About
Advertising
Friends
After Life Gaming
SOF2 Files and Downloads
The Clan Database
Ask About
Advertising
Link to Us
MODSonair
View in iTunes
Please help us to raise in the ranks of podcasting and subscribe to our itunes feed using the link above.
MODSonair Releases
MODSonair Episode 134
MODSonair Episode 133
MODSonair Special CoD:WW Episode
MODSonair Episode 132
MODSonair Episode 131
Next Show
The next MODSonair show will air LIVE on:
07/06/2008 11:00 EDT

Time remaining:
Copyright © 2008 MODSonline
Tresware Content Management System Copyright © 2008 Tresware
Website Designed and Hosted   Tresware