Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Era's Radio (https://forums.graalonline.com/forums/showthread.php?t=134264303)

papajchris 08-24-2011 04:55 AM

Era's Radio
 
Not sure if this issue has been known and resolved by someone (Chris, Crow, Salesman, whoever else worked here), but its bugging me that it hasn't been fixed in the years that issue has been occuring. As many of you know, our radio system works fine until a player crosses over level links (on a gmap). The sound cuts out and a player is forced to open and close the radio again. We had someone briefly look over it, and he couldn't find any issues with it. So im just looking for suggestions on why this is occurring and how I can fix it.

fowlplay4 08-24-2011 06:02 AM

A script or class being calling onPlayerEnters which resuilts playlooped() or stopmusic() or stopmidi() being called.

Could possibly relate to ganis as well.

papajchris 08-24-2011 06:25 AM

Hmm well with the script below the sound goes out about 40 seconds-90 seconds into the song.

This is a test script Chris Vimes used to attempt to try resolve the problem:


PHP Code:

findPlayer("DRAGON551").addWeapon(this.name);
//#CLIENTSIDE
function onCreated() {
  
stopmusic();
  
play("http://GraalEra.com/personal/LoveMyGang.mp3");
}

function 
onPlayerChats() {
  if (
player.chat == "start"this.onCreated();
  
  if (
player.chat "db") {
    
stopmusic();
  }
}

/*
function onTimeOut() {
  for (temp.pl : players) {
    if (pl == player) continue;
    
    pl.x = (- 100);
    pl.y = (- 100);
    pl.setAni("idle", null);
  }
  
  this.setTimer(0.05);
}*/

function onKeyPressed(codekey) {
  if (
key == "f") {
    
temp.0;
    
temp.oldnpc null;
    for (
temp.npc npcs) {
      if (! 
ismusicplaying()) {
        
//oldnpc.x = player.x;
        //oldnpc.y = player.y;
        
player.oldnpc.x;
        
player.oldnpc.y;
        
TheBadNPC oldnpc;
        return 
oldnpc.chat "MEEEEEE";;
      }
      
      
oldnpc=npc;
      
npc.trigger("playerenters"null);
      
msgs.addMessage("/" npcs.size());
      
++;
      
sleep(0.2);
    }
  }


I took out the stopmusic line under the onCreated function and yet the sound still stopped.

fowlplay4 08-24-2011 06:43 AM

What happens when you use playlooped instead of play?

That script identifies what NPC is stopping it from playing. Might benefit from echo'ing the NPCs id, name and joinedclasses if it has any as well.

Can also try this test:

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
music();
  
test();
}

function 
music() {
  
stopmusic();
  
play("http://GraalEra.com/personal/LoveMyGang.mp3");
  
sleep(1);
}

function 
test() {
  for (
temp.wepplayer.weapons) {
    if (
temp.wep != this) {
      
temp.wep.trigger("PlayerEnters""");
      
sleep(0.2);
      if (!
ismusicplaying()) {
        echo(
"music stopped playing after onPlayerEnters was called in " temp.wep.name);
        
music();
      }
    }
  }



papajchris 08-24-2011 07:27 AM

Playlooped seemed to make no difference.

Using Chris's tool, i can't understand why its choosing one NPC over another.

A window with

PHP Code:

// NPC made by Rachel (Working)
if (created) {
}
if (
playertouchsme) {


was selected.

Then a flower with this was selected

PHP Code:

this.itemnum=5;
join flower-bunch


and then
PHP Code:

//#CLIENSIDE
if (created) {
  
dontblock;
drawoverplayer;} 

And a fourth example:
PHP Code:

//#CLIENTSIDE
function onCreated() {
dontblock();
drawoverplayer();
setimgpart("era_lcgaragedoor4.gif",0,0,80,32);



With your script im getting this error:

Quote:

Script: Function stopmusic not found at line 9 in script of Chris/Why the **** aren't radios working on Era?
Script: Function play not found at line 10 in script of Chris/Why the **** aren't radios working on Era?
(Thank CV for the clever name)

My only scripting experience is from what i learned from trial/error over the years, so sorry if this is fairly easy fix, but i looked over your code and cant seem to understand why the lines would work in CV's script, but not yours.

cbk1994 08-24-2011 11:20 AM

If it's choosing random NPCs, there's probably a GANI stopping the music rather than an NPC calling it in onPlayerEnters. Before I left last time, radios were working flawlessly, so it's a recent addition.

Quote:

Originally Posted by papajchris (Post 1665097)
With your script im getting this error:

Sounds like you either forgot to copy the //#CLIENTSIDE or there's a space at the end of the line you need to remove.


All times are GMT +2. The time now is 05:06 AM.

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