Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help How to draw a line in cod6 map
#1
Question 
I consulted Yamato's[Tutorial] Lines and want to draw a line in cod6 but failed.
I can't find out the problem. So I'm here to ask for some help

Here is my modified _tutorial.gsc (from Yamato's[Tutorial]Building your first mod and making your first code)
I put my full test mod in attachment.

Code:
#include maps\mp\gametypes\_hud_util;
#include maps\mp\_utility;
#include common_scripts\utility;
#include common_scripts\_painter;

init()
{
     level thread onPlayerConnect();
}

onPlayerConnect()
{
     for( ; ; )
     {
         level waittill( "connected", player );
         player thread onPlayerSpawned();
     }
}

onPlayerSpawned()
{
     self endon( "disconnect" );
     for( ; ; )
     {
         self waittill( "spawned_player" );
         self setClientDvars( "developer", 1, "developer_script", 1 );

         self thread Lines();
     }
}

Lines()
{
     self endon( "death" );
     self endon( "disconnect" );
     while( 1 )
     {
         logPrint("start: " + self.origin + ( 0, 0, 10 ) + "\n");
         logPrint("end: " + self.origin + anglestoforward( self.angles ) * 5000 + "\n");

         line( self.origin + ( 0, 0, 10 ), self.origin + anglestoforward( self.angles ) * 5000, ( randomfloat( 1 ), randomfloat( 1 ), randomfloat( 1 ) ) );
         wait 0.05;
     }
}

I also have downloaded _painter.gsc and put it in common_scripts folder.

In games_mp.log , I can see the log printed, such as:
566:07 start: (335.125, 683.625, -68.7797)(0, 0, 10)
566:07 end: (335.125, 683.625, -68.7797)(-4977.45, -474.34, -0)
But I cannot see the line in the game map. Help me please.

Or someone can make me a simple mod to show how to draw a line?
Big Grin


Attached Files
.zip   test.zip (Size: 11.49 KB / Downloads: 14)
Reply

#2
This is strange, I hope its not because of some annoying dvar, try to change setclientdvars line to this:

Code:
self setClientDvars( "developer", 1, "developer_script", 1, "r_debugLineWidth", 1 );

Also, I cant remember what I had put in my tutorial and I am lazy right now to check it Tongue Maybe you dont need this line:

Code:
#include common_scripts\_painter;
Reply

#3
(08-17-2014, 14:18)Yamato Wrote: This is strange, I hope its not because of some annoying dvar, try to change setclientdvars line to this:

Code:
self setClientDvars( "developer", 1, "developer_script", 1, "r_debugLineWidth", 1 );

Also, I cant remember what I had put in my tutorial and I am lazy right now to check it Tongue Maybe you dont need this line:

Code:
#include common_scripts\_painter;

I still can't make it.Sad
Someone help me... Confused
Reply

#4
Try to set developer vars by "SetDvar" and put to init();
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#5
(08-17-2014, 16:11)Nekochan Wrote: Try to set developer vars by "SetDvar" and put to init();

I got "Invalid server" error when join the game.
Here's my code. I'm a very newer of GSC. So...Confused
Code:
#include maps\mp\gametypes\_hud_util;
#include maps\mp\_utility;
#include common_scripts\utility;

init()
{
     setDvar( "developer", 1 );
     setDvar( "developer_script", 1 );
     setDvar( "r_debugLineWidth", 1 );
     level thread onPlayerConnect();
}  
    
onPlayerConnect()
{
     for( ; ; )
     {
         level waittill( "connected", player );
         player thread onPlayerSpawned();
     }
}      
        
onPlayerSpawned()
{
     self endon( "disconnect" );
     for( ; ; )
     {
         self waittill( "spawned_player" );
         self setClientDvars( "developer", 1, "developer_script", 1, "r_debugLineWidth", 1 );
         self thread Lines(); //execute the thread we wanted to make
     }  
}      
        
Lines()
{
     self endon( "death" );
     self endon( "disconnect" );
     while( 1 )
     {
         logPrint(self.origin);
         line( self.origin + ( 0, 0, 10 ), self.origin + anglestoforward( self.angles ) * 5000, ( randomfloat( 1 ), randomfloat( 1 ), randomfloat( 1 ) ) );
         wait 0.05;
     }  
}
Reply

#6
somebody help...
Reply

#7
Use your first code. Replace setclientdvar to setdvar in the original code. If it still doesn't work by now, add the other two dvars, which @Yamato posted, beneath it. The new dvars should both also be seperated setdvars, and not clientdvars.

On mobile atm, will check more into this when I get on my PC.
Reply

#8
(08-19-2014, 16:45)Rendflex Wrote: Use your first code. Replace setclientdvar to setdvar in the original code. If it still doesn't work by now, add the other two dvars, which @Yamato posted, beneath it. The new dvars should both also be seperated setdvars, and not clientdvars.

On mobile atm, will check more into this when I get on my PC.

Thank you very much.Heart
I tried but failed.Sad
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  draw damage 26hz 12 6,447 06-22-2014, 14:48
Last Post: 26hz

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.