1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Double-Object Spawned at death of another

Discussion in 'Ask a Coder' started by SamMaster, Feb 10, 2005.

  1. SamMaster

    SamMaster Master of the Super Weapons

    Joined:
    Apr 13, 2000
    Messages:
    417
    Likes Received:
    0
    OK, so my Ice chunk, I found it best to summon it via another projectile. However, whenever, that projectile dies, it spawns 2 of them. Here is the code snipets:

    The Chuck Caller:
    Code:
    function MakeIceChunk()
    {
        local Projectile p;
        MomentumTransfer = 0;
        Damage = 0;
        if (bSpawnedIce == false)
            p = Spawn(class 'IceChunk', owner,, location, rotation);
        bSpawnedIce = true;
    }
    The place where it is called:
    Code:
    simulated function Destroyed()
    {
        if (bSpawnedIce == false)
           MakeIceChunk();
    
        if (ShockBallEffect != None)
        {
    		if ( bNoFX )
    			ShockBallEffect.Destroy();
    		else
    			ShockBallEffect.Kill();
    	}
    
    	Super.Destroyed();
    }
    Any help? BTW I used the base of the shock projectile for it.
     
  2. SamMaster

    SamMaster Master of the Super Weapons

    Joined:
    Apr 13, 2000
    Messages:
    417
    Likes Received:
    0
    anyone?
     
  3. Postal

    Postal I apear to have lost my pin.

    Joined:
    Nov 14, 1999
    Messages:
    1,388
    Likes Received:
    0
    No idea, but just in case try putting a { and } in

    Code:
    if (bSpawnedIce == false)
    {
    p = Spawn(class 'IceChunk', owner,, location, rotation);
    bSpawnedIce = true;
    }
    
     
  4. Smoke39

    Smoke39 whatever

    Joined:
    Jun 2, 2001
    Messages:
    1,793
    Likes Received:
    0
    Since when does one check the status of boolean variables with ==? Instead of "if ( bSpawnedIce == false )" see if "if ( !bSpawnedIce )" changes anything.
     
  5. Kangus

    Kangus Zombie on your pwn!

    Joined:
    Jan 29, 2001
    Messages:
    978
    Likes Received:
    0
    Smoke's got a point... U-Script is bitchy about little things like checking bools ina wierd way... try his suggestion.
     
  6. SamMaster

    SamMaster Master of the Super Weapons

    Joined:
    Apr 13, 2000
    Messages:
    417
    Likes Received:
    0
    I fixed it by putting the check higher up in the MakeChunk() function. Now there is something else troubling which I can't remember :p
     
  7. SamMaster

    SamMaster Master of the Super Weapons

    Joined:
    Apr 13, 2000
    Messages:
    417
    Likes Received:
    0
    NM. Its all good. I even got the thing to be transparent and shiny!
     

Share This Page