Game Modding | Call of Duty: Black Ops 3 | Scripting
ModmeBot:
Thread By: ReKleSs Hello I have normal jump pads, but i dont know how to do buyable jump pad, its when ui go to the jump pad i pay 3000 points and i jump to the other pad. Thanks =)
ModmeBot:
Reply By: natesmithzombies What jump pad script are you using? I haven't messed with any yet but last I looked they need to be custom made. Chances are you got it from Redspace and he probably doesnt want his code public on the forum here if he shared it with you privately. If I know what script you are using I can modify it properly for you, but I definitely wont let others work be posted on here without the scripts authors consent.
ModmeBot:
Reply By: ReKleSs
natesmithzombiesWhat jump pad script are you using? I haven't messed with any yet but last I looked they need to be custom made. Chances are you got it from Redspace and he probably doesnt want his code public on the forum here if he shared it with you privately. If I know what script you are using I can modify it properly for you, but I definitely wont let others work be posted on here without the scripts authors consent.
#using scripts\codescripts\struct;#using scripts\shared\callbacks_shared;#using scripts\shared\flag_shared;#using scripts\shared\system_shared;#using scripts\shared\trigger_shared;#using scripts\shared\util_shared;#insert scripts\shared\shared.gsh;#using scripts\zm\_util;#using scripts\zm\_zm_audio;#using scripts\zm\_zm;#using scripts\zm\_zm_utility;#namespace rs_o_jump_pad;// Specific variables radiant will look for inside of script_string.// These can be changed to whatever is the easiest to use.#define JUMP_PAD_RADIANT_VAL_TIME "time"#define JUMP_PAD_RADIANT_VAL_ZOFFSET "zOffset"#define JUMP_PAD_RADIANT_VAL_ZPEAKPROGRESS "zPeakProgress"#define JUMP_PAD_RADIANT_VAL_COST "cost"#define JUMP_PAD_RADIANT_VAL_DELAY "delay"#define JUMP_PAD_RADIANT_VAL_COOLDOWN "cooldown"// Default values for each specific setting for the jump pad.#define DEF_JUMP_PAD_JUMP_TIME 2.85#define DEF_JUMP_PAD_Z_OFFSET 800#define DEF_JUMP_PAD_Z_PEAK_PROGRESS 72#define DEF_JUMP_PAD_COST -1#define DEF_JUMP_PAD_DELAY 0#define DEF_JUMP_PAD_COOLDOWN 0#precache( "model", "tag_origin" );#precache( "fx", "redspace/fx_launchpad_blue" );#precache( "fx", "redspace/fx_launchpad_red" );// todo add ability for one jump pad to deactivate another (or multiple) for a certain amount of time// todo add customizable notifies for launch start and launch endREGISTER_SYSTEM("rs_o_jump_pad",&__init__,undefined)/* ----------------- Redspace200 Jump Pad ----------------------
Credits:
RedSpace200: Entire Script
Porter: Sounds & Idea
3arc: Broken Scripts & files
Please give credit to redspace200 & porter if used in your map.
Setup: Add prefab into map. Use configuration settings below to setup as you like
IMPORTANT: Add line
#using scripts\_redspace\rs_o_jump_pad;
to mapName.gsc file
Add line to .zone file
scriptparsetree,scripts/_redspace/rs_o_jump_pad.gsc
--------------------- |||||||||||||||||||||||| ----------------------
Use included prefab OR manually setup with the settings below
Trigger_Use
targetname = trig_jump_pad
target = startptName
Points to the starting point.
Should be located directly in the center of the trigger_use
Script_Struct
Start_Point (Located right by trigger)
targetname = startptName
Start point name to reference
target = entptName
End Point to target
script_string = specific settings for this particular launch pad
Optional Settings
time: Amount of time jump pad transition to end point will take
zOffset: Vertical translation max height
zPeakProgress: Percent of the transition where the player is at his maximum height
cost: Amount this launch pad costs the player to use. Negative # means this will not cost the player and will be activated by touch.
delay: Delay before the launch pad launches the player. Player may step off pad to avoid being launched. Stepping off a paid pad will cause the player to loose the money.
cooldown: Amount of time a player has to wait before using this launch pad again
Example Syntax (script_string = ) ---> time:4,zOffset:800,zPeakProgress:85,cost:500,delay:0.5
Script_Struct
End_Point (Located by end position. There can be a infinite # of end points, a random one will be chosen)
targetname = entptName
End point name to reference.
*/function__init__(){leveljump_pad_init();}functionjump_pad_init(){jump_pad_triggers=GetEntArray("trig_jump_pad","targetname");if(!isdefined(jump_pad_triggers))return;for(i=0;i<jump_pad_triggers.size;i++){jump_pad_triggers[i].start=struct::get(jump_pad_triggers[i].target,"targetname");jump_pad_triggers[i].destination=struct::get_array(jump_pad_triggers[i].start.target,"targetname");padTime=DEF_JUMP_PAD_JUMP_TIME;padZOff=DEF_JUMP_PAD_Z_OFFSET;padPeakProgress=DEF_JUMP_PAD_Z_PEAK_PROGRESS;padCost=DEF_JUMP_PAD_COST;padDelay=DEF_JUMP_PAD_DELAY;padCooldown=DEF_JUMP_PAD_COOLDOWN;values=strtok(JUMP_PAD_RADIANT_VAL_TIME+":"+JUMP_PAD_RADIANT_VAL_ZOFFSET+":"+JUMP_PAD_RADIANT_VAL_ZPEAKPROGRESS+":"+JUMP_PAD_RADIANT_VAL_COST+":"+JUMP_PAD_RADIANT_VAL_DELAY+":"+JUMP_PAD_RADIANT_VAL_COOLDOWN,":");input=jump_pad_triggers[i].script_string;if(input!=""){input=strtok(input,",");for(j=0;j<input.size;j++){varData=strtok(input[j],":");setVar="";for(k=0;k<values.size;k++){if(varData[0]==values[k]){switch(k){case0:// Set TimepadTime=float(varData[1]);break;case1:// Set Z OffsetpadZOff=int(varData[1]);break;case2:// Set Peak ProgresspadPeakProgress=int(varData[1]);break;case3:// Set CostpadCost=int(varData[1]);break;case4:// Set Pad DelaypadDelay=float(varData[1]);break;case5:// Set Pad DelaypadCooldown=float(varData[1]);break;}}}}}// Set the variable information collected to the jump pad triggerjump_pad_triggers[i].padTime=padTime;jump_pad_triggers[i].padZOffset=padZOff;jump_pad_triggers[i].padPeakProgress=padPeakProgress;jump_pad_triggers[i].padCost=padCost;jump_pad_triggers[i].padDelay=padDelay;jump_pad_triggers[i].padCooldown=padCooldown;jump_pad_triggers[i]threadjump_pad_fx();jump_pad_triggers[i]threadjump_pad_think();}}functionjump_pad_fx(){selfendon("destroyed");while(isdefined(self)){fx=spawn("script_model",self.origin);fxsetModel("tag_origin");playFxOnTag("redspace/fx_launchpad_blue",fx,"tag_origin");selfwaittill("jump_pad_deactivate");fxdelete();fx=spawn("script_model",self.origin);fxsetModel("tag_origin");playFxOnTag("redspace/fx_launchpad_red",fx,"tag_origin");selfwaittill("jump_pad_activate");fxdelete();}}functionjump_pad_think(){selfendon("destroyed");selfjump_pad_hintstring();while(isdefined(self)){wait.2;players=getPlayers();for(i=0;i<players.size;i++){who=players[i];if(!selfanyPlayerTouchingSelf())self.touchingLaunchPad=undefined;if(!whoisTouching(self))continue;if(IsPlayer(who)&&!isdefined(self.touchingLaunchPad)){if(self.padCost>=0&&(!whouseButtonPressed()||who.score<self.padCost))continue;if(self.padCost>0)who.score-=self.padCost;if(self.padDelay>0){whoplaySound("flinger_activate");selfsetHintString("");waitself.padDelay;selfjump_pad_hintstring();if(!whoisTouching(self))continue;}start=self.start;time=self.padTime;zOffset=self.padZOffset;zPeakProgress=self.padPeakProgress;end=self.destination[RandomInt(self.destination.size)];whothreadrs_jumppad_launch(start.origin,time,zOffset,zPeakProgress,end.origin);self.touchingLaunchPad=true;if(self.padCooldown>0){wait.5;selfsetHintString("Launch pad cooling down...");selfnotify("jump_pad_deactivate");waitself.padCooldown;selfnotify("jump_pad_activate");selfjump_pad_hintstring();}}}}}functionjump_pad_hintstring(){selfsetCursorHint("HINT_NOICON");if(self.padCost>=0)selfSetHintString("Press and Hold ^3[{+activate}]^7 use Launch Pad. Cost["+self.padCost+"]");elseselfsetHintString("");}functionanyPlayerTouchingSelf(){players=getPlayers();for(i=0;i<players.size;i++)if(players[i]isTouching(self))returntrue;returnfalse;}// Redspace200 jump pad launch function// Launch the player from point A to B with a nice arc on the Z axisfunctionrs_jumppad_launch(start,time,zOffset,zPeakProgress,end){selfnotify("stop_player_out_of_playable_area_monitor");self.onLaunchPad=true;selfnotify("launchpad_start");levelutil::clientNotify("player_fling_blur_0");// Get starting locationorg=start;startX=org[0];startY=org[1];startZ=org[2];// Get ending locationendOrg=end;byX=endOrg[0]-startX;byY=endOrg[1]-startY;byZ=endOrg[2]-startZ;totalTime=time;// Total animation duration in secondscurrentTime=0;// Elapsed time from the animationanimProgress=0;// Acutal animation progress / maxProgress. Must start at 0 for smooth animation.animMaxProgress=100;// Maximum animation progress. Default to 100 for easy reference.animZPeak=zPeakProgress;// Percentage out of 100 before the animation Z starts to descend.zOffsetMax=zOffset;// Highest point of the animation Z.increments=.065;// Increments per frame. .065 Is a good number.ent=spawn("script_origin",self.origin);selfplaySound("flinger_fly");entplayLoopSound("flinger_wind_loop");wait.05;selfplayerLinkTo(ent);for(i=0;i<totalTime;i+=increments){ent.angles=self.angles;animProgress=map(i,0,totalTime,0,animMaxProgress);// Normal delta speed from starting point to end point.// Input current animation frame number to get position.dx=linear(animProgress,0,byX,animMaxProgress+1);dy=linear(animProgress,0,byY,animMaxProgress+1);dz=linear(animProgress,0,byZ,animMaxProgress+1);addZ=0;// Z Axis Arc / Offsetif(animProgress<animZPeak)addZ=easeOutSine(animProgress,0,zOffsetMax,animMaxProgress-(animMaxProgress-animZPeak));elseaddZ=zOffsetMax-easeInSine(animProgress-animZPeak,0,zOffsetMax,animMaxProgress-animZPeak);x=startX+dx;y=startY+dy;z=startZ+dz+addZ;entmoveTo((x,y,z),increments,0,0);waitincrements;}selfsetOrigin(endOrg);earthQuake(.6,3,self.origin,200);levelutil::clientNotify("player_fling_blur_disable_0");selfunlink();entdelete();selfplaySound("flinger_land");selfthreadzm::player_out_of_playable_area_monitor();self.onLaunchPad=undefined;selfnotify("launchpad_finish");}functionlinear(t,b,c,d){returnc*t/(d-1)+b;}functioneaseInSine(t,b,c,d){return-c*cos(toRadian(t/d*(Math_PI()/2)))+c+b;}functioneaseOutSine(t,b,c,d){returnc*sin(toRadian(t/d*(Math_PI()/2)))+b;}functionMath_PI(){return3.14159265359;}functiontoRadian(degree){returndegree*(180/Math_PI());}functionmap(input,lower1,upper1,lower2,upper2){return((input-lower1)*(upper2-lower2))/(upper1-lower1)+lower2;}
This is jump pad script from redspace i found it in this video.
Thanks.
ModmeBot:
Reply By: natesmithzombies On line 32 you will see this:
#define DEF_JUMP_PAD_COST -1
Change it to:
#define DEF_JUMP_PAD_COST 1000 // cost is now 1000
I haven't tested it myself but let me know how it goes
ModmeBot:
Reply By: Exofile
natesmithzombiesOn line 32 you will see this:
#define DEF_JUMP_PAD_COST -1
Change it to:
#define DEF_JUMP_PAD_COST 1000 // cost is now 1000
I haven't tested it myself but let me know how it goes
Wait, -1?
Won't his script then award players 1 point, would it not be more clever to have the cost be 0? I'm asking as I'm not much for scripting, on the sideline.
ModmeBot:
Reply By: natesmithzombies
Exofile
natesmithzombiesOn line 32 you will see this:
#define DEF_JUMP_PAD_COST -1
Change it to:
#define DEF_JUMP_PAD_COST 1000 // cost is now 1000
I haven't tested it myself but let me know how it goes
Wait, -1?
Won't his script then award players 1 point, would it not be more clever to have the cost be 0? I'm asking as I'm not much for scripting, on the sideline.
No because either treyarch or redspace did a check later to ignore the cost in this logical statement:
#define DEF_JUMP_PAD_COST 1000 // cost is now 1000
I haven't tested it myself but let me know how it goes
Wait, -1?
Won't his script then award players 1 point, would it not be more clever to have the cost be 0? I'm asking as I'm not much for scripting, on the sideline.
No because either treyarch or redspace did a check later to ignore the cost in this logical statement: