Results 1 to 10 of 23

Thread: Lasers (SCRIPT)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Private
    Join Date
    Jan 2013
    Posts
    15
    Thanks
    3
    Thanked 4 Times in 3 Posts
    I made something like this :

    [sharp]trap1()
    {
    kosa = getent("kosa_1", "targetname");
    kosa_kill = getent("kosa_2", "targetname");
    kosa_kill enablelinkto();
    kosa_kill linkto(kosa);
    {
    kosa movex(82,5,2);
    wait (0.5);
    kosa movex(-82,5,2);
    wait (0.5);
    }
    }[/sharp]

    And it gives me that error:

    Click image for larger version. 

Name:	error.png 
Views:	51 
Size:	298.5 KB 
ID:	189

  2. #2
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by BaX View Post
    I made something like this :

    [sharp]trap1()
    {
    kosa = getent("kosa_1", "targetname");
    kosa_kill = getent("kosa_2", "targetname");
    kosa_kill enablelinkto();
    kosa_kill linkto(kosa);
    {
    kosa movex(82,5,2);
    wait (0.5);
    kosa movex(-82,5,2);
    wait (0.5);
    }
    }[/sharp]

    And it gives me that error:

    Click image for larger version. 

Name:	error.png 
Views:	51 
Size:	298.5 KB 
ID:	189
    When you get an error like that - calling an entity for which there is more than 1 - it is telling you that you need to use getEntArray() (plural) and not getEnt() (singlular).

    When you use getEntArray() you must use a for() loop to find each member of the entity set. So, this is what you want:

    PHP Code:
    trap1()
    {
        
    kosa getentArray("kosa_1""targetname");
        
    kosa_kill getentArray("kosa_2""targetname");
        
        for( 
    i=0kosa.sizei++ )
        {
            for( 
    j=0kosa_kill.sizej++ )
            {
                
    kosa_kill[jenablelinkto();
                
    kosa_kill[jlinktokosa[i] );

                
    kosa[imovex(82,5,2);
                
    wait0.5 );
                
    kosa[imovex(-82,5,2);
                
    wait0.5 );
            }
        }


  3. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    @Tally

    Your code would make the lasers wait for one another to finish their "run"

  4. #4
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by IzNoGoD View Post
    @Tally

    Your code would make the lasers wait for one another to finish their "run"
    It's not "my code". I was merely demonstrating how to use for() loops to find each member of a class. I did not test the code for efficiency or otherwise. You really do need to stop thinking everything is some sort of contest, where you are always the hero.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •