coding question list -1 reply

Please wait...

FaceFlayer

I'm too cool to Post

50 XP

5th September 2004

0 Uploads

14 Posts

0 Threads

#1 14 years ago

I'm working on a mod, but it's going slow. And without help, it might not get finished. If you can make any comments on the questions below, it would really help me. Just pointing me to examples in the existing script would be great as well...

Question 1

------------

What I want to do: I want to have the player drop their current weapon by pressing j and ammo by pressing u What I don't know: where do I start the action script? I mean.. I can put bind "j" "_dropCurrnetWeapon" in the config file, but then where and how do I start the _dropCurrentWeapon action? in the ai.player.script? void player::_dropCurrentWeapon() {} ? just like that?

Question 2

-----------

What I want to do: I figure, when the player hits j, I'll have it remove the weapon from the players inventory, and then spawn a new instance of that weapon in front of the player. What I don't know: How the sys.spawn() code really works.. I don't understand what argument it wants passed. it says spawn(string classname). What are those? the spawnclass of the machinegun is "idItem", Is that important? I've put in a ton of guesses in but they've all failed.

Question 3

----------

what I want to do: disable the player from automatically picking things like ammo and weapons up. what I don't know: where is the code that executes that feature is. Is it a part of each item? if it is, I can't recognize it. Is it a global function for all items? Is this something in the SDK?

Question 4

----------

what I want to do: use that cursor dealy that shows up when you talk to NPCs to be used to pick up items. when the player "aims" at something, it says what it is (how much ammo maybe) and the player clicks to grab the item. What I don't know: once again, I don't recognize where the code that operates that cursor dealy is. I've looked at the ai_alphalabs2_scientist1.script but I can't see anything I think is that.

If anyone is curious, I'm working on a team style mod that slows the action down a bit so that tactics can play a better part. I've managed (with great help from S7ATiC here on the forum) to get the weapons to be inaccurate when players are moving, and I want to make the players inventory have weight that slows them down. So if you've just got a machinegun, you will be faster than someone lugging a missile launcher, chaingun, and whatever else they are packin. It will be based on total inventory, not just the current weapon, so there will be no switching to a "fast" weapon to escape or get into position quicker. I have another set of changes I'd like to make if I can get these simple ones to work first. Like different armor types with changing player models. Helmets that limit vision but omit headshots. My vision is a map with bases on either side with an armory. Players load up on the gear they want and try to capture a flag or something. I was in a Team Fortress clan and I loved the class idea. But I want a system that promotes specialization, but is not arbitraraly forced as, you are a heavy, you are a sniper. I just want a good ballance of usefullness/drawbacks for everything, so that people naturally make classes for themselves.

Anyway. Thanks for any help you can give me.




S7ATiC

Offworld Dev

50 XP

7th September 2004

0 Uploads

41 Posts

0 Threads

#2 14 years ago

You ever play Tribes 1/2 or the Tribes: Vengence demo? Inventory stations.... As for ammo on weapons, I have a few ideas how to get to it in script, but as of now there is no example already done by id in script, and manual object recursion is slow and repetative. Stuff on Offworld I'm gonna try to introduce; An 'overall' limit on weight limit introduced, with players able to set a 'max' weight, which will make them automaticly decide if they can pick up an object they run over.. as well with 'max' ammo per weapon, and 'max' weapons, which weapons to explicitly not pick up.. etc.. will have 'presets' that you can call.. hopefully with a GUI you can set pre-spawn.. Spawning stuff is easy, although I've only been doing stuff like... entity owner; entity object; vector objectVec; owner = getOwner(); object = spawn(weapon_machinegun or something); objectVec = owner.getOrigin(); //I had it modify the position to be relative to the players handedness //(which is always to the right, but had another var to get player angles, //and to adjust position relative to that .. few sin & cos.. and erm.. //this is all I recall, atm) object.setOrigin(objectVec); objectVec = owner.getAngles(); //I had it modify the angles to angle slightly away from the player too.. object.setAngles(objectVec); then I set how much ammo the object has, and whatnot, in it's args.. I just wrote that out by hand so it may be inaccurate, not copy/paste, so I dunno exactly what I have.. but eh.. I got somethin. :P So far, the only form of client-side-command interaction I have been working with is server cvars, but you have to be admin of the server to set them, and entering them is timeconsuming, and it is a ridiculous way to issue commands... but it lets me test jettisoning and weapon dropping.. Basicly, I have a loop running on player init to check a bunch of cvars every frame, sys.getcvar / setcvar, and on the client I have a few binds to do "set jettison_ammo blah blah"..




FaceFlayer

I'm too cool to Post

50 XP

5th September 2004

0 Uploads

14 Posts

0 Threads

#3 14 years ago

Thanks for that sample. It's that one line that I'm still having the real trouble with: object = sys.spawn(WHAT THE HELL GOES HERE?!); nothing I try seems to work.




FaceFlayer

I'm too cool to Post

50 XP

5th September 2004

0 Uploads

14 Posts

0 Threads

#4 14 years ago

WOO! It's:

sys.spawn("moveable_item_machinegun"); Triumph of the trial and error. Your other code worked flawlessly S7ATiC, thanks. Now I need to figure out how to make actions that I can bind. So far I've just been testing the spawn code with a machinegun shot. I also need to figure out how to displace the origin of the item a little ways away from the player. That's next..




FaceFlayer

I'm too cool to Post

50 XP

5th September 2004

0 Uploads

14 Posts

0 Threads

#5 14 years ago

Funny. I finally got the code for spawning an item working, I even got it to appear where I wanted it. Then I started trying to find out how I could bind the action of spawning an item to a key in the config. Basically I'm working on dropping a weapon, as you may have read above. While I was looking in the config file I see there is a command for droping your current weapon. clientDropWeapon. Only works in multiplayer though. Anyway. I still need to edit the command a bit because I want to drop ammo as well. So I did a search for clientDropWeapon in the doom3 directory. It found it in the gamex86.dll Anyone know how I can get in that file? Do I have to wait for the SDK thingy for that?