Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 09-11-2011, 11:51 PM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
If it's for playing music in a level for all players, why are all of you writing gui/weapon scripts? Level npc scripting approach seems simpler and more appropriate for the situation to me:
PHP Code:
function onCreated() {
  
setshape(13232);
  
setSong("defaultsongplaying.mp3");
}

function 
onPlayerChats() {
  
temp.tokens player.chat.tokenize();
  if (
tokens[0] == "playsong") {
    if (
fileexists(tokens[1])) {
      if (
tokens[1] != this.attr[10]) {
        
setSong(tokens[1]);
      }
    }
  }
}

function 
setSong(temp.filename) {
  
this.attr[10] = filename;
  
triggeraction(this.1this.1"SongChanged"filename);
}

//#CLIENTSIDE
function onCreated() {
  
setshape(13232);
}

function 
onPlayerEnters() {
  
setSong(this.attr[10]);
}

function 
onActionSongChanged(temp.filename) {
  
setSong(filename);
}

function 
setSong(temp.filename) {
  
stopmusic();
  
playlooped(filename);

__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.