you can move an FX, but what you will want to do is use the function named
Code Snippet
Plaintext
fx = playfxontag(id, ent, tag);
where 'id' is the FX id, ent is the script_model that you want to play the FX on, and tag is the model tag you where you want the FX attached. example:
Code Snippet
Plaintext
fx = PlayFxOnTag(level._effect["bouledefeu"], level.model, "tag_origin");
PS: if you ran it in developer mode you should have gotten an error saying "Type String is not an entity and cannot call EnableLinkTo"
you can move an FX, but what you will want to do is use the function named
Code Snippet
Plaintext
fx = playfxontag(id, ent, tag);
where 'id' is the FX id, ent is the script_model that you want to play the FX on, and tag is the model tag you where you want the FX attached. example:
Code Snippet
Plaintext
fx = PlayFxOnTag(level._effect["bouledefeu"], level.model, "tag_origin");
PS: if you ran it in developer mode you should have gotten an error saying "Type String is not an entity and cannot call EnableLinkTo"
Close, but no cigar. According to the api (root/docsmodtools/bo3_scriptapifunctions.html) search for playfxontag. I use a lot of custom fx in my projects and am familiar with this topic. Im on standby at work right now, but give me an hour and I'll give you (original poster) a proper example once I get home. (On mobile) Double Post Merge: November 29, 2017, 11:55:48 pm
//First, you need to pre-cache your fx file before init(). (Certain fx are pre-cached by default, there is a list in the forums here) #precache("fx", "Symbo/test3");
function init() { level flag::wait_till("initial_blackscreen_passed"); level._effect["bouledefeu"] = "Symbo/test3"; //Defining the fx
temp = struct::get("struct1", "targetname"); //In radiant, put a new struct where the skull moves to - name it "destination" destination = struct::get("destination", "targetname"); skull = Spawn("script_model", temp.origin); skull SetModel("p7_skulls_bones_head_02"); skull.destination = destination.origin;
temp Delete(); //If only using as an origin point - no longer needed destination Delete();
//level.model enablelinkto(); //level._effect["bouledefeu"] linkto(level.model); //***You do not call EnableLinkTo() on the fx ^ or the model here. The fx in gsc is only a string pointing to the fx file, //PlayFXOnTag() solves that, the fx will move with the model
function move_fx() { PlayFXOnTag(level._effect["bouledefeu"], self, "tag_origin"); //If you want to get fancy, you could make the skull look towards the destination point as it moves there //I wrote an easy function for that at the bottom of the page self face_target(self.destination); //Then move it there self MoveTo(self.destination, 2);
//If feeling extra fancy you could make the skull 'look' at the nearest player while(1) { players = GetPlayers(); searchDist = 500; //500 is the search distance for players - change as needed nearestPlayer = ArrayGetClosest(self.origin, players, searchDist);