I have scripted weapons so that they spawn on multiplayer DM maps. They work properly and everything but I can't seem to limit how many rounds of bullets are in the gun when you pick it up. For example when I pick up a this Colt .45 I spawned it comes with full 100 rounds. How do I make the Colt .45 comes with 0 rounds so that you have to go and pick up ammo clips somewhere else? I'm using this code here:
And how do I limit how often you can pick up spawned items? Say I have a pistol clip lying on the floor. When I go over it I can continuesly pick it up until I have full ammo. Is there a way I can put a time limit on it or something so I can only pick it up every 30 seconds or so?
you need to stop the colt from spawning multiple times, spawning just one will probably get you a colt and an extra clip. picking it up when you have a colt will give you 16 extra rounds.
if it doesn't work then you can fake it;
make a "dummy" colt, place a trigger_use around it wit hthe following key/values.
setthread/giveColt wait/10
and put this in your script (as a separate thread)
takes all pistol rounds away from the player, faking him not getting or having any when he picks up teh pistol.
It doesn't. This command does not set the player's ammo, its purpose is to give the player the amount of ammo given. To take ammo away you should use (I think):
thread spawnColt:
local.spawnDelay = 10 // this sets the colt to spawn in 10 seconds interval
while (1)
{
local.colt45 = spawn spawn models/weapons/colt45.tik origin ( 895.63 501.87 437.17 )
local.colt45 set_respawn 0
wait local.spawnDelay
local.colt45 set_respawn 1
}
You put spawn in twice. I put this code in exactly (with only one spawn) and it didn't work. The gun didn't show up at all. I checked my spelling mistakes and nadda.
lizardkid how do I place a trigger_use around it with the keys/values you gave me? I think I'll look at some scripting tutorials to figure that out.
Rookie One I took out the colon at the end of spawnColt and it worked, well sorta. The model of the gun respawns every 10 seconds, but I can still pick up ammo when it's not there. I'll keep trying though.
I launched the game and it did what I said before - the colt respawns every so seconds but I can keep picking up ammo when it's not there. I tried this several times and I got the same results. Then, for some unknown reason, I started the game a few minutes ago, and it worked. Wtf? I didn't alter the code or anything. I guess it was just fucking with me.
why not, when the player picks up the colt (or in other words when your trigger is triggered), remove the trigger and colt? Or have a trigger_use(or multiple) around the colt so when a player goes to pick up the ammo n' such, he does, then the colt goes away FOR GOOD! so the layer cant keep getting ammo from the gone colt....(you can do this by:
Putting a trigger multiple around the gun on the floor, five it a sethhread of removecolt, and then write in your script,