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

Self Intro and Invite for Resources

broken avatar :(
Created 11 years ago
by 1lion
0 Members and 1 Guest are viewing this topic.
5,954 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 September 2013
Last active: 11 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
1lion's Groups
1lion's Contact & Social Links
Good day, all,

I am a automation software developer with quite a bit of experience with C/C++, Java, VB, .NET, *snooze...rambles on...*  In any case, I am fairly new to the world of modding.  I was approached by a coworker who plays CoD: BlOps and has a friend who hosts a server with a mod on it and wanted to make additions and changes to it, but did not have the means.  So they decided to ask me to help. 

I am always hungry for programming projects, but didn't realize how much of a task this would end up being.  I got started and saw that there "isn't much to modding CoD: BO" since they released Mod Tools for it (of course I had to first learn what mod tools was all about.)  I learned quite a bit in the past few weeks by watching tutorials and making minor mods for BO.  There are still many things that I have questions about and I started posting in forums to try to find answers (well, I posted on 2 forums, the community.cod one and itsmods.)  I found that the language used in the BO script files is not well documented.  I've been spoiled with structured programming languages that are documented very well (APIs, MSDN, etc), and haven't had to figure things out on my own for quite some time.

In any case, I would like to call myself a quick learner.  I have already been able to accomplish much of what I have been asked about and still want to keep learning more so that I can do more.  I don't have as much time to devote to side projects like this, but have already managed to write a program that reads all of the gsc files and grabs the functions, tracks the bodies, returns, includes for the files, and I'm working on creating my own API (of course to share).

So my invite is for any resources that can help me learn more about modding for BO using MOD Tools.  Specific topics:

  • Detecting events and triggering custom functions (callbacks)
  • Creating custom maps
  • An already established API type of resource

I have found ZeRoY's script reference, but I am looking for something more like the JAVA API that describes each class as part of a library and describes what it is used for.  Again, I am getting closer to making my own, but wouldn't mind if one already exists.

What I would like the most is a tutorial for building a mod from start to finish.  One that has custom map, custom weapon, sound, character, HUD elements, menu, etc.  I've done many "hello world" tutorials, watched the BO weapon port to WaW to get more information on how models work in modding BO.  I definitely am not asking for a tutorial that shows how to create a model using maya (I have already created a few models).  But something that specifically tells me what each mesh needs to be called, what the joints need to be called, how to export using COD Tools plugin (that came with MOD Tools for BO), which, by the way, I have already added to my Maya.  I can definitely keep combing through the smattering of tutorials on the web (both video and textual), and I will continue to do so, but it would be nice to have all of these topics in one place in an organized fashion.  And, like with all other automation projects I do, if it doesn't already exist, then I will create it. 

In any case, I believe that's enough of an introduction and invite.  I hope this message finds you all well and I look forward to any resources any of you feel like sharing with me.  I also hope to contribute to the modding community in some way, shape, or form. 

PS.

I am just now getting to the CoD Maya tutorials on terminator's youtube channel.  I will be watching them as time allows.  Seems like really good information about a lot of my specific questions.
Last Edit: September 17, 2013, 08:45:16 pm by 1lion
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 9 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
I'll respond to this in detail when I get home in a few hours.
broken avatar :(
×
broken avatar :(
Relentless Mapper
Location: al
Date Registered: 21 August 2011
Last active: 1 month ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
Nuclear
My Groups
More
×
KDXDARK's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Nuclear
Nuclear
DARKLEGION's requested title
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
KDXDARK's Contact & Social Links
I'll respond to this in detail when I get home in a few hours.
i am your boss, what are you doing here in this page, work more!  :boss:
broken avatar :(
  • n123q45
  • Deleted Member
×
broken avatar :(
n123q45
This user is deleted :(
You cant make a custom map for black ops as for scripting its in c++ or c# (basically the same)
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 9 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
As you have already discovered, the so-called "Mod Tools" for Black Ops 1 are very limited and only provide support for basic script mods to be run on servers - no custom maps, no zombie mods, etc.

You certainly won't find an API of any sort for any of the CoD series of games/mod tools - the developers basically just dump the tool packages on us and it's up to the user to figure out what to do with them.

The best resources as I would assume you're already using, is the existing game scripts included in the BO1 tools.

The only callbacks in the game are the ones that have been hard-coded into the engine - if Treyarch didn't add a "notify" event or an actual callback function for whatever you're trying to track, it's not possible.

However with basic things like working with triggers, the callback would be achieved by running a while loop on the trigger entity and waiting for the "trigger" notify to be sent on the ent.

Code Snippet
Plaintext
watch_trigger() //self is the trigger
{
  while(1)
  {
    self waittill("trigger", entity);
    //logic here, entity is the player or AI that triggered the trigger ent
  }
}

If you only want a trigger that works once, then don't do the while loop obviously.

When you first posted this I had the impression you were asking about World at War, but since this was about Black Ops there isn't much to say.

Feel free to post any specific questions you have.

Lastly regarding your very ambitious goal of creating a tutorial from start to finish of literally everything, I think you will find that not only will it be more work than any one man will ever want to do, but the majority of it will fall on deaf ears and you will still have to walk most people through everything or make clarifications.

Regardless, good luck.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 September 2013
Last active: 11 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
1lion's Groups
1lion's Contact & Social Links
Thank you very much for your reply. 

I am definitely learning quite a bit now that I have a more directed route of what I would like to learn.  Right now I am starting with using a custom weapon that I have modeled in the game.  At the moment, I have the model created in Maya.  Using the first part of your tutorial on porting a BO weapon into WaW, I exported a BO weapon and inspected it in Maya to find out what all of the joints are for that particular weapon.  My notes are included below.  My next step is to export a bunch of weapons to *.ma format, parse the files and extract all of the createNode joint -n "<node_name>" [-p "<parent_node>"] and describe what they are in my database.  I also used the waybackmachine to see if I could find out what was on treyarch's wiki and found quite a bit of good information there as well.  I will certainly post specific questions as they come up. 

I like the watch_trigger example.  Essentially I would create my "watch_trigger" function (calling it whatever I would like) and thread it at whatever point I want to. 

For example, and please correct me if I'm wrong, say I want to (and this is from something I have heard has been done) give a player who has used up all of his/her spawn credits an RC bomb every 30 seconds.  In the "onPlayerKilled(...)" overridden function, I would start a thread for function spectatorMode (after checking if no more respawn credits) that ends on end of round.  Pseudo-code function looks like:

Code Snippet
Plaintext
spectatorMode(startWithWeapon, whichWeapon) {
  curPlayer = findMe(); // not quite sure how to get the current player this applies to
  endon("end_of_round");
  if (startWithWeapon == 1) {
    curPlayer giveWeapon(whichWeapon, 0, false);
    curPlayer setWeaponAmmoStock(whichWeapon, 1);
    curPlayer switchToWeapon(whichWeapon);
  }
 
  while(1) {
    wait 30;
    curPlayer giveWeapon(whichWeapon, 0, false);
    curPlayer setWeaponAmmoStock(whichWeapon, 1);
    curPlayer switchToWeapon(whichWeapon);
    waittill("weapon_used", [not_quite_sure_which_entity]); // maybe curplayer?
  }
}


Then, in some other part of the code I do notify("weapon_used"), yes?  Now, how do I detect that the weapon was used.  Is there a callback for attack button pressed?  I know there is AttackButtonPressed(), but this is a function that returns false.  It sounds like I should replace waittill with while(!(curPlayer AttackButtonPressed())) { }.  But that would mean creating more threads for everything that I would want to do. 

With that, I also built a mod that displays the rgb values and hero light temp and sky color temp, and I wanted to update these values with keypresses.  I could do a threaded function that loops forever and checks for each type of button press, but I would rather have a function that is triggered when a button is pressed.  Or even better, textboxes where values can be input and sliders for each.  But that isn't something I want to work on later.  One thing at a time, yes?  In any case, the detecting key presses and acting on it as the keypress happens is something doable with a threaded function, but I don't now how to detect which key was pressed without a bunch of if statements.  I'd rather have a switch(keyPressed) { ... }. 

Whoo, typing too much.  On a quick side note: my boss is actually in the room with me.  Lots of fun.

Anyway:

My descriptions of joints found in exported ak47 viewmodel exported using TomXmodelUtills in outliner fashion.
Spoiler: click to open...
*note: all of the meshes in the exports appear to be positioned where it would be positioned for a put-together weapon.  That is, if there are attachments, they are their own mesh, but they are positioned where they belong on the model, even if there are more than one attachment that go to the same spot.  I don't know if this is required, but it seems logical that it would be.

  • j_gun - main gun joint used for placement.  On exported AK47, this is on the trigger base; bound to any mesh that does not have any of the other joints bound to it
    • j_bolt - looks to be the placement of the action...the handle on the side that is pulled back to load a bullet or is made to move back and forth when firing a round to reload automatically.  it is bound to the mesh that makes up the action
    • tag_aimpoint - bound to the bottom of middle of the of the aimpoint optics attachment
    • tag_bouncing_grenade_launcher - bound to the grenade launcher attachment mesh. the actual joint is positioned somewhere towards the back of the gun
      • j_bouncing_grenade_ammo - an actual grenade (round?  shell? whatever the correct term is for the grenade launcher ammo) for the launcher
    • tag_brass - Where the bullet casing is ejected from.  does not appear to be bound
    • tag_clip - bound to the normal clip mesh for the weapon positioned in the middle of where the clip enters the gun
    • tag_cobra_mounted - bound to the middle of the cobra mount (sight)
    • tag_dual_clip - bound to the dual clip mesh positioned in the same place as tag_clip
    • tag_extended_clip - bound to the extended clip mesh positioned in the same place as tag_clip
    • tag_flame_unit - bound to the flame attachment mesh.  the actual joint is positioned somewhere towards the back of the gun, same distance behind the mesh as the grenade launcher's joint.  might not be important
      • tag_flamer_bracket - bound to the flamer bracket mesh for the flame attachment
        • tag_flamer_bottle - bound to the flamer bottle mesh for the flame attachment in the flamer bracket
      • tag_flamer_button - bound to the flamer ring's button (the part that goes between the ring and the flame attachment that the ring is held by)
        • tag_flamer_ring - bound to the flamer ring mesh directly
      • tag_flamer_pilot_light - positioned at the location that the pilot flame for the flame attachment should be at.  it does not appear to be bound to a mesh
    • tag_flash - positioned at the location the muzzle flash animation should appear from.  it does not appear to be bound to a mesh
    • tag_iron_sight - bound to the standard iron sight mesh at the end of the barrel
    • tag_leaf_sight - bound to the standard leaf sight mesh
    • tag_masterkey - bound to the masterkey attachment (shotgun?) mesh
      • tag_ammo2 - bound to the shotgun shell mesh positioned inside of the masterkey attachment
      • tag_pump2 - bound to the pump (action) mesh positioned inside of the masterkey attachment
    • tag_nsp3a - bound to the NSP-3 sniper scope attachment mesh
    • tag_scope_pka - bound to the pka red dot attachment mesh
    • tag_short_sight - bound to the short version of the iron sight mesh at the end of the barrel
    • tag_suppressor - bound to the suppressor attachment positioned where the suppressor connects to the end of the barrel
Last Edit: September 18, 2013, 06:21:20 pm by 1lion
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 9 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
I like the watch_trigger example.  Essentially I would create my "watch_trigger" function (calling it whatever I would like) and thread it at whatever point I want to. 
Correct.

For example, and please correct me if I'm wrong, say I want to (and this is from something I have heard has been done) give a player who has used up all of his/her spawn credits an RC bomb every 30 seconds.  In the "onPlayerKilled(...)" overridden function, I would start a thread for function spectatorMode (after checking if no more respawn credits) that ends on end of round.  Pseudo-code function looks like:

Code Snippet
Plaintext
spectatorMode(startWithWeapon, whichWeapon) {
  curPlayer = findMe(); // not quite sure how to get the current player this applies to
  endon("end_of_round");
  if (startWithWeapon == 1) {
    curPlayer giveWeapon(whichWeapon, 0, false);
    curPlayer setWeaponAmmoStock(whichWeapon, 1);
    curPlayer switchToWeapon(whichWeapon);
  }
 
  while(1) {
    wait 30;
    curPlayer giveWeapon(whichWeapon, 0, false);
    curPlayer setWeaponAmmoStock(whichWeapon, 1);
    curPlayer switchToWeapon(whichWeapon);
    waittill("weapon_used", [not_quite_sure_which_entity]); // maybe curplayer?
  }
}

Looking at your pseudocode, many of your questions cannot be answered without some code context. If you don't want the code to be public, you can send it to me using the Private Messaging feature of this forum.

Generally you would fetch the correct player by threading the spectator function on him from somewhere else.

The onPlayerKilled callback is already called on the player entity by the engine, so to carry that player entity into your spectatorMode function (which I assume is your pseudoname for a custom function, because you certainly don't want to try to override the existing one), you would thread the function on the player within the callback block like so:

Code Snippet
Plaintext
self thread spectatorMode(true, "weapon_name");

self would become the player ent in your spectatorMode function.

Then, in some other part of the code I do notify("weapon_used"), yes?  Now, how do I detect that the weapon was used.  Is there a callback for attack button pressed?  I know there is AttackButtonPressed(), but this is a function that returns false.  It sounds like I should replace waittill with while(!(curPlayer AttackButtonPressed())) { }.  But that would mean creating more threads for everything that I would want to do. 
Notifys are sent on ents, so you have to call them as such. To send a notify on the player entity, you would do:

Code Snippet
Plaintext
self notify("weapon_used", optional_value_send);

To catch this notify, you would need to call a waittill on the same ent that the notify was sent on:

Code Snippet
Plaintext
self waittill("weapon_used", optional_value_receive);

It also might help you to know that you can pass one variable with a notify as well, which I have shown in the above examples. The second parameter is completely optional and will not need to be used in some cases.

With that, I also built a mod that displays the rgb values and hero light temp and sky color temp, and I wanted to update these values with keypresses.  I could do a threaded function that loops forever and checks for each type of button press, but I would rather have a function that is triggered when a button is pressed.  Or even better, textboxes where values can be input and sliders for each.  But that isn't something I want to work on later.  One thing at a time, yes?  In any case, the detecting key presses and acting on it as the keypress happens is something doable with a threaded function, but I don't now how to detect which key was pressed without a bunch of if statements.  I'd rather have a switch(keyPressed) { ... }. 
Keys are a touchy subject in the IDtech engine - you can only grab keypresses of keys which are bound in your Controls options menu of the game. You should be able to find some key grabbing examples in the existing game code. The sliders and textboxes can only be achieved using .menu files, which can be found in game_root/raw/ui and game_root/raw/ui/mp.

To find existing examples of code without an API, personally I just do a file-wide search for strings that match what I'm trying to find. I use a program called ScitE to do my searching, but any program that is capable will do (Notepad++, Sublime Text, etc). So for finding code related to keypresses, I would just search for the string "key". A smarter search would be to look for mentions of specific keybind names, such as "+reload" or simply the word "bind".
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 September 2013
Last active: 11 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
1lion's Groups
1lion's Contact & Social Links
I greatly appreciate you taking the time to respond.  It usually turns out that I don't really know what I'm trying to accomplish until I type it out.  It just happened that for this, I typed it out in a forum post.  I definitely understood (or thought I understood) the concept of "Self" being an entity.  From what I saw, though, self seemed to take on the entity that instantiated the function.  I wasn't completely convinced and am still a little bit confused about it.  So the direct question is: does Self always refer to the player?

I would also be happy to share the entirety of the code that I come up with in my test mods in the end.  I just don't have anything organized.  Just scraps here and there. 
Last Edit: September 18, 2013, 06:48:58 pm by 1lion
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 9 months ago
Posts
5,551
Respect
6,691Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
I greatly appreciate you taking the time to respond.  It usually turns out that I don't really know what I'm trying to accomplish until I type it out.  It just happened that for this, I typed it out in a forum post.  I definitely understood (or thought I understood) the concept of "Self" being an entity.  From what I saw, though, self seemed to take on the entity that instantiated the function.  I wasn't completely convinced and am still a little bit confused about it.  So the direct question is: does Self always refer to the player?
No. Self refers to the struct, object, or entity that the function was called or threaded on. If you don't call a function on anything, I believe self defaults to the global "level" object. Haven't tested this but it's an educated guess. It might also just evaluate to unpredictable garbage.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 September 2013
Last active: 11 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
1lion's Groups
1lion's Contact & Social Links
This is what I was able to test last night for giving RC Bomb streak every 30 seconds.  I created a new folder in {black ops root}\mod\ called "mp_test".  In that folder I created subfolders: maps -> mp -> gametypes.  I copied {black ops root}\raw\maps\mp\gametypes\_rank.gsc to {blac ops root}\mod\mp_test\maps\mp\gametypes.  I then modified it as follows:

in the init() function, close to the bottom of it, I created a hud element so I could see the status of giving the RC Bomb killstreak:

Code Snippet
Plaintext
init() {
  // ... unmodified init function code ...

  level.hud_give_streak = newhudelem();
  level.hud_give_streak.font = "default";
  level.hud_give_streak.fontscale = 1;
  level.hud_give_streak.x = 40; // See here for AI count placement
  level.hud_give_streak.y = 40;
  level.hud_give_streak.color = (1,1,1);
  level.hud_give_streak.archived = true;
  level.hud_give_streak.hidewheninmenu = false;
  level.hud_give_streak.alignX = "left";
  level.hud_give_streak.alignY = "middle";
  level.hud_give_streak.horzAlign = "center";
  level.hud_give_streak.vertAlign = "center";
  level.hud_give_streak settext("Waiting for killstreak timer");
}

Placement was arbitrary.  I added a function at the very bottom so that I could keep track of it:

Code Snippet
Plaintext
spectatingMode(startWithWeapon) {
  self endon("disconnect");
  /* This is here as a placeholder.  I will need to find out how to do self notify("end_of_round")  when a round ends, or find out if there is already a notify that occurs when a round ends or player stops being a spectator...maybe "joined_team": */
  self endon("end_of_round");
 
  self waittill("spawned_player");  // This is here because I tested it for active player
  // self waittill("joined_spectators"); // This is what I will use when doing this for spectator testing
  /* wait at minimum the length of time of the pre-match period.  only used when calling the function from onPlayerConnect(); */
  wait level.prematchPeriod;
 
  while(1) {
    j = 0;
    if (startWithWeapon == 0) {
      while (j < 30) {
        level.hud_give_streak setText("^5" + (30 - j) + " ^0seconds until next RC Bomb");
        wait 1;
        j++;
      }
    }
    // Might also do Valkyrie rockets "m220_tow_mp" or randomly select between these two
    self thread maps\mp\gametypes\_hardpoints::giveKillstreak("rcbomb_mp", "rcbomb_mp", true, true);
    while (!(self ActionSlotFourButtonPressed())) { // Wait until the killstreak button is pressed
      level.hud_give_streak setText("Press ^5Killstreak Button ^0to control rc bomb");
      wait 0.01;
    }
    // Wait until the RC Bomb is used before starting the next countdown
    level.hud_give_streak setText("^2Waiting for end of RC Bomb");
    self waittill("rcbomb_done");
    startWithWeapon = 0;
  }
}

Because I wanted to test giving the killstreak and having it reset the timer countdown, I added the call to the function in onPlayerConnect():

Code Snippet
Plaintext
onPlayerSpawned() {
  // ... unmodified onPlayerConnect code ...
  // Before player thread onPlayerSpawned(); call
  player thread spectatingMode(1); // Start with RC Bomb
  // ... Rest of onPlayerConnect ...
}

This gives the RC Bomb right away, updates the text to show that I should push the killstreak button to use it.  When I push the killstreak button (bound to 6, for me), it shows a message that it will not start the counter until the RC Bomb is used (disabled, run off of a cliff, detonated in some way shape or for, ended somehow). 

Now, I need to find out if it will work when I am actually a spectator...but I need to learn how to go into spectator mode first.

Hope this code snippet helps anyone trying to give killstreaks after a set amount of time.

PS, if you were following this as a how to setup a mod that gives a killstreak after a certain amount of time during a match, remember that I am using Mod Tools to compile and run as a private game.  I am adding this to the tutorial for creating a mod from beginning to end.  maybe the "hello world" part of the tutorial.
Last Edit: September 19, 2013, 12:53:23 pm by 1lion
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 29 August 2012
Last active: 5 years ago
Posts
220
Respect
Forum Rank
Mr. Elemental
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
I do mods/maps for WaW and BO1.
×
Rollonmath42's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Rollonmath42's Contact & Social Linksrollonmath42Rollonmath42Rollonmath42Rollonmath42
The easiest way to get into Spectator mode is to go to Change Team > Spectator from the Pause Menu.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 September 2013
Last active: 11 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
1lion's Groups
1lion's Contact & Social Links
Great!  Thanks for the info, I'll try that today.  Again, I don't really play FPS, but am definitely enjoying learning how to MOD this game. 
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 September 2013
Last active: 11 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
1lion's Groups
1lion's Contact & Social Links
So, after a while of not being able to do anything with this, I was able to get back into it. 
Code Snippet
Plaintext
onPlayerConnect() {
  // ... normal code ...
  player thread spectatingMode(1);
  // ... rest of code ...
}

and

Code Snippet
Plaintext
spectatingMode(startWithWeapon) {
  self endon("disconnect");
  /* This is here as a placeholder.  I will need to find out how to do self notify("end_of_round")  when a round ends, or find out if there is already a notify that occurs when a round ends or player stops being a spectator...maybe "joined_team": */
  self endon("end_of_round");
 
  //self waittill("spawned_player");  // This is here because I tested it for active player
  self waittill("joined_spectators"); // This is what I will use when doing this for spectator testing
  /* wait at minimum the length of time of the pre-match period.  only used when calling the function from onPlayerConnect(); */
  //wait level.prematchPeriod;
 
  while(1) {
    j = 0;
    if (startWithWeapon == 0) {
      while (j < 30) {
        level.hud_give_streak setText("^5" + (30 - j) + " ^0seconds until next RC Bomb");
        wait 1;
        j++;
      }
    }
    // Might also do Valkyrie rockets "m220_tow_mp" or randomly select between these two
    self thread maps\mp\gametypes\_hardpoints::giveKillstreak("rcbomb_mp", "rcbomb_mp", true, true);
    while (!(self ActionSlotFourButtonPressed())) { // Wait until the killstreak button is pressed
      level.hud_give_streak setText("Press ^5Killstreak Button ^0to control rc bomb");
      wait 0.01;
    }
    // Wait until the RC Bomb is used before starting the next countdown
    level.hud_give_streak setText("^2Waiting for end of RC Bomb");
    self waittill("rcbomb_done");
    startWithWeapon = 0;
  }
}
*note: the hud_give_streak hud element was created earlier in init()
This gives the killstreak as normal, but I cannot deploy it.  Any thoughts?
Last Edit: September 21, 2013, 08:24:54 pm by 1lion
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 September 2013
Last active: 11 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
1lion's Groups
1lion's Contact & Social Links
Well, I haven't been able to pick this up very often, but I learned something this evening.  While in spectator mode, the only button that is registered is the Use Button ('F' by default), so I changed the ActionSlotFourButtonPressed to UseButtonPressed and it registers that the button was pressed.  Now I need to figure out how to deploye the killstreak (bomb, valkyrie rocket, etc.)  I am still open to suggestions and/or comments. 

 
Loading ...