Jump to content

Looping condition and group spawnpoint


PawelSad12

Recommended Posts

Hey everybody,

Just getting started here, so please show me some mercy ๐Ÿ˜Š My goal is to spawn multiple suspects the moment player goes near the callout location.

My first question is is it possible to set a group spawnpoint instead of separate positions for each ped?

ย 

        public override bool OnBeforeCalloutDisplayed()
        {
            SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(150f));
            Spawn2 = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(147f));
            Spawn3 = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(144f));
        }

ย 

Secondly, how do you loop checking if the condition was met.

ย 

If  (Game.LocalPlayer.Character.DistanceTo(Suspect.Position) < 100f)

ย 

I wanted to start the fireworks the moment player comes closer than 100 feet but nothing happens (because the code verifies if the condition is met only once). Is there a way to loop it?

Thank you for your time and patience ๐Ÿ˜Š Cheers.

ย 

Edited by PawelSad12
Link to comment
Share on other sites

Hey MisterPaul! Here's a simple example of how to loop the condition:

ย 

1) This is part of the beginning where you have to define PlayTheActionOnlyOnce():

    public class TerrorHouse : Callout
              {
               private bool

               PlayTheActionOnlyOnce = false;

2) And as we cut to action...

        public override void Process()
        {
            base.Process();

            if (Game.LocalPlayer.Character.DistanceTo(Suspect.Position) < 100f)
            //if (the condition)
            {
                // YOUR ACTION
                PlayTheActionOnlyOnce = true;
            }

              if (PlayTheActionOnlyOnce)
              {
                  End();
              } 
        }
    }
}

Seems simple but it took me a day to figure it out, so may be useful for newbies ๐Ÿ™‚

Edited by PawelSad12
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...