Jump to content

[Question] Can you generate a sector without being there ?


celludriel

Recommended Posts

Hey,

 

I want to create a script that when "a player" enters a sector he finds a ship waiting there to be killed, so he can get a reward.  What I do NOT want is attach a script with callback to the Player() object.  Logically I would attach it to

 

callback onPlayerEntered(playerIndex)

Executed whenever a player enters the sector.

 

Parameters

 

playerIndex Index of the player

 

When a player enters and it is for the first time, the ship to destroy gets created.  Sound and simple design ... HOWEVER since sectors aren't all generated before hand.  I need a way, when the mission gets created the sector gets loaded, the script attached to it and then the sector can be unloaded whatever ... I just want my script attached to it.  In pseudo code that would become

 

Mission mission = createMission("DestroyShip")
Sector sector = mission.findSectorToKillShip()
sector.attachScriptToLoadShipSpawner()

 

- So first my logic to create a mission saving the data somewhere

- Then finding an empty sector somewhere AND loading it into a variable

- Attach my callback script to the sector that when "a player" enters no matter who, the ship to destroy gets spawned

 

I've been browsing SectorSpecifics, the sectors folder and other scripts and usually Sector() is used but this implies probably the sector the player is in and that's not what I'm aiming for, that target could be in a sector nobody has ever visited

 

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...