Jump to content

MultiplayerDoneEasy!


Mooper 99

Recommended Posts

I'm sure many of you are familiar with OBSE scripting, well I got this mod called Master of Puppets. It allows you to control NPCs. Well It inspired an idea to make Multiplayer simple.It will be Local, meaning you and your buddy will use the same computer. It will be one screen. Just Bind buttons to make an NPC move around! But just make it so the Player does not dissapear (In Master of Puppets, Your player dissapears when you control the NPC). I attempted to do this myself, but I am not a good enough scripter. I believe this is simple to do. I think you need the "IsKeyPressed" function, which requires OBSE. Please this is not hard, just make an NPC move with Arrows, and turn with PageUp and PageDown! Easy! Here is the script he used just in case you want to examine/copy it:

 

scn PMControlQuestSCRIPT
ref me							; the controlled creature
float xfactme					; position in X
float yfactme					; position in Y
float zfactme					; position in Z
float xfact						; position in X
float yfact						; position in Y
float zfact						; position in Z
float height						; position in Z added depending on Xangle
float speedmod				; how far the player is placed from the creature
float direc						; angle in Z
float angle						; used to set the angle of the fof to the players
float Xangle						; angle player is looking - upp and + down
short attackactivated			; is the creature attacking 1
short transformback			; used to transfor back to normal 1
Short attackingcreature		; is 1 if the creature can attack need to be 1 for attacks
short started					; has the quest started
float fQuestDelayTime
float movemod
float distance
float distanceZ
float distance5
float distanceZ5
float distance6
float distanceZ6
float distance7
float distanceZ7
float health
short runtoggle
ref source
float MORPHcrime
short moving
float dist2
float dist
ref source1
ref source2
short activatecounter

Begin Gamemode
; when quest starts
if started == 0
	player.addspell PMControlSpell
	set distance to -2
	set distance5 to -2
	set distance6 to -2
	set distance7 to -2
	set started to 1
	set fQuestDelayTime to 0.001
	StopQuest PMControllQuest
endif
if transformback == 1 && me != 0
	player.SetActorAlpha 0.0
	player.setghost 1
	player.UnequipItem torch02
	DisablePlayerControls
	player.addspell PMcontrolAB
	set fQuestDelayTime to 0.001
	set transformback to 2
	me.SetUnconscious 1
elseif transformback == 2
	set fQuestDelayTime to 0.001
		if moving >= 1 && moving <= 9
			set moving to moving + 1
			me.RemoveScriptPackage
			me.AddScriptPackage PMControldummyPac
		elseif moving == 10
			set moving to 0
			me.RemoveScriptPackage
		endif	
		if player.Getdistance me > 1500
			set moving to 1
			me.moveto player
		endif
		if activatecounter >= 1 && activatecounter < 10
			set activatecounter to activatecounter + 1
		elseif activatecounter == 10
			set activatecounter to 0
		endif
		if iskeyPressed 32 == 1 && activatecounter == 0
			set dist2 to 70 ; changing distance from player
			set source1 to me.PlaceAtMe PMControlActivator, 1, dist2, 0
			set dist to player.GetAngle X
			set zfact to me.GetPos z
			set zfact to zfact + 100
			source1.SetPos z, zfact
			set zfact to zfact - dist
				if dist < 0
					set dist to 0 - dist
				endif
			set dist to 89 + dist2 - dist
			set source2 to me.PlaceAtMe PMControlActivator, 1, dist, 0
			source2.SetPos z, zfact
			source1.Cast PMControlActivateSpell source2
			source1.disable
			source2.disable
			set activatecounter to 1
		endif
	set Xangle to player.GetAngle X
	set xfactme to me.GetPos x
	set yfactme to me.GetPos y
	set zfactme to me.GetPos z
	set direc to me.GetAngle z
	set angle to player.getangle z
		if health > me.GetAV health
			triggerHitShader 2
		endif
	set health to me.GetAV health
		if IsKeyPressed 13 == 1 ; enter
			set transformback to 3
		endif
	; distance from player to morph---------------------------------
		if IsKeyPressed 49 == 1 ;1 key
			set distance to distance + 0.05
		elseif IsKeyPressed 50 == 1 ;2 key
			set distance to distance - 0.05
		elseif IsKeyPressed 51 == 1 ;3 key
			set distanceZ to distanceZ + 1
		elseif IsKeyPressed 52 == 1 ;4 key
			set distanceZ to distanceZ - 1
		endif
		if distance > 3
			set distance to 3
		elseif distance < -5
			set distance to -5
		endif
		if distanceZ > 300
			set distanceZ to 300
		elseif distanceZ < -200
			set distanceZ to -200
		endif
	;save settings for position 5 6 7 on 8 9 0 and return on backspace---------------------
		if IsKeyPressed 56 == 1 ;8 key
			set distance5 to distance
			set distanceZ5 to distanceZ
		endif
		if IsKeyPressed 57 == 1 ;9 key
			set distance6 to distance
			set distanceZ6 to distanceZ
		endif
		if IsKeyPressed 48 == 1 ;0 key
			set distance7 to distance
			set distanceZ7 to distanceZ
		endif
		if IsKeyPressed 53 == 1 ;5 key
			set distance to distance5
			set distanceZ to distanceZ5
		endif
		if IsKeyPressed 54 == 1 ;6 key
			set distance to distance6
			set distanceZ to distanceZ6
		endif
		if IsKeyPressed 55 == 1 ;7 key
			set distance to distance7
			set distanceZ to distanceZ7
		endif
		if IsKeyPressed 8 == 1 ;backspace
			set distance to -2
			set distanceZ to 0
		endif
;movement animation control for the CREATURE-------------------------------------------
			; standard run or walk
				if IsKeyPressed 20 == 1 ; caps lock
					set runtoggle to 1
				elseif IsKeyPressed 9 == 1 ; tab
					set runtoggle to 0
				endif
				if IsKeyPressed 65 == 1 ;A key
					me.PlayGroup turnleft, 1
					set angle to angle - 6
				elseif IsKeyPressed 68 == 1 ;D key
					me.PlayGroup turnright, 1
					set angle to angle + 6				
				elseif IsKeyPressed 87 == 1 && IsKeyPressed 16 == 1 ;W and shift
						if runtoggle == 0
							me.PlayGroup fastforward, 1
						else
							me.PlayGroup forward, 1
						endif
				elseif IsKeyPressed 87 ;W only
						if runtoggle == 0
							me.PlayGroup forward, 1	
						else
							me.PlayGroup fastforward, 1
						endif
				elseif IsKeyPressed 83 == 1 ; S key
					me.PlayGroup backward, 1
				else
						if me.IsAnimPlaying == 1
							me.PlayGroup idle, 1
						else
							me.pickidle
						endif
				endif
				if direc < 0
					set angle to 360 - angle
				elseif direc > 360
					set angle to angle - 360
				endif
	set zfact to distanceZ
	set speedmod to distance
		if direc < 90				;Direction 0-89
			set yfact to ( 90 - direc ) * speedmod
			set xfact to ( direc - 0 ) * speedmod
		elseif direc < 180		;Direction 90-179
			set direc to direc - 90
			set yfact to ( 0 - direc ) * speedmod
			set xfact to ( 90 - direc ) * speedmod
		elseif direc < 270		;Direction 180-269
			set direc to direc - 180
			set yfact to ( direc - 90 ) * speedmod
			set xfact to ( 0 - direc ) * speedmod
		else						;Direction 270-360
			set direc to direc - 270
			set yfact to ( direc - 0 ) * speedmod
			set xfact to ( direc - 90 ) * speedmod
		endif
	set xfactme to xfactme + xfact
	set yfactme to yfactme + yfact
	set zfactme to zfactme + zfact
	player.SetPos y, yfactme
	player.SetPos x, xfactme
	player.SetPos z, zfactme
	set angle to player.getangle z
	me.setangle z angle
	set angle to player.getangle x
	me.setangle x angle 
	player.SetScale 1.0
		if me.getdead == 1
			set transformback to 3
		endif
elseif transformback == 3
	me.PlayGroup idle, 1
	player.SetScale 1.0
	player.setghost 0
	EnablePlayerControls
	player.SetActorAlpha 1.0
	set transformback to 4
elseif transformback == 4
	player.removespell PMcontrolAB
	set fQuestDelayTime to 1
	player.PlayMagicShaderVisuals effectSummonMythicDawn 1
	set transformback to 5
	me.SetUnconscious 0
elseif transformback == 5
	set fQuestDelayTime to 0.001
	set MORPHcrime to 0
	set me to 0
	StopQuest PMControllQuest
	set transformback to 0
	me.pickidle
endif
end

Edited by Mooper 99
Link to comment
Share on other sites

Doesnt seem like it should be that hard to me either, sinc eyou already have a script that allowes you to control npcs. I'm afraid this may be a little beyond what I'm able to do at the moment, but glancing over it I noticed some things I am curious about.

 

What happens if the parts of the script that disable the controls for the PC are removed and the rest left intact? That seems like the easiest way, without delving too deep into the inner working of the script, to accomplish this.

Link to comment
Share on other sites

Doesnt seem like it should be that hard to me either, sinc eyou already have a script that allowes you to control npcs. I'm afraid this may be a little beyond what I'm able to do at the moment, but glancing over it I noticed some things I am curious about.

 

What happens if the parts of the script that disable the controls for the PC are removed and the rest left intact? That seems like the easiest way, without delving too deep into the inner working of the script, to accomplish this.

 

Yeah, I typed the setghost 0, enable playercontrols, and the alpha thing to 1. I can move but i kept getting snapped back behind the npc I was controlling. I think it has to do with the get distx/y/z. Bump

Link to comment
Share on other sites

  • Recently Browsing   0 members

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