Top Banner
Mission 2 Message the player https://roderickvella.wordpress.com
19
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Mission2.pdf

Mission 2 Message the player

https://roderickvella.wordpress.com

Page 2: Mission2.pdf

Mission Objectives

• Welcome to your second mission. In this mission we are going to learn how to message a user when s/he joins your multiplayer server.

• First we need to create the necessary files and then program the code to display a message to the player on the screen. Let’s start.

Page 3: Mission2.pdf

Example: Mission 2 – Prog 1

Page 4: Mission2.pdf

Step 1

• From now onwards [root] means the default installation path of Call of Duty 4.

• Which is C:\Program Files\Activision\Call of Duty 4 - Modern Warfare

Page 5: Mission2.pdf

Step 1

• Navigate to [root]\mods. Inside that folder, make a new folder called Mission2.

• Inside that folder, build a folder structure like this: maps\mp\gametypes

Page 6: Mission2.pdf

Step 1

• Now navigate to [root]\raw\maps\mp\gametypes and copy the file dm.gsc and place it in Mission2\maps\mp\gametypes

Page 7: Mission2.pdf

Step 2

• Open the file dm.gsc with Notepad++ and set the language to C

Page 8: Mission2.pdf

Step 3

Navigate to the function onSpawnPlayer(), type the following command and press save Mission 2 – Prog 1

Page 9: Mission2.pdf

Notes on Mission 2 – Prog 1

onSpawnPlayer() is a function that is called when the player spawns in the map. Functions are used to run multiple lines of code.

IprintLnBold writes bold line on the screen

Page 10: Mission2.pdf

Notes on Mission 2 – Prog 1

self an alias to the entity that called the script

self IprintLnBold("Hello World"); Writes Hello World to the player that spawned in the map. Notice that Hello World is wrapped in double quotes. This is because the function IprintLnBold() accepts text or also known as string argument.

Page 11: Mission2.pdf

Step 4

• Open [root]\bin\MoDBuilder.exe

Page 12: Mission2.pdf

Step 5

1. Go to the ‘Run Game’ section 2. Set the ‘Mod’ to ‘Mission 2’ 3. Set the ‘r_fullscreen’ to ‘0’ 4. Press ‘Run Game’

Page 13: Mission2.pdf

Step 6

• Press ‘Start new Server’

Page 14: Mission2.pdf

Step 7

• For ‘Game Mode’ select ‘Free for all’ and press ‘Start’

Page 15: Mission2.pdf

Step 8

• Select a random team and a weapon

Page 16: Mission2.pdf

Step 9

• When the player spawns on the map, ‘Hello world’ appears on the screen.

Page 17: Mission2.pdf

Practical Task

Page 18: Mission2.pdf

Mission 2 – Task 1

Create a new mod and name it ‘Mission2Task1’. When the player spawns on the map a message containing the following phrase should appear: “Good Luck Soldier”.

Page 19: Mission2.pdf