UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Moving things

broken avatar :(
Created 11 years ago
by Soy-Yo
0 Members and 1 Guest are viewing this topic.
7,649 views
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
Signature
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
I'm thinking in a new map, but before I begin making it I need to know if it's possible.
I know how to move brushes, triggers..., but is there any way to move prefabs without stamping them?
Thanks.
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
no you can't move prefabs as if they are one ent, i think they are 'stamped' when compiling anyway.
Need to stamp it and make sure the things you want to move are script_model / script_brushmodel and work from there like you normally would..
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
Ok. Thank you.
So, let's say I want to move a perk. I have to move every single brush or model the prefabs has, right? And I saw there's a script_struct in the prefab, I think for the music. Is it possible to move those things? I haven't tested it yet.
Marked as best answer by Soy-Yo 11 years ago
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
yes, you would have to move every single piece seperately.
Dont think you can move structs, maybe just like triggers you can give them a new .origin, but i dont think moveto() for example will work on a struct.
Change it into an _origin and adjust the perk-script to work with that is also an option.
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
I've just tested it and it's not necessary to change to an _origin. I could move them by changing the .origin. But I need to move them relatively. So, is it possible to accede to the X, Y and Z of a vector separately? Or is it possible to operate with vectors? Like:
Code Snippet
Plaintext
struct.origin += (x,y,z)
Or similar.

Double Post Merge: September 06, 2015, 12:57:11 pm
Code Snippet
Plaintext
struct.origin += (x,y,z)
Sorry, never mind. This code works well.
Thank you. ;)
Last Edit: September 06, 2015, 12:57:11 pm by Soy-Yo
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Dont think you can move structs, maybe just like triggers you can give them a new .origin

I think you can link a struct to an ent using linkto.At least I do in my perk randomize.I  link everything to one item, then just move that one item.  I am 99 percent sure it was working right anyway, lol.

And I never stamp anything, I script it dynamically and use auto kvps with the w, when making prefabs. I don't stamp cause if you have multiple ents linked with the auto kvp, and stamp, it sequences them, and fs up the kvps.
Last Edit: September 06, 2015, 05:11:38 pm by MakeCents
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
And I never stamp anything, I script it dynamically and use auto kvps with the w, when making prefabs. I don't stamp cause if you have multiple ents linked with the auto kvp, and stamp, it sequences them, and fs up the kvps.
Sorry, I haven't understood anything here :o. Too hard for me.

So, can I link anything to a brush? This would make my work easier.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 2 years ago
Posts
1,186
Respect
1,332Add +1
Forum Rank
Zombie Colossus
Primary Group
Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntStuffyBluntstuffy@BluntZombieStuffyZombie
Sorry, I haven't understood anything here :o. Too hard for me.

So, can I link anything to a brush? This would make my work easier.

You can link ent's together, so they will move as one. I've had issue's with this in the past in coop game's where for clients not every ent would move, while for the host everything looked fine. I managed to fix it in the end, but cant remember what the problem was..

Use:

Code Snippet
Plaintext
ent enablelinkto();
http://ugx-mods.com/script/#core.Entity.enableLinkTo


and:

Code Snippet
Plaintext
ent linkto( ENT_TO_LINK_TO );
http://ugx-mods.com/script/#core.Entity.linkTo
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
Yeah, I knew those. I'm sure they work with triggers, zones and zombies, but do them work with everything?
Last Edit: September 06, 2015, 07:49:30 pm by Soy-Yo
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Yeah, I knew those. I'm sure they work with triggers, zones and zombies, but do them work with everything?

I'll make a script example and prefabs for you later tonight, with an explanation.

Double Post Merge: September 07, 2015, 06:05:44 am
Well, I regret to inform that this whole time I thought I was moving the struct, and I wasn't, :( so blunt was right on the linkto buisness not working for them. Which means I'll have to adjust that in the future for my randomizer. I made something to move the struct the way blunt said in the script.

I made a pefab, explained below, then a script, and then I made a video, which I placed at the bottom to see what it is doing. This script prob won't work for what you are doing, you may need to be more specific, but it shows how you can move one item and everything goes with it. I inserted the prefab and pressed space to copy it three times.


PREFAB
I set up a prefab, with an ent, then linked a trigger, and then linked a struct to the trigger and a couple more ents so you can see it is all linked.



SCRIPT
Then I made a function to get an array of my ents (GetMyParts). Next I thread a function on each ent that gets the target ent and links it to the ent. If that target ent also has a target, then get it and link it too but calling the same function on it, and so on and so on. Then I made a function just to do something to show that it is working. It will play an fx after moving at the struct position. The functions below are to "move" a struct or array of structs. It spawns an ent where the struct is, links to the ent that you will move, and then moves the struct to the ent after it moves, then deletes it.
Code Snippet
Plaintext
//thread GetMyParts();
GetMyParts(){//get all the models to move
parts = getentarray("exampleparts", "targetname");
array_thread(parts,::LinkParts);
}
LinkParts(){//decide to link and/or get more ents to link
if(!isDefined(self.target)) return;
myEnts = GetEntArray(self.target,"targetname");
if(isDefined(myEnts) && myEnts.size>0){
array_thread(myEnts,::LinkParts, self);
array_thread(myEnts,::LinkThem,self);
}
}
LinkThem(linkToMe){//enable link for trigs and link everything
if(isDefined(self.classname) && isSubStr(self.classname,"trigger")){
self SetCursorHint("HINT_NOICON");//I only do this hear, cause it isn't done else where
self setHintString("Press &&1 to do something");//I only do this hear, cause it isn't done else where
self thread MakeMeDoSomething(linkToMe);
self enableLinkTo();
}
self linkto(linkToMe);
}
MakeMeDoSomething(moveMe){//just to move it and test
if(!isDefined(moveMe)) return;
while(1){
self waittill("trigger");
self MoveMyStructs(moveMe, 200);
wait(5);
self MoveMyStructs(moveMe, -200);
}
}
//Functions that "move" structs
MoveMyStructs(moveMe, move){//struct moving functions
structs = undefined;
if(isdefined(self.target)) structs = GetStructArray(self.target,"targetname");
if(isDefined(structs) && structs.size>0) for(i=0;i<structs.size;i++) moveMe BeforeMoveStructs(structs[i]);
moveMe MoveTo(moveMe.origin + (0,0,int(move)),.01);
wait(.1);
if(isDefined(structs) && structs.size>0) for(i=0;i<structs.size;i++) moveMe AfterMoveStructs(structs[i]);
}
BeforeMoveStructs(struct){//struct moving functions
ent = spawn("script_origin",struct.origin);
ent.origin = struct.origin;
ent linkto(self);
struct.ent = ent;
}
AfterMoveStructs(struct){//struct moving functions
struct.origin = struct.ent.origin;
struct.ent delete();
struct.ent = undefined;
PlayFx(level._effect["poltergeist"], struct.origin);
}


! No longer available
Last Edit: September 07, 2015, 06:07:08 am by MakeCents
broken avatar :(
×
broken avatar :(
Location: esMadrid
Date Registered: 27 March 2015
Last active: 5 years ago
Posts
371
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
JIGGLYPUFF used SING! YOU fell asleep!
×
Soy-Yo's Groups
Soy-Yo's Contact & Social LinksSoy-yoElCerdoRey
Wow! :o Thank you! ;)
I need to take a time to study your code, but it looks like I can do what I want.

Double Post Merge: September 07, 2015, 10:34:53 am
I don't understand everything but it works as I want. I think I'm going to use it editing it a bit.
Well, thank you for the help and for that tut.
Last Edit: September 07, 2015, 10:34:53 am by Soy-Yo
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods community.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
You're welcome. As always, there are many many ways of doing any script. This is one method I like for buildables too.
Last Edit: September 07, 2015, 01:40:39 pm by MakeCents

 
Loading ...