Pottyscotty Posted March 20, 2016 Report Share Posted March 20, 2016 A friend and I would like to know why this script is causing crashing (While loading the mod in-game or editor) since neither of us can see anything wrong. There is no error showing and nothing appearing in the log. Some parts have been blanked by request or for other reasons but they have been double checked (and are the sort of things which would generate errors if wrong anyway). //******************************************* // add CCactivate to first models // add CCdeactivate to changed models // // // Original script created by ---- // Made for Pottyscotty's ---- // // Usage of this Script in other mods is not allowed without permission of ---- // //******************************************* // prototypes of command centers one for activated and one for not active const char CCTYPE1[] = "mod:Prototypes/Vehicles/--/--.e4p"; const char CCTYPE1ACTIVATED[] = "mod:Prototypes/Vehicles/--/--.e4p"; const char CCTYPE2[] = "mod:Prototypes/Vehicles/--/--.e4p"; const char CCTYPE2ACTIVATED[] = "mod:Prototypes/Vehicles/--/--.e4p"; //prototype names const char CCTYPE1name[] = "--_--"; const char CCTYPE1ACTIVATEDname[] = "--_--_1"; const char CCTYPE2name[] = "--_--"; const char CCTYPE2ACTIVATEDname[] = "--_--_1"; // commands const char CC_ACTIVATE[] = "CCActivate"; const char CC_DEACTIVATE[] = "CCDeactivate"; const char SND_TOGGLE[] = "mod:Audio/FX/Lights/Toggle.wav"; object CCActivate : CommandScript { CCActivate() { SetIcon("ENTER VALUE"); SetCursor("ENTER VALUE"); SetPossibleCallers(ACTOR_VEHICLE); SetRestrictions(RESTRICT_SELFEXECUTE); } bool CheckTarget(GameObject *Caller, Actor *Target, int ChildID) { } void PushActions(GameObject *Caller, Actor *Target, int ChildID) { Vehicle v(Caller); Vector Position = v.GetPosition(); float r[9]; v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]); v.PushActionWait(ACTION_NEWLIST, 0.1f); v.SetCommandable(false); Vehicle NEWV; // first type of cc if(StrCompare(v.GetPrototypeFileName() ,CCTYPE1name) == 0){ NEWV = Game::CreateVehicle(CCTYPE1ACTIVATED, Target->GetName()); } // second type of cc if(StrCompare(v.GetPrototypeFileName() ,CCTYPE2name) == 0){ NEWV = Game::CreateVehicle(CCTYPE2ACTIVATED, Target->GetName()); } v.PushActionDeleteOwner(ACTION_APPEND); NEWV.SetPosition(Position); NEWV.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]); Audio::PlaySample3D(SND_TOGGLE, NEWV.GetPosition()); NEWV.EnableTrafficLight(TLT_YELLOW); NEWV.Hide(); NEWV.PushActionWait(ACTION_NEWLIST, 0.1f); NEWV.PushActionShowHide(ACTION_APPEND, false); } }; object CCDeactivate : CommandScript { CCDeactivate() { SetIcon("ENTER VALUE"); SetCursor("ENTER VALUE"); SetPossibleCallers(ACTOR_VEHICLE); SetRestrictions(RESTRICT_SELFEXECUTE); } bool CheckTarget(GameObject *Caller, Actor *Target, int ChildID) { } void PushActions(GameObject *Caller, Actor *Target, int ChildID) { Vehicle v(Caller); Vector Position = v.GetPosition(); float r[9]; v.GetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]); v.PushActionWait(ACTION_APPEND, 0.1f); v.SetCommandable(false); Vehicle NEWV; // first type of cc if(StrCompare(v.GetPrototypeFileName() ,CCTYPE1ACTIVATEDname) == 0){ NEWV = Game::CreateVehicle(CCTYPE1, Target->GetName()); // second type of cc if(StrCompare(v.GetPrototypeFileName() ,CCTYPE2ACTIVATEDname) == 0){ NEWV = Game::CreateVehicle(CCTYPE2, Target->GetName()); } v.PushActionDeleteOwner(ACTION_APPEND); NEWV.SetPosition(Position); NEWV.SetRotation(r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7], r[8]); NEWV.EnableTrafficLight(TLT_NONE); NEWV.Hide(); NEWV.PushActionWait(ACTION_NEWLIST, 0.1f); NEWV.PushActionShowHide(ACTION_APPEND, false); } }; Quote Link to comment Share on other sites More sharing options...