ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
spawning through a script help

« Previous 10 events | 1 2 3 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Oldest Up Sort by Ascending
  21:21:57  26 February 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070

---QUOTATION---


I like that name - Magic Script. Sounds cool. I am serious...


---END QUOTATION---



You are welcome... and i am serious too...

But i also think all.spawn, deserves a new name:

All.spawn definition:

'Non Dynamic Crappy File - Should be Deleted by Magician after update'

In fact why not create a mod where you move the all.spawn... to the recycle bin? I mean... nobody is using it, right?

Imagine the Magic we can do if we delete the 'Non Dynamic Crappy File'. See? We already have HDDs with 5TB... but 4.5 Mb more is always a good idea. We can always call it... Magic.

Duh...

Guys, i am messing around... but like i said in the my previous post... it was just an opinion.

Btw, you can't move anomalies via all.spawn... only because the script support for that doesn't exist. We just need to create it. I mean, to open a locked door you need a key. It doesn't mean the door (or the key) are bad. Both things are required.

If you guys, don't agree with me... well... you can always blame that guy from youtube...

[link]http://www.youtube.com/watch?v=A-H_AJPrhL8[/link]

Disclaimer:

No 'Magic Script' or 'Non Dynamic Crappy File' were used to upload the previous video. Only 'Firefox'...

You're Welcome...
  20:45:32  26 February 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070

---QUOTATION---
The long load times in Call of Pripyat isn't due to script spawning it's because the levels are much larger and that the gulag is generated from scratch.
---END QUOTATION---




I never said anything about loading times, mate.
  18:19:18  26 February 2013
profilee-mailreply Message URLTo the Top
ThunderFreak
Senior Resident
 

 
On forum: 08/07/2009
 

Message edited by:
ThunderFreak
02/26/2013 18:19:55
Messages: 685
There are reasons to use the all.spawn but there are also reasons to use a 'Magic Script'. Specially when it comes to dynamic features, then you are forced to use Magic Scripts. (I like that name - Magic Script. Sounds cool. I am serious. )
In my ShoC mod project 'Project Invasion' i have dynamic anomalies which means after every blowout the anomalies disappear from their current position and appear again on a totally different position. This can be done only by a Magic Script. If you like I can give you much more examples when it's better to use a spawn script or when you can't use the all.spawn.
  17:56:41  26 February 2013
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
Messages: 2230
The long load times in Call of Pripyat isn't due to script spawning it's because the levels are much larger and that the gulag is generated from scratch.
  17:25:31  26 February 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070

---QUOTATION---
There is not much difference between spawning by script or from the all.spawn. There is no magical thing that makes spawns random or randomly in different locations unless the script itself does it. The only issue I see where an NPC wouldn't spawn at a given position is if it's an invalid vertex id. If the spawn count is doubling after reloads that means you need to store the ids of the created objects to persist through saves.

It's entirely safe and healthy to spawn by script. In Call of Pripyat, for example, that's the only way NPCs are spawned.
---END QUOTATION---



Well, if the spawn script has an issue that is a problem. But consider this...

On purpose lets create a npc via all.spawn but on a invalid location... result the game will crash. And why... because the spawn location is invalid. Test it again... and again will crash. And so on.

Now keep the coordenates and delete the all.spawn. Now create a 'Magic script' to produce the same npc... in the same coordenates.

Start a new game... and remember the location is still invalid... but now in 50% of the tests... the game wont crash at all. Why? Does this mean the 'Magic Script' is better than all.spawn? For some modders, maybe. For me it just means one thing, the 'Magic Script' is not creating the npc where it should... at all. For some reason the game doesn't crash. This is easy to understand.

I know in cop the spawns are generated by script. And result is one hell of a mess.

Cop game files here... actor in zaton:

;zat_a1_logic.ltx


---QUOTATION---


[logic]
active = sr_idle@game_start

[sr_idle@game_start]
on_info = {=actor_on_level(zaton)} sr_idle@game_start_2 %=damage_actor_items_on_start%

[sr_idle@game_start_2]
on_info = sr_idle@timer %+zat_a1_game_start%

[sr_idle@timer]
on_game_timer = 3000 | sr_idle@free %+zat_a1_simulation_start%
on_info = {+about_skadovsk_dialog_done -zat_a2_reach_base} %+zat_a2_reach_base =give_task(zat_a2_reach_base)%
on_info2 = {-zat_a2_reach_base =actor_in_zone(zat_a2_sr_noweap)} %+about_skadovsk_dialog_done +zat_a2_reach_base%
on_info3 = {-zat_a2_reached_skadovsk =actor_in_zone(zat_a2_sr_noweap)} %+zat_a2_reached_skadovsk =scenario_autosave(st_save_zat_a2_reached_skadovsk)%


---END QUOTATION---



Remember the lag when the game starts? Take a good guess... '+zat_a1_simulation_start'... the info is checked by 'zat_sim_29.ltx'


---QUOTATION---

[spawn_stalker@novice]
spawn_squads = stalker_sim_squad_novice
spawn_num = {+zat_a1_simulation_start -zat_b28_heli_3_searched -zat_b100_heli_2_searched -zat_b101_heli_5_searched} 4, 0

[spawn_stalker@advanced]
spawn_squads = stalker_sim_squad_novice, stalker_sim_squad_advanced
spawn_num = {+jup_b218_pripyat_group_gathering} 0, {+zat_a1_simulation_start +zat_b28_heli_3_searched} 4, {+zat_a1_simulation_start +zat_b100_heli_2_searched} 4, {+zat_a1_simulation_start +zat_b101_heli_5_searched} 4, 0

[spawn_stalker@master]
spawn_squads = stalker_sim_squad_advanced, stalker_sim_squad_advanced, stalker_sim_squad_veteran
spawn_num = {+zat_a1_simulation_start +jup_b218_pripyat_group_gathering} 4, 0


---END QUOTATION---



So in 3 seconds the game, is creating npcs assigned to smart terrains (the smart terrains... you know... the worst feature of the stalker games... duh!!!).

And this doesn't include the 'auto save' feature enabled. How many times the game crashes when you load an auto save? It's like 70% ctds, maybe more.

I like to create things by script too... like this:


---QUOTATION---


[sr_idle@game_start_2]
on_info = sr_idle@timer %=spawn_npc_in_zone(scientific_outfit:zat_a2_sr_noweap) +zat_a1_game_start%


---END QUOTATION---




See? We have a nice suit in that location now... but a suit is just a suit. Unless you have a smart terrain for it ahahaha...

People don't like all.spawn because it is time consuming... and it's easier to use a 'Magic script'... to create squads... for smart terrains (and other things).

And btw, you can create npcs by all.spawn too... but the 'spawn condition function' (if present) was changed by gsc. And it becomes obsolete, the item will spawn always from the start. Some 'Magic Scripter' decided that the function 'to spawn an npc if a condition is present'... is not good, WOW!!!

To compensate us... gsc gave us a nice autosave feature, for 3 seconds later to recreate some very nice... smart terrains, ahahah.

My post reflects an opinion, in this case... my opinion.

Well, i just added a coop npc to my 'Stalker survival' game mode.

Here...

[link]

http://www.youtube.com/watch?v=43zqU-qC4_I

[/link]

But believe, or not the hostile waves are created by script... and i have an autosave feature too (betwen waves of course). Do you see any lag?

Well, that's it...
  05:49:52  26 February 2013
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
Messages: 2230
There is not much difference between spawning by script or from the all.spawn. There is no magical thing that makes spawns random or randomly in different locations unless the script itself does it. The only issue I see where an NPC wouldn't spawn at a given position is if it's an invalid vertex id. If the spawn count is doubling after reloads that means you need to store the ids of the created objects to persist through saves.

It's entirely safe and healthy to spawn by script. In Call of Pripyat, for example, that's the only way NPCs are spawned.
  22:09:09  25 February 2013
profilee-mailreply Message URLTo the Top
ThunderFreak
Senior Resident
 

 
On forum: 08/07/2009
Messages: 685
Almost all my spawns I do with script spawn. Never had the problem you described. The items, monsters, zombies and so on always appeared at the spawn coordinates.
And in his script the difference to the spawn point is max. 5 meters.
  20:09:28  25 February 2013
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
 

Message edited by:
insanelazarez
02/25/2013 20:10:47
Messages: 1070

---QUOTATION---
Did you change something on the script example I posted?

The number of spawns cannot be random. The spawn amount is set to 10.

for i=1,10 do

Add a "debug" line after the line
zombie_IDs[i] = spid.id

to see how many zombies are really spawned.
The debug line is
dbglog("ID %s is spawn number %s",tostring(zombie_IDs[i]),tostring(i))


When you finish the game then you will see in the game log file how many zombies has been spawned on each spawn action.
Hope that helps.
---END QUOTATION---



Well, he is creating items by script... so he might see 7 zombies only... and in the next test... kazaam 9 zombies. And this without considering how fast or slow his system is. It's important see... cause the script never produces the spawn in the same place. Sometimes you want a zombie to spawn 100 metters from you, but... no, he is spawning 3 metters from you. That is 97 metters from the position you want him to spawn. That's one of the reasons why i only add creatures by all.spawn. But i use new functions too, of course i do. In special new functions to allow npcs to create... some item close of their position... but the spawn of the creature itself... must be added by all.spawn. It's the only accurate way to spawn a creature... in position x,y,z. The position will always be the same.
  17:12:07  25 February 2013
profilee-mailreply Message URLTo the Top
ThunderFreak
Senior Resident
 

 
On forum: 08/07/2009
Messages: 685
Did you change something on the script example I posted?

The number of spawns cannot be random. The spawn amount is set to 10.

for i=1,10 do

Add a "debug" line after the line
zombie_IDs[i] = spid.id

to see how many zombies are really spawned.
The debug line is
dbglog("ID %s is spawn number %s",tostring(zombie_IDs[i]),tostring(i))


When you finish the game then you will see in the game log file how many zombies has been spawned on each spawn action.
Hope that helps.
  05:27:14  25 February 2013
profilee-mailreply Message URLTo the Top
Rattertat
(Novice)
 
On forum: 02/20/2013
Messages: 4
Hi Thunder, thank you very much for writting the script out again. I have been testing it alot and am not sure if a bug. I sometimes get 1 zombie or maybe 10, sometimes I also get 0. It is very random, how do I set an exact number, like 10 or 5, etc... I have tried changing some variables in
the script, but either nothing happens or I crash...

Thank you for the link to your other scripts/mods, but I need to take baby steps and want to learn from the one you posted before I start going crazy
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2021 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.