ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Spawning a NPC by a .script possible?

1 2 3 4 5 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  22:52:35  11 April 2012
profilee-mailreply Message URLTo the Top
DutyStalker666
Senior Resident
 

 
On forum: 10/25/2011
 

Message edited by:
DutyStalker666
04/11/2012 23:10:43
Messages: 169
Spawning a NPC by a .script possible?

Hi, I've been trying to spawn a duty member directly outside of Sid's "bunker" in Cordon.
I'm quite new to making advanced scripts so please excuse its "noobishness"

http://pastebin.com/mFPYMjr8 < This is the code which is supposed to spawn a duty member in front of Sid's bunker.

Would anyone know why it doesn't work?

I didn't edit the .spawn at all.
I thought it will be possible to spawn a duty member if a player joins a specific faction such as the military via .script only?

Here are the tutorials I used:
http://forums.filefront.com/s-t-l-k-e-r-soc-modding-mapping-editing/372535-spawning-through-script.html

http://sdk.stalker-game.com/en/index.php?title=Spawning_through_script

Thanks.
  23:26:52  11 April 2012
profilee-mailreply Message URLTo the Top
ThunderFreak
Senior Resident
 

 
On forum: 08/07/2009
Messages: 685
You can use my attack script. There I spawn NPC'S randomly every 6 to 8 ingame hours.
  23:40:26  11 April 2012
profilee-mailreply Message URLTo the Top
DutyStalker666
Senior Resident
 

 
On forum: 10/25/2011
 

Message edited by:
DutyStalker666
04/12/2012 0:47:24
Messages: 169

---QUOTATION---
You can use my attack script. There I spawn NPC'S randomly every 6 to 8 ingame hours.
---END QUOTATION---



That would be helpful to see what I done wrong . where would I find your attack script?
I looked everywhere for your "raid mod" and I can't seem to find any download links to it...
Could you upload it?

Thanks
  11:41:30  12 April 2012
profilee-mailreply Message URLTo the Top
ThunderFreak
Senior Resident
 

 
On forum: 08/07/2009
Messages: 685
OK. I have to re-upload it.
  11:49:11  12 April 2012
profilee-mailreply Message URLTo the Top
DutyStalker666
Senior Resident
 

 
On forum: 10/25/2011
Messages: 169

---QUOTATION---
OK. I have to re-upload it.
---END QUOTATION---



I'll be there at the front of the queue.
  14:50:30  12 April 2012
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
 

Message edited by:
insanelazarez
04/12/2012 14:51:23
Messages: 1070

---QUOTATION---
Spawning a NPC by a .script possible?

Hi, I've been trying to spawn a duty member directly outside of Sid's "bunker" in Cordon.
I'm quite new to making advanced scripts so please excuse its "noobishness"

http://pastebin.com/mFPYMjr8 < This is the code which is supposed to spawn a duty member in front of Sid's bunker.

Would anyone know why it doesn't work?

I didn't edit the .spawn at all.
I thought it will be possible to spawn a duty member if a player joins a specific faction such as the military via .script only?

Here are the tutorials I used:
http://forums.filefront.com/s-t-l-k-e-r-soc-modding-mapping-editing/372535-spawning-through-script.html

http://sdk.stalker-game.com/en/index.php?title=Spawning_through_script

Thanks.
---END QUOTATION---



Are you interested in an alternative?

Let's pretend that is the case.

Unpacked files required:

config\scripts\esc_tutorial.ltx
xr_effects.script

1 - Open 'esc_tutorial.ltx' and change it this way:


---QUOTATION---


[sr_idle@tutorial]
on_info = {+esc_tutorial_start} nil %=create_this_item_on_actor(gar_dolg_respawn_1)%


---END QUOTATION---



2 - Add this to 'xr_effects':


---QUOTATION---


function create_this_item_on_actor(actor, npc, p)
local stuff = p[1]
local npc = db.actor

alife():create(stuff,
npc osition(),
npc:level_vertex_id(),
npc:game_vertex_id())
end


---END QUOTATION---



You can change the name of the item for anything you want. Weapons, spawn sections, explosive barrels, etc.

Have fun.
  14:52:49  12 April 2012
profilee-mailreply Message URLTo the Top
insanelazarez
Yeah, Good Luck With That...
(Resident)

 

 
On forum: 01/31/2009
Messages: 1070
Btw, the game tutorials will be disabled. Keep it that way.
  17:15:05  12 April 2012
profilee-mailreply Message URLTo the Top
DutyStalker666
Senior Resident
 

 
On forum: 10/25/2011
Messages: 169

---QUOTATION---
Spawning a NPC by a .script possible?

Hi, I've been trying to spawn a duty member directly outside of Sid's "bunker" in Cordon.
I'm quite new to making advanced scripts so please excuse its "noobishness"

http://pastebin.com/mFPYMjr8 < This is the code which is supposed to spawn a duty member in front of Sid's bunker.

Would anyone know why it doesn't work?

I didn't edit the .spawn at all.
I thought it will be possible to spawn a duty member if a player joins a specific faction such as the military via .script only?

Here are the tutorials I used:
http://forums.filefront.com/s-t-l-k-e-r-soc-modding-mapping-editing/372535-spawning-through-script.html

http://sdk.stalker-game.com/en/index.php?title=Spawning_through_script

Thanks.

Are you interested in an alternative?

Let's pretend that is the case.

Unpacked files required:

config\scripts\esc_tutorial.ltx
xr_effects.script

1 - Open 'esc_tutorial.ltx' and change it this way:



[sr_idle@tutorial]
on_info = {+esc_tutorial_start} nil %=create_this_item_on_actor(gar_dolg_respawn_1)%



2 - Add this to 'xr_effects':



function create_this_item_on_actor(actor, npc, p)
local stuff = p[1]
local npc = db.actor

alife():create(stuff,
npc osition(),
npc:level_vertex_id(),
npc:game_vertex_id())
end



You can change the name of the item for anything you want. Weapons, spawn sections, explosive barrels, etc.

Have fun.[/quote]

Thanks for replying. I would prefer to learn how to spawn npcs via script as that way I will remember how to do it instead of copying and pasting. Ok... I made the changes to both of the files and... *NOOB MOMENT* I ran the game... Without editing your example in any way. LOL. Needless to say... It crashed. I'm confused on how its supposed to be structured. I then got my old script and pasted some bits in and I got a crash. Here's the log:

"error]Expression : fatal error
[error]Function : CScriptEngine::lua_error
[error]File : E:\stalker\sources\trunk\xr_3da\xrGame\script_engine.cpp
[error]Line : 73
[error]Description : <no expression>
[error]Arguments : LUA error: ...shadow of chernobyl\gamedata\scripts\xr_logic.script:603: attempt to index global 'xr_effects' (a nil value)"

Basically it means I messed up on scripting

Here is my updated "script":

function create_this_item_on_actor(actor, npc, p)
local stuff = p[1]
local npc = db.actor
alife():create("bar_dolg_respawn_3",a.x = -250.32, a.y = -19.52, a.z = -127.17)
npc:level_vertex_id(), 1
npc:game_vertex_id(),
end

Am I doing it all wrong? :S
  21:36:52  12 April 2012
profilee-mailreply Message URLTo the Top
ThunderFreak
Senior Resident
 

 
On forum: 08/07/2009
Messages: 685
Because I don't understand your last post, I give you my attack script.

http://pastebin.com/wXBQLhPU

There you can see what is wrong with your script.
  21:53:22  12 April 2012
profilee-mailreply Message URLTo the Top
DutyStalker666
Senior Resident
 

 
On forum: 10/25/2011
 

Message edited by:
DutyStalker666
04/12/2012 22:38:58
Messages: 169

---QUOTATION---
Because I don't understand your last post, I give you my attack script.

http://pastebin.com/wXBQLhPU

There you can see what is wrong with your script.
---END QUOTATION---



Thanks a lot thunderfreak Lol my "script" is a epic fail... I'm gonna study this... *already learns something* Ohhh!!! Thats why!

EDIT: Here is the updated script:

function factionspawn()

local levels = [{1] = "101_escape"}

local coordinateA = [{1] = {x = -250.32, y = -18.05, z = -127.13]
local level_name = level.name()
if db.actor:character_community() == "military" then
alife():create("bar_dolg_respawn_3",
vector():set (-250.32, -18.05, -127.13), db.actor:level_vertex_id(), db.actor:game_vertex_id())

end
end

It looks much better but still not spawning for some reason
Must I make a trigger in the faction change.script?
The position the duty member should spawn is outside of Sid's bunker.
 
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-2022 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.