Diffrence between LOCALS and GLOBAL
#1
Posted 09 June 2004 - 06:05 AM
I just have one small question:
What is the difference between SetGlobal("something","LOCALS",X) and SetGlobal("something","GLOBAL",X)
Does it make any difference what you use?
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner
#2
Posted 09 June 2004 - 06:17 AM
#3
Posted 09 June 2004 - 01:38 PM
I have another question, though...
I want the PC to be able to piss the NPC off, and when that happens I want my NPC to turn hostile and attack. So far no problems, but I also want a couple of other guys to show up and help the NPC. Here's the problem. Where do I put the CreateCreatureObject("***","***",0,0,0), to make this work?
In the .d-file? Or should I put it in a .bcs-file, and in that case, which one? My character's Default-, Override-, Class- or General-script? Or the Area-script?
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner
#4 -Ashara-
Posted 09 June 2004 - 02:00 PM
#5
Posted 09 June 2004 - 02:18 PM
The .d-file looks like this, the PC can choose to attack my NPC (@40) or walk away and just piss him off, to be able to apologize later (@41):
IF ~~ THEN BEGIN Join_15 SAY @39 IF ~~ THEN REPLY @40 DO ~Enemy() SetGlobal("S#KHAattacked","GLOBAL",1) SetGlobal("AttackedThieves","GLOBAL",1) Attack(NearestEnemyOf(Myself))~ EXIT IF ~~ THEN REPLY @41 DO ~SetGlobal("S#KHApissed","GLOBAL",1)~ EXIT END
Then I want to add this in a .bcs-file:
IF Global("S#KHAattacked","GLOBAL",1) THEN RESPONSE #100 CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) END
Should I then put this in the override-script or in the area-script? Does it make any difference? What I mean is that this conversation could only happen in on area anyway. Does it then make any difference?
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner
#6 -Ashara-
Posted 09 June 2004 - 02:39 PM
I am not that big on scripting, but you probably do not need AttackNearestEnemy() because when turned enemy he will use his default fighting scripts, whatever they are.
#7
Posted 09 June 2004 - 02:40 PM
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner
#8
Posted 09 June 2004 - 03:28 PM
The creatures still won't spawn, I tried to put the code in both the area-script and the override script of the NPC.
And the NPC didn't attack when I removed the line AttackNearestEnemy(). Please don't tell me that it's something wrong with his default fighting script (what script is that, btw?). He went hostile, but didn't attack.
I should probably tell you that I have made two different scripts for him (the overridescript and the classcript), while using wtasight.bcs as default script. I've tried to put the code in both of the custom-made scripts, as well as extending the area-script.
If anyone also could tell me what all the different scripts a character can have are for (i.e. override, class, race, general and default), it would perhaps enlighten my head a little bit. (Can you actually express yourself that way? I have to check that with my English-teacher).
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner
#9
Posted 09 June 2004 - 04:46 PM
IF Global("S#KHAattacked","GLOBAL",1) THEN RESPONSE #100 CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) CreateCreatureObject("S#SHTH","S#KHA",0,0,0) ENDIs "S#KHA" a death variable or a resref? It should be a death variable. If that doesn't work, ensure it is in your NPC's override script and use "Myself" as the object:
CreateCreatureObject("S#SHTH",Myself,0,0,0)
#10
Posted 09 June 2004 - 08:39 PM
IF ~~ THEN BEGIN Join_15 SAY @39 IF ~~ THEN REPLY @40 DO ~Enemy() CreateCreatureObject("S#SHTH",Myself,0,0,0) CreateCreatureObject("S#SHTH",Myself,0,0,0) CreateCreatureObject("S#SHTH",Myself,0,0,0) CreateCreatureObject("S#SHTH",Myself,0,0,0) CreateCreatureObject("S#SHTH",Myself,0,0,0) CreateCreatureObject("S#SHTH",Myself,0,0,0) CreateCreatureObject("S#SHTH",Myself,0,0,0) CreateCreatureObject("S#SHTH",Myself,0,0,0) CreateCreatureObject("S#SHTH",Myself,0,0,0) CreateCreatureObject("S#SHTH",Myself,0,0,0) Attack(NearestEnemyOf(Myself))~ EXIT IF ~~ THEN REPLY @41 DO ~SetGlobal("S#KHApissed","GLOBAL",1)~ EXIT END
#11
Posted 10 June 2004 - 01:47 AM
Not that it matters, since the creature I want to spawn have the same deathvariable S#SHTH as its name S#SHTH.cre. But should the first CreateCreatureObject("S#SHTH",Myself,0,0,0) also be a deathvariable?
In that case, it doesn't make any sense, since different *.cre could have the same deathvarible....
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner
#12
Posted 10 June 2004 - 02:12 AM
Now, there must be something wrong with the scripts. First I couldn't get the NPC to attack unless I wrote Attack(NearestEnemyOf(Myself)) in the .d-file. Now the spawned cretures won't attack. Which god damned script makes a creture attack??
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner
#13
Posted 10 June 2004 - 06:46 AM
Just put Attack(NearestEnemyOf(Myself) into a script block and throw it in at the top of the Override script.
#14
Posted 10 June 2004 - 09:47 AM
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner
#15
Posted 10 June 2004 - 04:44 PM
AttackReevaluate causes the creature to attack and reevaluate the situation after the time specified, I believe the time is in 15ths of a second. Reevaluate meaning run through the script to see if any other conditions are true.
#16
Posted 10 June 2004 - 04:51 PM
AttackReevaluate(NearestEnemyOf(Myself),30)should mean 30 seconds, right?
EDIT: I saw that you wrote "believe the time is in 15ths of a second". What does that mean? (I guess it's my failing english again (aargh!), but I'm from Sweden, where we don't know how to speak complicated languages... )
Thanks Rastor (and Idobek and domi and Grim) for all the help, btw!
Edited by SConrad, 10 June 2004 - 04:56 PM.
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner
#17
Posted 10 June 2004 - 06:09 PM
Kinda obvious... And the variable 30 in
AttackReevaluate(NearestEnemyOf(Myself),30)
should mean 30 seconds, right?
It actually means two seconds. What you need to do is to take the number that you put in there and divide it by 15 to get the number of seconds.
#18
Posted 11 June 2004 - 05:33 AM
Ah, now I see. Stupid me...Kinda obvious... And the variable 30 in
AttackReevaluate(NearestEnemyOf(Myself),30)
should mean 30 seconds, right?
It actually means two seconds. What you need to do is to take the number that you put in there and divide it by 15 to get the number of seconds.
Khadion NPC mod - Team leader, head designer
Hubelpot NPC mod - Team leader, coder
NPC Damage - Coder
PC Soundsets - Coder, voice actor
Brythe NPC mod - Designer
DragonLance TC - Glory of Istar - Designer
The NPC Interaction Expansion Project - Writer for Cernd, Sarevok
The Jerry Zinger Show - Producer
Iron Modder 5 - Winner