I set bReplicateInstigator to true in the weapon class. This seemed to fix the instigator replication problem I was having.
Now the new problem:
When I get into the vehicle the game crashes. In the log it says that the "clientstate is WRONG!" for the weapon. I logged the states of the weapon on the client and the server. On the server the state is ws_hidden. On the client the weapon state is ws_none.
Any suggestions on why they are getting out of sync? Or how to fix it?
No, that's not it, but thanks for the help. Currently, I don't even have a mutator. I've just added my classes to the onslaught and xweapons packages. I know this isn't the right way to do it, but I figured I'd build the mutator after I got the stuff working.
I've made some progress on the problem. When you get into a standard vehicle the ClientRegisterVehicleWeapon function runs. I *think* this function makes the vehicle's weapons relevant to the player. I've made a similar function to make inventory items of the vehicle relevant to the player. My function seems to work. The client now knows what the inventory is. But it still doesn't work. I just started looking at the new problem, so I don't have a good handle on what it is. But I *think* on the client the inventory items don't know who their instigator is. Since many functions in weapons use instigator the weapon isn't working. I'll keep looking at this and post any updates.
Ok If it works in Your Listen server but not in Dedicated, it may be because u need to add the mutator package name to the Server Packages list in UT2004.ini
I'll quick ask my question, then go into the details of it afterwards.
How can I make a vehicle's pre-existing inventory items relevant to a player who gets in the vehicle?
I am trying to attach hand weapons to vehicles for use by the driver. The way I went about this was by just adding a weapon to a vehicle's inventory. A vehicle is a pawn, so this works. With some slight additions to the weapon/vehicle code this works perfect in a listen server, but not on a dedicated server. So I assume I'm having a replication problem.
The problem is: when a player gets into a vehicle, the player has no access to the weapons that the vehicle is spawned with. If a player drives over a pickup they can pickup the weapon and everything works correctly. The problem is only with weapons that the vehicle spawned with. I am guessing that the inventory on the vehicle is somehow not relevant to the player when they get the vehicle. The vehicle actually owns the weapons, so in the weapon code I made bOnlyRelevantToOwner = false. This made no difference. I tried making the weapon bAlwaysRelevant as well. That didn't work. I tried setting the owner equal to the player when someone enters the vehicle. That didn't work.
Leave a comment: