Quote:
Originally Posted by Scouser
:O
Hmm, so i know this is the rookiest question uve probably heard but...
If i was to make a script like Jerret's, would that script be put into 1 of the NPC's in an actual level via graal level editor? or would it be added via a weapon on the RC.
I was also wondering on how you would setup a command such as
if i wanted a GUI to pop up when i say /gang or whatever.
like a trigger i guess.
|
Weapon scripts are primarily for Systems and so on like GUIs.
Commands in weapon scripts can be done using:
PHP Code:
//This also works on the serverside
//#CLIENTSIDE
function onPlayerChats() {
if (player.chat == "/command") {
player.chat = "."; // Clears Chat
doWhatever(); // Performs Command
}
}
or
(my preferred way for weapon scripts)
PHP Code:
//This only works on the clientside.
//#CLIENTSIDE
function ChatBar.onAction() {
if (ChatBar.text == "/command") {
ChatBar.text = ""; // Deletes Text from ChatBar
doCommand(); // Performs Command
}
}
The door script I posted above would typically go in a class script and you would have the level scripts join that class if you plan on re-using it multiple times.
If you're unaware of class scripts or how to use them, you can get away with just putting the script in a level npc.