Game Modding | Call of Duty: Black Ops 3 | Scripting
ModmeBot:
Thread By: TrueGamerCalls I'm trying to make a PAP system where you have to activate 4 switches in order to open PAP. I plan to use the level varibles (Forget my post about the flags) and when all four switches are detected, it will delete a door that leads to PAP. My issue is that the triggers are working perfectly, but the door isn't deleting, I'm not the best at scripting so I don't know what errors I made besides what the launcher tells me
ModmeBot:
Reply By: VoltiK I have taken a look at your script and amended it. I have made your papunlock function into a while(1) and called the thread on the player after each trigger has been used and points have been given.
ModmeBot:
Reply By: Scorpiolo
TrueGamerCalls I'm trying to make a PAP system where you have to activate 4 switches in order to open PAP. I plan to use the level varibles (Forget my post about the flags) and when all four switches are detected, it will delete a door that leads to PAP. My issue is that the triggers are working perfectly, but the door isn't deleting, I'm not the best at scripting so I don't know what errors I made besides what the launcher tells me function papswitch1() { switcht1 = GetEnt("switcht1", "targetname"); //Declare item model switchm1 = GetEnt("switchm1", "targetname"); //Set Hintstring for item trigger switcht1 SetHintString("Hold &&1 To Activate Switch"); //Remove hand icon for item trigger switcht1 SetCursorHint("HINT_NOICON"); //Wait for player to action item trigger switcht1 waittill("trigger", player); level.pswitches ++; player.score += 100; switcht1 Delete(); switchm1 Delete(); } function pswitch2() { switcht2 = GetEnt("switcht2", "targetname"); switcht2 SetHintString("Hold &&1 To Activate Switch"); switcht2 SetCursorHint("HINT_NOICON"); switcht2 waittill("trigger", player); level.pswitches ++; player.score += 100; switcht2 Delete(); } function papswitch3() { switcht3 = GetEnt("switcht3", "targetname"); switcht3 SetHintString("Hold &&1 To Activate Switch"); switcht3 SetCursorHint("HINT_NOICON"); switcht3 waittill("trigger", player); level.pswitches ++; player.score += 100; switcht3 Delete(); } function papswitch4() { switcht4 = GetEnt("switcht4", "targetname"); switcht4 SetHintString("Hold &&1 To Activate Switch"); switcht4 SetCursorHint("HINT_NOICON"); switcht4 waittill("trigger", player); level.pswitches ++; player.score += 100; switcht4 Delete(); } function papunlock() { if(level.pswitches == 4) { switchdoor = GetEntArray("easter_egg_door","targetname"); //door parts array switchdoor Delete(); } }
This version should work better, I'm not sure why you'd have multiple pap door models but here you go, this will work far better than the one above, just thread the function init to initiate it
ModmeBot:
Reply By: Scorpiolo
VoltiK I have taken a look at your script and amended it. I have made your papunlock function into a while(1) and called the thread on the player after each trigger has been used and points have been given. function papswitch1(){ switcht1 = GetEnt("switcht1", "targetname"); //Declare item model switchm1 = GetEnt("switchm1", "targetname"); //Set Hintstring for item trigger switcht1 SetHintString("Hold &&1 To Activate Switch"); //Remove hand icon for item trigger switcht1 SetCursorHint("HINT_NOICON"); //Wait for player to action item trigger switcht1 waittill("trigger", player); level.pswitches ++; player.score += 100; //Added script to check progession on switches.. thread papunlock(player); switcht1 Delete(); switchm1 Delete();} function pswitch2(){ switcht2 = GetEnt("switcht2", "targetname"); switcht2 SetHintString("Hold &&1 To Activate Switch"); switcht2 SetCursorHint("HINT_NOICON"); switcht2 waittill("trigger", player); level.pswitches ++; player.score += 100; //Added script to check progession on switches.. thread papunlock(player); switcht2 Delete(); } function papswitch3(){ switcht3 = GetEnt("switcht3", "targetname"); switcht3 SetHintString("Hold &&1 To Activate Switch"); switcht3 SetCursorHint("HINT_NOICON"); switcht3 waittill("trigger", player); level.pswitches ++; player.score += 100; //Added script to check progession on switches.. thread papunlock(player); switcht3 Delete(); } function papswitch4(){ switcht4 = GetEnt("switcht4", "targetname"); switcht4 SetHintString("Hold &&1 To Activate Switch"); switcht4 SetCursorHint("HINT_NOICON"); switcht4 waittill("trigger", player); level.pswitches ++; player.score += 100; //Added script to check progession on switches.. thread papunlock(player); switcht4 Delete(); } function papunlock(player){ while(1) { self waittill(level.pswitches >= 4); if(level.pswitches == 4) { switchdoor = GetEntArray("easter_egg_door","targetname"); //door parts array switchdoor Delete(); } break; }}
I don't think that will actually work and a lot of that code is pretty unnecessary
ModmeBot:
Reply By: Harry Bo21 nor will the code you posted
lines 3 - 7 all have syntax errors for a start
ModmeBot:
Reply By: Scorpiolo
Harry Bo21 nor will the code you postedlines 3 - 7 all have syntax errors for a start
Yeah realised that after I posted but was in class so couldn't change but I'm pretty sure the rest is fine, there are more efficient solutions but still. All the threads and the pap unlock lines need semi colons added to the end for the fix
ModmeBot:
Reply By: TrueGamerCalls
Scorpiolo Harry Bo21 nor will the code you postedlines 3 - 7 all have syntax errors for a start Yeah realised that after I posted but was in class so couldn't change but I'm pretty sure the rest is fine, there are more efficient solutions but still. All the threads and the pap unlock lines need semi colons added to the end for the fix
Nope,
I fixed all the syntax errors, threaded the init, did everything and it still doesn't work. I even added the papunlock(); into the init and it still doesn't work, triggers work fine though.
ModmeBot:
Reply By: Harry Bo21
doesnt seem to have been defined anywhere
so its trying to do
"undefined" + 1
ModmeBot:
Reply By: TrueGamerCalls
Harry Bo21 level.pswitches doesnt seem to have been defined anywhere so its trying to do"undefined" + 1
lol forgot about that, I just defined it and it worked.