Hi there,
i am working on a new Project. It’s a coop game like Resident Evil 7 mixed with Alan Wake. The campaign is designed for coop but also for singleplayer. Now i have some questions and hope someone can give me a hint how i set up some things.
What’s the Goal? I have several objects the Players can interact with.
- Doors
- Lights
- Switches
- Switches with Password to unlock some objects like doors, or lockers
- Pickups
For now all things are working. Each Player (Server or Client) can pickup items (1 for now), toggle the lights over a Switch, enter a Password to unlock doors or shoot at the lights do destroy them. For my question i explain how i set up my lights with Switch.
I made a Switch blueprint. It work like in singleplayer. You overlap a sphere collision and then the Switch enables the Input for that Player. If you “use” the Switch, the lights toggle there visibility. The lights are a simple Array from the actor BP_Lights. If i place the Switch in the Level i can assign each light i want to that Switch. BUT: How do i manage if i have, let’s say 4 types of lights. If i want to use that lights i have to make the whole script for each light again.
Is there a way to have one Master-Blueprint and get the object of that? What’s the best way to handle multiple types of blueprints with one script?
I think there must be a way. For now all is working. But if i have to make for each object the same script, i don’t know if this is good.
For Detail:
In many Posts i saw, that the People have the Problem to get the Players Controller id. In singleplayer it is always 0. But in multiplayer i have found a way that work. Like i say with overlapping Players and enable Input. I do the following: OverlappingActor->Cast to Player->get controller->cast to controller->get controlled pawn->enable input->Use object->cast to controller->Use “Server”->cast to player->Use
This way is really complicated, but it work very well.
I hope someone could give me a tip how to handle many types of items.