
Posts
32
Respect
Forum Rank
Legless Crawler
Primary Group
Member
Login Issues
Forgot password?Activate Issues
Account activation email not received? Wrong account activation email used?Other Problems?
Contact Support - Help Center Get help on the UGX Discord. Join it now!![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
function main()
{
//Add this line at the bottom in your main() function:
level thread part_setup();
}
//Then add these functions outside of, and below the main() function:
function part_setup(){
level flag::wait_till("all_players_connected");
level.part_trigs = GetEntArray("part", "targetname");
foreach(trig in level.part_trigs){ //Get an array of all triggers that have the targetname 'part'
trig.id = self.script_noteworthy;
trig.part_model = GetEnt(self.target, "targetname");
trig SetCursorHint("HINT_NOICON");
trig SetHintString("Press &&1 to pickup part");
trig thread pickup_item_logic(); //Execute a function on every trigger in that array
}
level.end_locs = GetEntArray("end_location", "targetname");
foreach(trig in level.end_locs){
trig SetCursorHint("HINT_NOICON");
trig SetHintString("Press &&1 to place part");
trig thread place_item_logic(); //EDIT* - was just 'thread place_item_logic();' fixed so 'trig' gets threaded as self, sorry I forgot that part.
}
}
function pickup_item_logic(){ //Each trigger becomes 'self' in this function
while(1){
self waittill("trigger", player);
if(!isDefined(player.has_part) || player.has_part == false){
player.has_part = true;
player.current_part = self.id;
self.part_model Delete();
self Delete();
break;
}else
wait(1);
}
}
function place_item_logic(){ //Each trigger becomes 'self' in this function
while(1){
self waittill("trigger", player);
if(isDefined(player.has_part){
new_part = Spawn("script_model", self.origin);
new_part SetModel(player.current_part);
player.current_part = undefined;
player.has_part = false;
self TriggerEnable(false);
//Add your own code where needed. This is only a basic skeleton of grabbing and placing items
}else
wait(1);
}
foreach (trig in GetEnt("end_location"))![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |
![]() | Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum. |