Recommended Posts

Greetings, fellow Jedi. May the Force be with you. :cheers:

In k_inc_utility there's a UserDefined events called HOSTILE_RETREAT which I was told it refers to UT_ReturnToBase that also belongs to the aforementioned script.

I'm in an attempt on reconstructing one, that is part of k_punk_restrig and wanted to ask if this script seems legit or does the opposite -

  • [Oops, the script has been removed as the wrong one was posted and the right one has been lost in eternity.]

Details are commented on the script

My concern is; the nwnnsscomp does compile the script, but to see if it's working or not is kind of hard to produce [and I haven't actually seeing it]. The relevant roaming Rakata which is unk42_rakbreed01 rarely moves towards the exit of trigger's geometry. So I'm down to a guessing game and that is not convincing.

Many thanks for considering this.

 

____________________________________________

 

Update: oof, after countless of trial-and-errors and insightful thoughts from @DarthParametric on #mod_development at Discord, I finally able to come to a resolve.

First of all, scrap the above script - my modification to UT_ReturnToBase was all garbage, and is nowhere near working, lol!

The idea on having oExiting replacing the role of OBJECT_SELF was all wrong. In short, it should have fired by the creature's OUD itself. Therefore, in the end I'm using this with the k_punk_restrig -

Spoiler

//:://////////////////////////////////////////////////////////////
//:: k_punk_restrig
//:://////////////////////////////////////////////////////////////
/*
	Fired by unk42_restrig.utt in unk_m42aa [Unknown World - Elder Settlement]

	This script fires with the trigger UTT's *ScriptOnExit*. It
	checks and wouldn't allow the tagged creatures if they're
	about to exit the geometry by moving them back to a designated
	waypoint.
*/
//:://////////////////////////////////////////////////////////////
//:: Constructed By: DarthParametric
//:: Constructed On: December 03, 2019
//:: Modified By: ebmar
//:: Modified On: December 09, 2019
//:://////////////////////////////////////////////////////////////

void main()
{
	// Declared functions
	object oExiting = GetExitingObject();
	
	// UserDefined events
	int HOSTILE_RETREAT = 1100;

	// Checks if the tagged creatures are exiting the triggers
	if(GetTag(oExiting) == "unk42_rakbreed01" || GetTag(oExiting) == "unk42_rakbreed02" || GetTag(oExiting) == "unk42_rakbreed03")
	{
		// Cause the creatures to call its defined EUD
		SignalEvent(oExiting, EventUserDefined(HOSTILE_RETREAT));
	}
}

 

and having each creatures their own customized ScriptUserDefine to have something like this -

Spoiler

//:: eb_unk42_rschdef [formerly k_def_userdef01]
/*
    Default User Defined Events Script
    for Elder Researchers
*/
//:: Created By: Preston Watamaniuk
//:: Modified By: ebmar
//:: Modified On: December 09, 2019
//:: Copyright (c) 2002 Bioware Corp.

void main()
{
    int nUser = GetUserDefinedEventNumber();
	
	// UserDefined events
	int HOSTILE_RETREAT = 1100;

    if(nUser == 1001) //HEARTBEAT
    {

    }
    else if(nUser == 1002) // PERCEIVE
    {

    }
    else if(nUser == 1003) // END OF COMBAT
    {

    }
    else if(nUser == 1004) // ON DIALOGUE
    {

    }
    else if(nUser == 1005) // ATTACKED
    {

    }
    else if(nUser == 1006) // DAMAGED
    {

    }
    else if(nUser == 1007) // DEATH
    {

    }
    else if(nUser == 1008) // DISTURBED
    {

    }
    else if(nUser == 1009) // BLOCKED
    {

    }
    else if(nUser == 1010) // SPELL CAST AT
    {

    }
    else if(nUser == 1011) //DIALOGUE END
    {
    
    }
    else if(nUser == HOSTILE_RETREAT)
    {
	///////////////////////////////////////////////////////////////////////////////
	/*
		Return To Base [formerly UT_ReturnToBase]
		
		This function is used in the user defined event of a creature crossing a
		trigger used to pen in hostile creatures. When a creature crosses the
		trigger, it's actions are cleared, it is sent to the homebase waypoint and
		it is set non commandable. Once reaching its destination, it becomes
		commandable again. By defaut the standard tag for the waypoint is given, but
		a different one may be specified.

		Created by Aidan Scanlan // Modified by ebmar
		On Dec 2, 2002 // Modified on December 08, 2019
	*/
	///////////////////////////////////////////////////////////////////////////////
		
		// Waypoints
		object oHomebase = GetNearestObjectByTag("wp_homebase");
		
		if(GetCommandable())
		{
			ClearAllActions();
			CancelCombat(OBJECT_SELF);
			/* ActionMoveToObject(oHomebase, TRUE, 3.0f);
			RUN has been changed to WALK therefore it was commented */
			ActionMoveToObject(oHomebase);
			ActionDoCommand(SetCommandable(TRUE));
			SetCommandable(FALSE);
		}
    }
}

 

By then, the script worked as intended. Eureka! :cheers:

Edited by ebmar
Removing the initial failed-attempt script as it's wrong, and the right one had been lost in eternity

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.