Forums
Games
Cyberpunk 2077 Thronebreaker: The Witcher Tales GWENT®: The Witcher Card Game The Witcher 3: Wild Hunt The Witcher 2: Assassins of Kings The Witcher The Witcher Adventure Game
Jobs Store Support Log in Register
Forums - CD PROJEKT RED
Menu
Forums - CD PROJEKT RED
  • Hot Topics
  • NEWS
  • GENERAL
    THE WITCHER ADVENTURE GAME
  • STORY
    THE WITCHER THE WITCHER 2 THE WITCHER 3 THE WITCHER TALES
  • GAMEPLAY
    THE WITCHER THE WITCHER 2 THE WITCHER 3 MODS (THE WITCHER) MODS (THE WITCHER 2) MODS (THE WITCHER 3)
  • TECHNICAL
    THE WITCHER THE WITCHER 2 (PC) THE WITCHER 2 (XBOX) THE WITCHER 3 (PC) THE WITCHER 3 (PLAYSTATION) THE WITCHER 3 (XBOX) THE WITCHER 3 (SWITCH)
  • COMMUNITY
    FAN ART (THE WITCHER UNIVERSE) FAN ART (CYBERPUNK UNIVERSE) OTHER GAMES
  • RED Tracker
    The Witcher Series Cyberpunk GWENT
THE WITCHER
THE WITCHER 2
THE WITCHER 3
MODS (THE WITCHER)
MODS (THE WITCHER 2)
MODS (THE WITCHER 3)
Menu

Register

Spawn NPC's?

+
A

Arkray_gog

Forum veteran
#1
Sep 24, 2008
Spawn NPC's?

;D No, don't wonder too much by the subject, I know very well how to spawn NPC's but my question is more especific:Let's say I have an NPC that has an story phase WITHOUT actions becuse he has to follow Geralt. It works fine. But Geralt goes in and out of several locations so my NPC has several spawn_points in front of every door, but all them have the same 'spawn string'. The more thre are the higher the chance my NPC gets spawned in the wrong location and so he is not there next to Geralt when entering the area....HOW can I spawn an NPC in an exact-tagged-spawn point??? My intention is to use the script in the waypoint Geralt uses to enter the area to spawn my npc in the spawn point _next_ to that waypoint used.... If I remember well in the 4th act the cow and Alvin where always spawned in the same 'door' Geralt used...I have thought in another option, and it is setting flags when the way points are used (OR the indoor area doors are used) and according to the flag decide what story phase to use, and have an story phase for every spawn point... but I would prefer to force the spawn.... althougth now that I think about it, if I set the flag when the door is used at arriving the next area I would be able to set the story phase _before_ the NPC's heartbeat trigger is executed (it is where his follow code is)...... I may have found an alternate solution while I was writing... ;DSorry for the long explantion, BUT that is the only thing I have to fix to end my adventure... that and to adjust the minimap for once.... it is so difficult that I'm about to give up :wall: Btw, the 'gift' gameplay in conversations is BUGGY!!!! It was a nigthmare to avoid the clyclic behaviour in the conversation!!!! Another day I'll explain how I did *is exhausted*
 
A

ailinon

Senior user
#2
Sep 24, 2008
My guess is it would suffice to just let the NPC spawn anywhere they wish to, and teleport them next to Geralt as soon as he enters the area. In such a case you wouldn't even need to have multiple spawn points - once you move this behaviour into script realm, you could as well have the NPC appear precisely 3.5 meters in front of Geralt, or something.-- Sinus
 
A

Arkray_gog

Forum veteran
#3
Sep 24, 2008
Ailinon said:
My guess is it would suffice to just let the NPC spawn anywhere they wish to, and teleport them next to Geralt as soon as he enters the area. In such a case you wouldn't even need to have multiple spawn points - once you move this behaviour into script realm, you could as well have the NPC appear precisely 3.5 meters in front of Geralt, or something.-- Sinus
Click to expand...
Ummm, good idea, thanks, but what is the function? :wave:Found it:With AssignCommand and this one:void ActionMoveToObject( object oTarget, int bRun = FALSE, float fRange = 1.0f);But with a function like that, if the NPC is far away... will walk all the way to target? I hope not....
 
A

ailinon

Senior user
#4
Sep 24, 2008
Yes, it will. You need ActionJumpTo* for instant jumps.-- Sinus
 
A

Arkray_gog

Forum veteran
#5
Sep 25, 2008
*notes* Thank you millions :angel: I hope to be able to finish what I'm doing now :whistle: :whistle: :whistle: :whistle:
 
R

ralf1731

Senior user
#6
Sep 26, 2008
@AilinonYes, it will. You need ActionJumpTo* for instant jumps.
Click to expand...
ya, thats right, but with "ActionJumpTo" you cant define a distancebetween PC and NPC !?Maybe that would be a solution, if you can change the pos. But is not elegant ;)void main(){ object oPC = GetFirstPC();object oArea = GetArea(OBJECT_SELF);vector vPos=GetPosition(oPC); float vPos = vPosition+(Distance); (i dont know, but i guess, that it doesnt work)float fAngle = 90.0; (or whatever)location locTarget = Location(oArea, vPosition, fAngle);AssignCommand(oPC, JumpToLocation(locTarget));}
 
A

Arkray_gog

Forum veteran
#7
Sep 26, 2008
Ralf1731 said:
@AilinonYes, it will. You need ActionJumpTo* for instant jumps.
Click to expand...
ya, thats right, but with "ActionJumpTo" you cant define a distancebetween PC and NPC !?Maybe that would be a solution, if you can change the pos. But is not elegant ;)void main(){ object oPC = GetFirstPC();object oArea = GetArea(OBJECT_SELF);vector vPos=GetPosition(oPC); float vPos = vPosition+(Distance); (i dont know, but i guess, that it doesnt work)float fAngle = 90.0; (or whatever)location locTarget = Location(oArea, vPosition, fAngle);AssignCommand(oPC, JumpToLocation(locTarget));}
Click to expand...
Ummmmm, you are right too, thank you!!...... but your option, being super valid and such, has a problem and is the distance... depending on how that is done the npc could end clipping inside a house..... not all the waypoints (PC ones) have the same orientation... the distance should have to be very very short .... definitely I must experiment with this.... it is not that easy...Btw, your code moves Geralt not an NPC and the correct version for the position would be:vector vPos=GetPosition(oPC); vector vNewPos = Vector(vPos.x + 1,vPos.y + 1,vPos.z); :wave:
 
R

ralf1731

Senior user
#8
Sep 26, 2008
@arkray not all the waypoints (PC ones) have the same orientation... the distance should have to be very very short .... definitely I must experiment with this.... it is not that easy...
Click to expand...
You are completely right. That was, what i afraided. (i meant that: vector vNewPos = Vector(vPos.x + 1,vPos.y + 1,vPos.z); sorry)By the way, i forgot the npc in my hurry, but i see you know what i meant :)Ok - an other option could be: Set spawnpoints to all entrypoints of the witcher come in area and make a "if then" for the right spawnpoint. Or you set 1 spawn point in the middle of the area and let run the NPC with "doppelspeed
 
A

Arkray_gog

Forum veteran
#9
Sep 26, 2008
The spawn points are the reason of the question, I have several but all are the same and the game choses them randomly.... I should have to set flags when using the indoor doors to be able to select the correct outdoors spawnpoint..... The forcefollow is already un use, the NPC comes running if he is spawned far away... but I want him next to Geralt at every area transition to be rady to travel to next destionation....^___________________^ Don't worry, now I have serveral options, I'll find my way around. I also have a long list of minor things to fix from my testerThanks! :angel:
 
U

username_2075278

Senior user
#10
Sep 27, 2008
arkray said:
The spawn points are the reason of the question, I have several but all are the same and the game choses them randomly.... I should have to set flags when using the indoor doors to be able to select the correct outdoors spawnpoint..... The forcefollow is already un use, the NPC comes running if he is spawned far away... but I want him next to Geralt at every area transition to be rady to travel to next destionation....^___________________^ Don't worry, now I have serveral options, I'll find my way around. I also have a long list of minor things to fix from my testerThanks! :angel:
Click to expand...
The function I use for this sort of thing is usually:
Code:
// move this npc to this station immediately. If they're too far away, jump them there// even if it causes a visual glitchvoid MoveToStation( object npc, object station) {	if ( GetDistanceBetween( npc, station) > 8.0) {		/* disaster - they aren't nearby, we'll have to jump them there */		AssignCommand( npc, JumpToLocation( GetLocation( station)));	} else {		/* more or less there, walk them to station - but immediately! */		AssignCommand( npc, ClearAllActions(TRUE));		AssignCommand( npc, ActionForceMoveToLocation( GetLocation( station)));	}}
However, I'm currently struggling with a situation in which my characters are not showing up on cue, so this doesn't always work.
 
A

Arkray_gog

Forum veteran
#11
Sep 27, 2008
SimonBrooke said:
SimonBrooke said:
The spawn points are the reason of the question, I have several but all are the same and the game choses them randomly.... I should have to set flags when using the indoor doors to be able to select the correct outdoors spawnpoint..... The forcefollow is already un use, the NPC comes running if he is spawned far away... but I want him next to Geralt at every area transition to be rady to travel to next destionation....^___________________^ Don't worry, now I have serveral options, I'll find my way around. I also have a long list of minor things to fix from my testerThanks! :angel:
Click to expand...
The function I use for this sort of thing is usually:
Code:
// move this npc to this station immediately. If they're too far away, jump them there// even if it causes a visual glitchvoid MoveToStation( object npc, object station) {	if ( GetDistanceBetween( npc, station) > 8.0) {		/* disaster - they aren't nearby, we'll have to jump them there */		AssignCommand( npc, JumpToLocation( GetLocation( station)));	} else {		/* more or less there, walk them to station - but immediately! */		AssignCommand( npc, ClearAllActions(TRUE));		AssignCommand( npc, ActionForceMoveToLocation( GetLocation( station)));	}}
However, I'm currently struggling with a situation in which my characters are not showing up on cue, so this doesn't always work.
Click to expand...
Thanks, that is a cool script ^____________^ But I already solved it with story phases, it works super fine changing the phase at the doors. I actually finished the damn thing!!!! Now I'll be able to unisntall and intall the EE version!!!
 
Share:
Facebook Twitter Reddit Pinterest Tumblr WhatsApp Email Link
  • English
    English Polski (Polish) Deutsch (German) Русский (Russian) Français (French) Português brasileiro (Brazilian Portuguese) Italiano (Italian) 日本語 (Japanese) Español (Spanish)

STAY CONNECTED

Facebook Twitter YouTube
CDProjekt RED Mature 17+
  • Contact administration
  • User agreement
  • Privacy policy
  • Cookie policy
  • Press Center
© 2018 CD PROJEKT S.A. ALL RIGHTS RESERVED

The Witcher® is a trademark of CD PROJEKT S. A. The Witcher game © CD PROJEKT S. A. All rights reserved. The Witcher game is based on the prose of Andrzej Sapkowski. All other copyrights and trademarks are the property of their respective owners.

Forum software by XenForo® © 2010-2020 XenForo Ltd.