Jman3ooo Posted August 18, 2002 Share Posted August 18, 2002 I need to know the following things Thanks in advance: How can I adjust the player speed without adjusting the server command g_speed How can I turn down the percentage of deflecting guns with a saber. Can I tell if there is an opponent nearby, and if so how? Once again thanks alot Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 18, 2002 Author Share Posted August 18, 2002 and to add to the list of unanswered questions: How do I initiate some sort of timer so I can have a power up last for 5 seconds? BTW If you wanted to know you can change player speed with client->ps.speed *= (default 1); Link to comment Share on other sites More sharing options...
Dest Posted August 18, 2002 Share Posted August 18, 2002 if (mod_cheatProtection.integer) { for ( count = 0 ; count < MAX_GENTITIES ; count++ ) { if (g_entities[count].client && g_entities[count].client->ps.clientNum != ent->client->ps.clientNum) { if ( ((ent->client->ps.origin[0]-g_entities[count].client->ps.origin[0]) * (ent->client->ps.origin[0]-g_entities[count].client->ps.origin[0])) + ((ent->client->ps.origin[1]-g_entities[count].client->ps.origin[1])*(ent->client->ps.origin[1]-g_entities[count].client->ps.origin[1])) + ((ent->client->ps.origin[2]-g_entities[count].client->ps.origin[2])*(ent->client->ps.origin[2]-g_entities[count].client->ps.origin[2])) < mod_cheatProtection.integer*mod_cheatProtection.integer) { // G_Printf("ent in radius\n");//debug canSizeChange=qfalse; } } } } Thats how I checked to see if an opponent was near by. It's just the distance equation that loops through all the players. If your checking if an opponent is near by fairly often (about once per frame per person) then you should probably optimize it some. Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 18, 2002 Author Share Posted August 18, 2002 Thanks alot but where would I put this code? (I am still a n00b at coding) Link to comment Share on other sites More sharing options...
ASk Posted August 18, 2002 Share Posted August 18, 2002 there's a far better method (I used it in my mod to check if the player was at certain distance from the rocket projectile): VectorSubtract(entity1->r.currentOrigin, entity2->r.currentOrigin, a); distcheck = VectorLength(a); distcheck now contains the distance. The VectorSubstract is a define that was in the code and works exactly like Dest's code, but again, it saves typing Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 18, 2002 Author Share Posted August 18, 2002 Ok but say i want this to be checked every frame, where would I put this code and what is the distance measured in? Link to comment Share on other sites More sharing options...
Dest Posted August 18, 2002 Share Posted August 18, 2002 hmm why didn't I think of vector subtract. Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 19, 2002 Author Share Posted August 19, 2002 Originally posted by Jman3ooo Ok but say i want this to be checked every frame, where would I put this code and what is the distance measured in? Can you please answer this question. And can you also tell me how to run a timer? Thanks a lot! Imagine connecting 2 theese board thru a cell phone!!! Thats nad so please let me limit my visits so i dony have 2 w8 fot the banner 2 download Link to comment Share on other sites More sharing options...
Commodus Posted August 19, 2002 Share Posted August 19, 2002 I'm not sure if this is a probability, but could the G_RadiusList function in g_utils.c be used? The function returns all the entities that are within a certain radius from an origin - you could easily code a function based on G_RadiusList that tells you whether there is a person in a certain radius..... BTW, has anybody been able to find where the death messages are located? They're obviously not in the source code... Link to comment Share on other sites More sharing options...
Slunker Posted August 19, 2002 Share Posted August 19, 2002 Try looking in assets1.pk3, in the strip folder... there are a bunch of .sp text format files in there that have things like mission objectives and such. -Slunker Link to comment Share on other sites More sharing options...
Jaii der Herr Posted August 19, 2002 Share Posted August 19, 2002 Originally posted by Jman3ooo Ok but say i want this to be checked every frame, where would I put this code and what is the distance measured in? Depends on what you want to do with the inforations. but there are several functions called everey server frame. I think the server end frame function could be the one you are search Link to comment Share on other sites More sharing options...
Commodus Posted August 20, 2002 Share Posted August 20, 2002 Originally posted by Slunker Try looking in assets1.pk3, in the strip folder... there are a bunch of .sp text format files in there that have things like mission objectives and such. -Slunker Thanks a bunch! Link to comment Share on other sites More sharing options...
Zey Posted August 20, 2002 Share Posted August 20, 2002 Originally posted by Jman3ooo Ok but say i want this to be checked every frame, where would I put this code and what is the distance measured in? wont this lag the game? Link to comment Share on other sites More sharing options...
Commodus Posted August 20, 2002 Share Posted August 20, 2002 Yea, and especially if every guy was using it.... Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 22, 2002 Author Share Posted August 22, 2002 Ok than can some one give me an Idea, I need to check if two people are close to each other so I can enter a faked "Slow Mo" mode by slowing everything down. Any suggestions? Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 22, 2002 Author Share Posted August 22, 2002 Here is another question how would I turn down the reflecting abilities of the lightsabe so more shots get through? I think i have found the line of code in g_weapon.c but it didnt seem to work. Here is what I think is the reflecting code: missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; This is what the code for the rocket is: //rww - We don't want rockets to be deflected, do we? missile->clipmask = MASK_SHOT;// | CONTENTS_LIGHTSABER; This is what I tried to do with the code, which is probaly completly incorrect. if (((rand() % 5) + 1) > 1) { missile->clipmask = MASK_SHOT | CONTENTS_LIGHTSABER; } else { missile->clipmask = MASK_SHOT;// | CONTENTS_LIGHTSABER; } Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 23, 2002 Author Share Posted August 23, 2002 Ok aprelently that line of code does not affect the reflection of shots so I am going to look further, too bad NO ONE WILL ANSwer MY !@#$^&*() question!!!!! LOL Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 23, 2002 Author Share Posted August 23, 2002 To add yet another question that wll probally go unanswered, How would I slow down the speed of saber throw? Link to comment Share on other sites More sharing options...
Primesghost Posted August 23, 2002 Share Posted August 23, 2002 Ok, there are a lot of ways to make a "timer". If I were you, I'd just use the attribute set aside for forceHealTime: self->client->ps.fd.forceHealTime That attribute of the client was origianlly created in order to make force heal work the way it does in SP, but I don't think it's actually used in the MP code at all. What you would do is: (pseudocode) When the player picks up a powerup and you want that powerup to last for say 30 seconds self->client->ps.fd.forceHealTime = level.time + 30000; Then you just make a quick check on it every frame refresh like so: if ((player has a powerup active) && self->client->ps.fd.forceHealTime <= level.time){ deactivate powerup; } Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 23, 2002 Author Share Posted August 23, 2002 Thanks a lot Link to comment Share on other sites More sharing options...
yodaissmart Posted August 23, 2002 Share Posted August 23, 2002 jman what r u trying to make it sound like a perfect dark mod? with smart slow motion and all it seems alot like perfect dark, and using that heal timer instead of making you own does seem like a good idea, also i dont think rockets are actually deflected by the lightsaber i think they blow up on impact, the thing that happens in SP and with bots with rockets is that they are force pushed away so it may seem like they r being deflected but i am pretty shure they aren't so i dont see what u were doing with the code back there heh. Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 24, 2002 Author Share Posted August 24, 2002 Yeah I am trying to make it so less of the shots from a gun are deflected. The mod I am working on is a type of enchanced dueling/ffa were everything will slow down when people get closer, this creating this cool matrix style fight. My friend and I have duked it out and he concluded that it was much funner then the normal mode. I still need answers to my questions cause i am still a n00b coder. I have also suggested this Co-op stealth mod but it hasnt been to popular. Link to comment Share on other sites More sharing options...
Primesghost Posted August 24, 2002 Share Posted August 24, 2002 Have you tested this across the internet? on a server with multiple clients? I believe I read somewhere that force speed was changed in MP because when multiple clients were running at different time scales servers started freaking out. too hard to keep track of who is in which time frame. It sounds really cool but I'm afraid it may end up being a LAN party only sort of mod. Link to comment Share on other sites More sharing options...
Jman3ooo Posted August 24, 2002 Author Share Posted August 24, 2002 But it doesnt alter Time scales It only slows down movement speed, firing velocitity and such It creates this "mock" slow motion. Some animations look a little bad but it doesnt lag. RIght now it always goes in slow motion though because I dont know how to implement the "smart" slow motion. That was the purpose of this thread. Link to comment Share on other sites More sharing options...
NickR Posted August 24, 2002 Share Posted August 24, 2002 Add your checking code to G_RunFrame with some sort of time condition if statement, so you can make your checking every so many seconds. E.G. gentity_t *ent; for (i = 0; i < level.maxclients; i++) { ent = level.gentities; if (ent->slomochecktime <= level.time) { //do your checking here ent->slomochecktime = level.time + 1000 //1 second } } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.