bma Posted October 6, 2014 Report Share Posted October 6, 2014 Hello Out there. I have made a peberspray script and after som help from itchboy its now ready and released Download: Copenhagen mod - Download page - Online Quote Link to comment Share on other sites More sharing options...
itchboy Posted October 6, 2014 Report Share Posted October 6, 2014 Try changing the bbject placement of the particle. If it is set to custom (or a few other settings) then the object cannot be moved in the up or down position. Try setting it to none and see if it actually allows poisitioning on the z axis. Quote Link to comment Share on other sites More sharing options...
bma Posted October 6, 2014 Author Report Share Posted October 6, 2014 It is aldready on none Quote Link to comment Share on other sites More sharing options...
itchboy Posted October 6, 2014 Report Share Posted October 6, 2014 Hmm......would it be possible to create a child particle on the person? The particle effect would be played when the pepper spray script is activated. Quote Link to comment Share on other sites More sharing options...
bma Posted October 6, 2014 Author Report Share Posted October 6, 2014 That would be a posibility, it would just require me to install it as a child on all the people which will make it less userfriendly for other people who wants to use it for their mod Quote Link to comment Share on other sites More sharing options...
Terrow Posted October 6, 2014 Report Share Posted October 6, 2014 Are the other scripts set as childs (Shears, fire extinguisher etc.)? I would check those out and see how the positions are scripted with them. I haven't looked at them too much yet. Or check out the script for the fire and how that is positioned. From what I see it looks like it acts as the hose script but changes the distance and texture? Quote Link to comment Share on other sites More sharing options...
bma Posted October 6, 2014 Author Report Share Posted October 6, 2014 Are the other scripts set as childs (Shears, fire extinguisher etc.)? I would check those out and see how the positions are scripted with them. I haven't looked at them too much yet. Or check out the script for the fire and how that is positioned. From what I see it looks like it acts as the hose script but changes the distance and texture? I have thought about that, only problem is that most of them are coded from the game, so its not possible to see how they have made it, they just make an "pushactionextinguish" command and then the game takes care of the rest, so we can't see how it works. Quote Link to comment Share on other sites More sharing options...
Chris07 Posted October 6, 2014 Report Share Posted October 6, 2014 The position of the person (pos variable) is going to give you the [0,0,0] position of the model...which is between the legs at floor level (as seen in the picture). What you need to do is play around and manually offset the position of the particle by adding to the Z axis. I would create a Vector and add it to your pos variable.Vector offsetV = new Vector(0.f,0.f,50.f); //My offsetpos = pos + offsetV; //Operator overloaded by default so we can add vectors in this mannerUnfortunately, this will require that you manually tweak the offset value...which can be time consuming. Essentially you need to change the "50" to a value that causes the particle to go where you need it. Since all adult models are the same size, this should work for all person models (except children). If you want children models to use it, its an "easy" addition. EDIT: It appears as though you tried to do a manual offset, but I don't see you adding your offset to the Z axis...only the X and Y. Quote Link to comment Share on other sites More sharing options...
bma Posted October 6, 2014 Author Report Share Posted October 6, 2014 Exactly, i have done exactly that. Im not sure why its not working Quote Link to comment Share on other sites More sharing options...
Chris07 Posted October 6, 2014 Report Share Posted October 6, 2014 Okay then it must be a placement option. I NEVER have luck with "Custom". I always end up using bounding box or another option since Custom seems to lock the Z-axis for me. Try going into editor, selecting the particle prototype, placing a copy on a blank map and try raising the particle on the Z-axis (hold alt + Left Mouse). Try changing the placement option until you are able to move it along the Z axis. That will be the placement option to use. Quote Link to comment Share on other sites More sharing options...
bma Posted October 6, 2014 Author Report Share Posted October 6, 2014 Its is posible to raise and lower it in the editor. But since it is a particle its only possible for it to be "none" else it doesnt work Quote Link to comment Share on other sites More sharing options...
Chris07 Posted October 6, 2014 Report Share Posted October 6, 2014 One thing is bugging me...Nowhere in your code are you actually offsetting the Z-axis.Math::RotateVector(offset.x, offset.y, offset.z, r);pos.x += offset.x;pos.y += offset.y;I see that part of the code (offseting the X and Y axis...but where are you offsetting the Z-axis? There is nopos.z += offset.z; Unless you added that later and its not reflected in your first post. Quote Link to comment Share on other sites More sharing options...
bma Posted October 6, 2014 Author Report Share Posted October 6, 2014 One thing is bugging me...Nowhere in your code are you actually offsetting the Z-axis.Math::RotateVector(offset.x, offset.y, offset.z, r);pos.x += offset.x;pos.y += offset.y;I see that part of the code (offseting the X and Y axis...but where are you offsetting the Z-axis? There is nopos.z += offset.z;Unless you added that later and its not reflected in your first post.Of course! It works now, thank you very much! Quote Link to comment Share on other sites More sharing options...
Chris07 Posted October 6, 2014 Report Share Posted October 6, 2014 Awesome! .....and no one noticed that I used the wrong syntax in my first post to declare a Vector object I'm so used to programming Java, not EM4 Scripting. Quote Link to comment Share on other sites More sharing options...
bma Posted October 16, 2014 Author Report Share Posted October 16, 2014 I Solved the first problem but ran into a new one For some reason the particle always faces the same dirrection on the map, so nomather how the officer is turning the particle always turns towards the same direction. Help? Quote Link to comment Share on other sites More sharing options...
itchboy Posted October 16, 2014 Report Share Posted October 16, 2014 The SetRotation function is pointed to float childRot. This float value is unassigned.Use the float value used in the p.GetRotation.Try this for the variable spray:Spray.SetRotation(r[0], r[1], r2], r[3], r[4], r[5], r[6], r[7], r[8]); Quote Link to comment Share on other sites More sharing options...
bma Posted October 17, 2014 Author Report Share Posted October 17, 2014 Perfect, just have one minor error left, then its release time Quote Link to comment Share on other sites More sharing options...
itchboy Posted October 17, 2014 Report Share Posted October 17, 2014 I fixed it? Cool. I did something!What minor error would that be? Quote Link to comment Share on other sites More sharing options...
bma Posted October 17, 2014 Author Report Share Posted October 17, 2014 I fixed it? Cool. I did something!What minor error would that be? The minor error would be the spray being a little off, was fixed by removing // at a specific line. So now the script works and it looks awesome But now the script is ready for release. It can be downloaded from our homepage: Copenhagen mod - Download page Quote Link to comment Share on other sites More sharing options...
itchboy Posted October 17, 2014 Report Share Posted October 17, 2014 YES! Thank you for releasing it. I hope I was able to help you. Quote Link to comment Share on other sites More sharing options...
nickbuchanan911 Posted November 29, 2014 Report Share Posted November 29, 2014 how can u add this to a diffrent mod besides this one? Quote Link to comment Share on other sites More sharing options...
bma Posted November 29, 2014 Author Report Share Posted November 29, 2014 how can u add this to a diffrent mod besides this one?Yeah, just copy everything from the folder into the mod folder and give the officers the "use pepperdpray command" Quote Link to comment Share on other sites More sharing options...
nickbuchanan911 Posted November 30, 2014 Report Share Posted November 30, 2014 ok ty Quote Link to comment Share on other sites More sharing options...