Random amount spawning
2 posters
Operation Flashpoint Dragon Rising OFDR Forums :: OPERATION FLASHPOINT: DRAGON RISING :: OFDR EDITING :: EDITING Q+A
Page 1 of 1
Random amount spawning
I have an idea for my zombie mod to do with random spawning. Problem is (as alsways I have a problem with things not doing what I want) I'm not sure how to work it out.
The spawning of units is the easy part but getting a random amount to spawn is the hard part. So for eaxmaple.
You play DRZ and enter Skoje, you have 10 zombies spawn at ten recon points in the town, fair enough you kill them but you got stabbed and you die oh well! You restart and the next time you enter skoje, the amount has either increased from ten zombies to maybe 15, or it could have been less say 6 zombies this time. But As you can see I would ideally like this to have a random spawn code for the zombies.
NFMZ1 planted the idea for this as he said you go one place you have a **** load to deal with, but then the next time you go back, you don't.
Cheers
MD.
The spawning of units is the easy part but getting a random amount to spawn is the hard part. So for eaxmaple.
You play DRZ and enter Skoje, you have 10 zombies spawn at ten recon points in the town, fair enough you kill them but you got stabbed and you die oh well! You restart and the next time you enter skoje, the amount has either increased from ten zombies to maybe 15, or it could have been less say 6 zombies this time. But As you can see I would ideally like this to have a random spawn code for the zombies.
NFMZ1 planted the idea for this as he said you go one place you have a **** load to deal with, but then the next time you go back, you don't.
Cheers
MD.
Re: Random amount spawning
Here's an idea, but since I'm not very experienced with editing, it may need some tweaking:
I hope I posted this right, and I'm sure it won't work as it is, but some of the more experienced editors may be able to do something with it. Hope it helps...
- Code:
base_zomb = getAmmoCount("player") --this will generate a semi-random number (the ammo count of the player) --
zomb_spawn = base_zomb*10 -- this will give you a number of zombies for your horde but could be a multiple of anything (in this case 10) --
function onEnter_player_trigger(unitName, zoneName) -- the player enters the specific zone --
spawn_prob = getSpawnProbability("smartspawn") -- using a smart spawn, this will give you a probability of whether it will activate between 0.0 and 1.0 --
if spawn_prob <= 0.5 and if zomb_spawn >=1 then
zombie_horde = OFP:activateEntitySetAtEntityPosition("zombie", "reconpoint") -- this part spawns your zombies in a loop until the variable zomb_spawn reaches 0
zomb_spawn = zomb_spawn -1
elseif zomb_spawn = 0 then
OFP:disableEvent("activateEntitySetAtEntityPosition")
end
end
I hope I posted this right, and I'm sure it won't work as it is, but some of the more experienced editors may be able to do something with it. Hope it helps...
Guest- Guest
Re: Random amount spawning
Unfortunately the use of smart spawns is not possible. This is a pretty easy task to accomplish codewise though. Try something like this.
It will look something like that. I'd have to see your implementation of spawning code and how you're controlling the different locations for spawning, but that's the general gist of it.
Cheers:D
- Code:
function onEnter(zoneName, unitName)
if zoneName == "yourZoneName" then
numberOfZombies = math.random(yourMinZombies, yourMaxZombies)
for i = yourMinZombies, yourMaxZombies do
---your spawn code here
end
end
end
It will look something like that. I'd have to see your implementation of spawning code and how you're controlling the different locations for spawning, but that's the general gist of it.
Cheers:D
Guest- Guest
Re: Random amount spawning
Hey Mdog,
I just happened to working on something like what you want, putting it into a module.
This will do what you want and give you added control. It also automates despawning and entity limit checking.
Check it out here...
https://operationflashpoint.forummotion.com/t48-random-unit-spawn#138
I just happened to working on something like what you want, putting it into a module.
This will do what you want and give you added control. It also automates despawning and entity limit checking.
Check it out here...
https://operationflashpoint.forummotion.com/t48-random-unit-spawn#138
tjdagger- Admin
- Location : Silverdale, Queensland, Australia
Points : 107
Reputation : 7
Join date : 2012-12-17
Age : 48
Similar topics
» Another random unit spawning module
» Spawning an Entity Set
» Spawning a set of props so they keep their shape
» Random Unit Spawn
» Spawning and Controlling Spawned Units TemplarGFX
» Spawning an Entity Set
» Spawning a set of props so they keep their shape
» Random Unit Spawn
» Spawning and Controlling Spawned Units TemplarGFX
Operation Flashpoint Dragon Rising OFDR Forums :: OPERATION FLASHPOINT: DRAGON RISING :: OFDR EDITING :: EDITING Q+A
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|