GetScriptVariable [COLOR="Red"]<Objekt-REF>[/COLOR], <Variablenname> == x
Auf normale Variablen nicht.
Doch.Wie SirTroy schon gesagt hat, kannst du auf normale Variablen nicht zugreifen.
set [ObjektREF].[Variable] to [Wert]
[B];oder[/B]
set [ObjektID].[Variable] to [Wert]
scn Scriptname
ref actor
Begin OnActivate
set actor to getactionref
If actor.GetIsCreature == 1
return
Else
;......
Endif
End
scn name
short triggered
float timer
ref myself
ref target
Begin onActivate
if IsActionRef player == 1
if triggered == 0
message "Dieses Tor wird anderweitig geöffnet."
endif
elseif IsActionRef player == 0
if triggered == 0
playgroup forward 0
set triggered to 1
enableLinkedPathPoints
set timer to 3
elseif triggered == 1
playgroup backward 0
set triggered to 0
disableLinkedPathPoints
endif
endif
end
Begin GameMode
if timer == 3
set timer to timer - GetSecondsPassed
endif
if timer <= 2 && triggered == 1
set target to GetParentRef
set myself to GetSelf
target.activate myself 1
set triggered to 2
endif
end
Begin onReset
reset 3DState
set triggered to 0
end
scn name
short triggered
float timer
ref myself
ref target
Begin onActivate
if IsActionRef player == 1
message "Dieses Tor wird anderweitig geöffnet."
elseif [COLOR="SeaGreen"]triggered == 1[/COLOR]
playgroup forward 0
set timer to 3
[COLOR="SeaGreen"]set triggered to 2[/COLOR]
endif
end
Begin GameMode
[COLOR="SeaGreen"]If triggered == 0
return
Else
if timer >= 0[/COLOR]
set timer to timer - GetSecondsPassed
endif
if timer <= 2 && [COLOR="SeaGreen"]triggered == 2[/COLOR]
set target to GetParentRef
set myself to GetSelf
target.activate myself 1
[COLOR="SeaGreen"]set triggered to 3[/COLOR]
endif
[COLOR="SeaGreen"]Endif[/COLOR]
end
Begin onReset
reset 3DState
set triggered to 0
set open to 0
end
scn name2
Begin OnActivate
If IsActionref player
set [TorREF].triggered to 1
[TorREF].activate
End
Es geht beides. Dabei müsst ihr aber aufpassen, dass ihr das richtige wählt.Code:set [ObjektREF].[Variable] to [Wert] [B];oder[/B] set [ObjektID].[Variable] to [Wert]
Der erste Scriptbefehl ändert hierbei nur die Variable bei der ausgewählten Referenz. Der zweite Scriptbefehl hingegen ändert die Variable bei allen, in der Welt platzierten Objekten, mit dieser ID.
Ihr könnt mit dieser Syntax, also [ObjektREF].[Variable] bzw. [ObjektID].[Variable] auch genauso gut bestimmte Werte abfragen, übertragen, und damit rechnen.
scn name2
ref myself
ref target
Begin onActivate
if IsActionRef player == 1
set target to GetParentRef
set myself to GetSelf
if GetScriptVariable target, open == 0
set target.open to 1
target.activate myself 1
playgroup forward 0
elseif GetScriptVariable target, open == 1
set target.open to 2
target.activate myself 1
playgroup backward 0
elseif GetScriptVariable target, open == 2
set target.open to 1
target.activate myself 1
playgroup forward 0
endif
endif
end
Begin onReset
reset3DState
end
scn name
short open
short triggered
float timer
ref myself
ref target
Begin onActivate
if IsActionRef player == 1
message "Dieses Tor wird anderweitig geöffnet."
elseif open == 1
playgroup forward 0
enableLinkedPathPoints
if triggered == 0
set triggered to 1
set timer to 3
endif
elseif open == 2
playgroup backward 0
disableLinkedPathPoints
endif
end
Begin GameMode
if triggered == 0
return
else
if timer >= 0
set timer to timer - GetSecondsPassed
endif
if timer <= 2 && triggered == 1
set target to GetParentRef
set myself to GetSelf
target.activate myself 1
set triggered to 2
endif
endif
end
Begin onReset
reset3DState
set triggered to 0
set open to 0
disableLinkedPathPoints
end
scn SkriptName
begin GameMode
if player.GetStageEnd
Ref.startconversation, TopicXY
endif
end
name2
Begin onActivate
if IsActionRef player == 1
if GetScriptVariable [Tor-REF], open == 0
set [Tor-REF].open to 1
[Tor-REF].activate 1
playgroup forward 0
elseif GetScriptVariable [Tor-REF], open == 1
set [Tor-REF].open to 2
[Tor-REF].activate 1
playgroup backward 0
elseif GetScriptVariable [Tor-REF], open == 2
set [Tor-REF].open to 1
[Tor-REF].activate 1
playgroup forward 0
endif
endif
end
Begin onReset
reset3DState
end