Jump to content
Sign in to follow this  
Raptor Alpha

Spawn Task Dynamically With Script

Recommended Posts

Hello, can anyone tell me why when I spawn a task dynamically with Script, Actually it's generated by the game mode when m_fTimeElapsed > 30
locally I see only one task but in peer tool the remote player sees 3 destroy type tasks. I proceed as follows:

I spawn prefab with :

Area
  Layer
    SlotDestroy

Something's :

The Good Quests spawn, Some time after the quest spawn (Like when world update),  Other quest appear with destroy task (the good one is a Destroy Task Too) But with basic name and descriptions and postion 0,0,0

 

What i'm missing ?

The goal is only to spawn task , automatically but i'm missing somethings in the init ?

Thank's for your help

        Resource TaskArea = Resource.Load("{5A846609024151B6}Prefabs/Utils/Area_Dev.et");
        EntitySpawnParams params = EntitySpawnParams();
        params.TransformMode = ETransformMode.WORLD;
        params.Transform[3] = position;
        IEntity area = IEntity.Cast(GetGame().SpawnEntityPrefab(TaskArea, null, params));
        string taskname = "Mission" + m_TaskNumber;
        m_TaskNumber++;
        area.SetName(taskname);
        SCR_ScenarioFrameworkArea ThisArea = SCR_ScenarioFrameworkArea.Cast(area.FindComponent(SCR_ScenarioFrameworkArea));
        IEntity Child = area.GetChildren();
        SCR_ScenarioFrameworkLayerTask ThisLayerTask = SCR_ScenarioFrameworkLayerTask.Cast(Child.FindComponent(SCR_ScenarioFrameworkLayerTask));
        IEntity ChildSlot = Child.GetChildren();
        SCR_ScenarioFrameworkSlotDestroy ThisSlot = SCR_ScenarioFrameworkSlotDestroy.Cast(ChildSlot.FindComponent(SCR_ScenarioFrameworkSlotDestroy));
        SCR_GameModeSFManager manager = SCR_GameModeSFManager.Cast(GetGame().GetGameMode().FindComponent(SCR_GameModeSFManager));
        ThisArea.SetLayerTask(ThisLayerTask);
        //manager.GenerateTasks();
        ThisArea.Init();
        ThisLayerTask.Init();
        ThisSlot.Init();

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×