Jump to content

CK Help ? :3 lol...


blank_v

Recommended Posts

Posted

TL:DR

How to FORCE npc to ABANDON everything and GO TO ObjectReference and ACTIVATE it as Furniture ?...

 

//Edit:

{

Ignore: ( its only preview, im testing everything on QLG_Script_Test )

Scriptname QLG_Script_Bandit_Beggar extends Actor  

}

 

 

Why this forum don't have any Creation Kit Section?...

Lel :D

 

Anywaa... im working on new Mod... im not gonna upload it anywaa... probably... idk :o

its related with Realim Mod i was writing not so long ago...

 

but i have little problem... let me explain what i want to do first...

 

I'm working on Perfect Ai for my Castle.

I'm tired of fking stupid NPC-s that every day do same things over and over again...

and when u kill some important NPC they are gone forever... thats fking stupid...

 

so i want to create Living city where NPCs take actions depending on thier needs and situation

 

they work, live, die

 

They also kill each other for money, they can steal find work etc.

Spoiler

72850_20200529221252_1.png.ad0d8f847f07c2b5c1c6a4d9bcdbdb5e.png

 

And here is problem...

because i already tested Stealing and Killing each other for money and its works fine..

 

 

so i wanted to make legal way to make money...

because Beggars were killing each other every 1/2 days because they need money to eat / drink etc.

 

Job markers:

Spoiler

SA.png.427934a62034cccd9b916428f62fb670.png

 

 

dont say anything about how this script look its still in WIP

im just testing things but thats how look my BETA version of Beggar Works

Scriptname QLG_Script_Bandit_Beggar extends Actor  





	; BORN STARTUP
Event OnInit()
	RegisterForSingleUpdateGameTime( 2.0 )
	
	AskForJob()
EndEvent

	Int Food
	Int Drink
	Int Sleep
	Int Fun
	
	Int WorkEne
	bool Working
	
	ObjectReference Work
	
	
	
	ObjectReference Property JobHolder Auto
	ObjectReference Property EatHolder Auto
	ObjectReference Property FunHolder Auto
	
	ObjectReference Property RefuseReturn Auto
	
	Bool ExpectingInput
		Bool LookingForJob
		Bool LookingForFood


Function AskForJob()
	If( ExpectingInput )
		; CAN'T ASK FOR JOB, ALREADY ASKING ONE CARDINAL FOR STUFF
		; RETURN AND TRY LATER
	Else
		JobHolder.Activate( self )
		ExpectingInput = true
		LookingForJob = true
	EndIf
EndFunction

Event OnHit( ObjectReference QSrc, Form QTool, Projectile A, bool B, bool C, bool D, bool E )
	If( Work )
		Debug.Notification("GOOD OBJECT")
	Else
		Debug.Notification("BAD OBJECT")
	EndIf
EndEvent



Event OnActivate( ObjectReference QRef )
	If( ExpectingInput )
		If( QRef == RefuseReturn )
			Return	; Failed !...
		Else
	;===========================================;
	; Succes in Searching ;=====================;
	;===========================================;
			If( LookingForJob )
				Work = QRef
				Working = true
				WorkEne = 0
				Debug.Notification("Beggar Found new Job!...")
			ElseIf( LookingForFood )
			
			EndIf
		EndIf
	EndIf
EndEvent



Event OnUpdateGameTime()
	If( Working )
		WorkEne -= 1
		If( WorkEne <= 0 )
			WorkEne = 5
			( self as Actor ).PathToReference( Work, 0.5 )
			Work.Activate( self as Actor )
		EndIf
	EndIf

	RegisterForSingleUpdateGameTime( 2.0 )
EndEvent

;The End

 

i was trying everything and:

 

If ACTOR is CLOSE to WORK REFERENCE everything works fine

BUT

if ACTOR is AWAY from WORK REFERNECE he walk to this reference but after idk around 200 / 250 units he stop and he go back to his Spawn Point...

 

 

i was testing it with Loop that... in i think some way FORCE npc to FKING GO TO THAT REFERENCE with Loops:

Scriptname QLG_Script_Test extends Actor  

	ObjectReference Property REF Auto

	

	; Int Distance = self.GetDistance( ObjectReference REF )
	; If( Distance > 10 )

	

Event OnHit( ObjectReference QSrc, Form QTool, Projectile A, bool B, bool C, bool D, bool E )
	Int Distance = ( self as Actor ).GetDistance(  REF ) as Int
	While( Distance > 10 )
		Distance = ( self as Actor ).GetDistance(  REF ) as Int
		( self as Actor ).PathToReference( REF, 0.5 )
		Utility.Wait( 1.0 )
		
	EndWhile
	
	( self as Actor ).PathToReference( REF, 0.5 )
    REF.Activate( self as Actor )
	
	; REF.activate( self )
EndEvent
;The End

 

But they are still ignoring script and after around 250 units walk they go back instead of going to Work furniture

 

 

Dont tell me to switch to AiPackages

first version was using AiPackages but if in City u have over 15 NPCs You got 1/2 sec Freeze every 10 seconds ( Package Updates )

so Packages are not key...

 

Scripts are fine because i can use my other thing to optimize it...

 

 

 

But those fking Npcs ignore PathToReference Function...

 

 

 

 

//Edit2:

You can also say that im addicted to Arena because thats my another Arena System :D

Scriptname QLG_MasterScript_Arena extends ObjectReference  
{ Ohh a DA arena :o }
;===- Base Info. -===;
 ;Created: 2020-05-20
 ;Update: 2020-05-29
 ;Author: TobiPL
 ;Unit: M.PC<2>
;===- Var. setup -==================================================;

	ActorBase Property Fighter Auto
	
	ObjectReference Property XSpawnerR1 Auto
	ObjectReference Property XSpawnerR2 Auto
	
	ObjectReference Property BattlePoint1 Auto
	ObjectReference Property BattlePoint2 Auto
	
	Actor Fighter1
	Actor Fighter2
	
Event OnInit()
	
	SpawnWave()
	
EndEvent

Function SpawnWave()
	
	Fighter1 = XSpawnerR1.PlaceAtMe( Fighter, 1 ) as Actor
	Fighter2 = XSpawnerR2.PlaceAtMe( Fighter, 1 ) as Actor
	
	Fighter1.MoveTo( BattlePoint1 )
	Fighter2.MoveTo( BattlePoint2 )
	
	Utility.Wait( 15.0 )
	
	Fighter1.StartCombat(Fighter2)
	Fighter2.StartCombat(Fighter1)
	
EndFunction

Event OnActivate( ObjectReference QRef )

	Fighter1.disable( true )
	Fighter1.delete()
	Fighter2.disable( true )
	Fighter2.delete()
		
	; SpawnWave()
EndEvent
;The End

 

for now i was testing with spawning NPC and starting Fight between them and it works fine ^_^

so if somehow i make JOBs work then i can continue work on Arena :D

 

Beggars in really bad situation can join on Arena to fight for money ^_^

+ Player can come to Arena and watch fights and also Bid on fights :D

+ You can also fight on arena for money...

 

Im planning:

Arena start every Day and You can fight between 17:30 and 21:30

But You have to be at least on 20:00 to register for fight, or You can fight next day :D

 

You can as i said watch and bid other NPCs fights :)...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...