Jump to content

scripting problem need some help bad


jbear95

Recommended Posts

Alright have a small scripting/ai package problem I need my npc to sit when a battle is going on in front of him no matter what so I wanted to use set restrained on the sit package but how do I do that and how do I write the script

 

if some one could write the script out because I do not know if I need to put the npc's id on or not that would be great if not I understand but please help

Link to comment
Share on other sites

Alright have a small scripting/ai package problem I need my npc to sit when a battle is going on in front of him no matter what so I wanted to use set restrained on the sit package but how do I do that and how do I write the script

 

if some one could write the script out because I do not know if I need to put the npc's id on or not that would be great if not I understand but please help

 

So, what your wanting is for the npc to just stand still when a battle is going on?

 

Ok just hold on and I'll try and sort your problem

Edited by TrickSh0t
Link to comment
Share on other sites

Alright have a small scripting/ai package problem I need my npc to sit when a battle is going on in front of him no matter what so I wanted to use set restrained on the sit package but how do I do that and how do I write the script

 

if some one could write the script out because I do not know if I need to put the npc's id on or not that would be great if not I understand but please help

 

So, what your wanting is for the npc to just stand still when a battle is going on?

 

Ok just hold on and I'll try and sort your problem

 

Hey I can't help you if you don't tell me. Are you wanting the NPC just to stand still when a fight is going on

Link to comment
Share on other sites

Ok here's a quick tutorial.

 

Place your NPC, open him up and give him a reference ID (JasonREF). Go to his packages. Create a new package and make it a sandbox package. In the wander location, if your NPC is in an interior, tick In Cell and find the cell. If the NPC is outside, make the wander location 'Near Current Location'. Now that's sorted, we move onto the script.

 

Click on the pencil button on your toolbar. A small window should appear. Click File/New.

 

Use this script (Edit where I say)

 

scn YourScriptName

Begin GameMode
if (Player GetInSameCell YourNPCREF == 1)
if (Player IsInCombat == 1)
	YourNPCREF.SetActorsAI 0
elseif (Player GetInSameCell YourNPCREF == 0)
       elseif (Player IsInCombat == 0)
	YourNPCREF.SetActorsAI 1
endif
       endif
endif
end

 

I've tested this and it has worked for me. Tell me if there's any problems

Edited by TrickSh0t
Link to comment
Share on other sites

Ok here's a quick tutorial.

 

Place your NPC, open him up and give him a reference ID (JasonREF). Go to his packages. Create a new package and make it a sandbox package. In the wander location, if your NPC is in an interior, tick In Cell and find the cell. If the NPC is outside, make the wander location 'Near Current Location'. Now that's sorted, we move onto the script.

 

Click on the pencil button on your toolbar. A small window should appear. Click File/New.

 

Use this script (Edit where I say)

 

scn YourScriptName

Begin GameMode
if (Player GetInSameCell YourNPCREF == 1)
if (Player IsInCombat == 1)
	YourNPCREF.SetActorsAI 0
elseif (Player GetInSameCell YourNPCREF == 0)
       elseif (Player IsInCombat == 0)
	YourNPCREF.SetActorsAI 1
endif
       endif
endif
end

 

I've tested this and it has worked for me. Tell me if there's any problems

 

 

Actually it would be

scn YourScriptName

Begin GameMode
       if (Player GetInSameCell YourNPCREF == 1) && (Player IsInCombat == 1)
               YourNPCREF.SetActorsAI 0
               elseif
               (Player GetInSameCell YourNPCREF == 1) && (Player IsInCombat == 0)
               YourNPCREF.SetActorsAI 1
       endif
end

Link to comment
Share on other sites

Ok here's a quick tutorial.

 

Place your NPC, open him up and give him a reference ID (JasonREF). Go to his packages. Create a new package and make it a sandbox package. In the wander location, if your NPC is in an interior, tick In Cell and find the cell. If the NPC is outside, make the wander location 'Near Current Location'. Now that's sorted, we move onto the script.

 

Click on the pencil button on your toolbar. A small window should appear. Click File/New.

 

Use this script (Edit where I say)

 

scn YourScriptName

Begin GameMode
if (Player GetInSameCell YourNPCREF == 1)
if (Player IsInCombat == 1)
	YourNPCREF.SetActorsAI 0
elseif (Player GetInSameCell YourNPCREF == 0)
       elseif (Player IsInCombat == 0)
	YourNPCREF.SetActorsAI 1
endif
       endif
endif
end

 

I've tested this and it has worked for me. Tell me if there's any problems

 

 

Actually it would be

scn YourScriptName

Begin GameMode
       if (Player GetInSameCell YourNPCREF == 1) && (Player IsInCombat == 1)
               YourNPCREF.SetActorsAI 0
               elseif
               (Player GetInSameCell YourNPCREF == 1) && (Player IsInCombat == 0)
               YourNPCREF.SetActorsAI 1
       endif
end

 

Always nest conditions instead of using the && operator, because the scripting engine will make all comparisons in the IF statement even if one evaluates to false. The syntax is incorrect in both of your scripts, and explicit references to the NPC are not necessary in an object script on that NPC.

 

scn ScriptName

begin gamemode

if(getinsamecell player)
	if(player.isincombat)
		setactorsai 0
	else
		setactorsai 1
	endif
else
	setactorsai 1
endif

end ; gamemode

 

This causes the NPC to shut down its AI when the player is in combat. Is that the intended effect, jbear95?

Link to comment
Share on other sites

Ok here's a quick tutorial.

 

Place your NPC, open him up and give him a reference ID (JasonREF). Go to his packages. Create a new package and make it a sandbox package. In the wander location, if your NPC is in an interior, tick In Cell and find the cell. If the NPC is outside, make the wander location 'Near Current Location'. Now that's sorted, we move onto the script.

 

Click on the pencil button on your toolbar. A small window should appear. Click File/New.

 

Use this script (Edit where I say)

 

scn YourScriptName

Begin GameMode
if (Player GetInSameCell YourNPCREF == 1)
if (Player IsInCombat == 1)
	YourNPCREF.SetActorsAI 0
elseif (Player GetInSameCell YourNPCREF == 0)
       elseif (Player IsInCombat == 0)
	YourNPCREF.SetActorsAI 1
endif
       endif
endif
end

 

I've tested this and it has worked for me. Tell me if there's any problems

 

 

Actually it would be

scn YourScriptName

Begin GameMode
       if (Player GetInSameCell YourNPCREF == 1) && (Player IsInCombat == 1)
               YourNPCREF.SetActorsAI 0
               elseif
               (Player GetInSameCell YourNPCREF == 1) && (Player IsInCombat == 0)
               YourNPCREF.SetActorsAI 1
       endif
end

 

Always nest conditions instead of using the && operator, because the scripting engine will make all comparisons in the IF statement even if one evaluates to false. The syntax is incorrect in both of your scripts, and explicit references to the NPC are not necessary in an object script on that NPC.

 

scn ScriptName

begin gamemode

if(getinsamecell player)
	if(player.isincombat)
		setactorsai 0
	else
		setactorsai 1
	endif
else
	setactorsai 1
endif

end ; gamemode

 

This causes the NPC to shut down its AI when the player is in combat. Is that the intended effect, jbear95?

 

 

Well, you made me look like an idiot but hey, people learn from their mistakes

Link to comment
Share on other sites

  • Recently Browsing   0 members

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