 |
|
It is currently Fri May 24, 2013 1:15 am
|
View unanswered posts | View active topics
FGR's Coding & Other Needs (Currently no issues)
| Author |
Message |
|
FastGamerr
UNATCO
Joined: Sat Jul 10, 2010 10:06 am Posts: 141 Location: Finland
|
 FGR's Coding & Other Needs (Currently no issues)
Alright, so I decided to learn to read and post this thread on the correct forum. I'll use this thread as a general depot for my Deus Ex Nihilum coding needs. *sigh* It appears this is the beginning of a long long thread...
_________________ If you want to give me some pizza money:
 DX Nihilum T O D O A TC T O D A Y
Last edited by FastGamerr on Sun Sep 30, 2012 8:25 am, edited 22 times in total.
|
| Thu Oct 20, 2011 6:47 am |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: FGR's Coding Needs (Latest Request: Oct 20th)
You could make a trigger?
It wouldn't be too hard to make a trigger that upon touch, checks it's been touched by a player, and then checks player.inhand.isA('YOURTHING') or player.carrieddecoration.isA('YOURTHING') (depending on what your thing is) and if so, maybe..sets a flag?
Or simply activates the device?
Or even have the device, when frobbed, call the trigger above, and then propagate stuff onward if the player is carrying the right stuff.
|
| Thu Oct 20, 2011 7:51 am |
|
 |
|
FastGamerr
UNATCO
Joined: Sat Jul 10, 2010 10:06 am Posts: 141 Location: Finland
|
 Re: FGR's Coding Needs (Latest Request: Oct 20th)
 |  |  |  | Quote: Here's the first one!
So I have this new decoration (X) that you can throw around as usual. However, there's a part in the mod where you need to have the decoration X active (as in, you've just picked it up) and when you approach another thing (Y) (whether it's a button, a different decoration or a ScriptedPawn, I sure hope this part won't matter that much with this code) with the decoration X in your hands and activate thing Y, decoration X would be destroyed along with thing Y, but in thing Y's exact position thing Z would be created immediately as well as a conversation would be triggered.
X, Y and Z would be different actors. I've sort of researched this myself and I guess by messing around with the "hologram projections appear in the level" instances (such as Ocean Lab UC), I could figure out most of the code, but part that I haven't been able to deduce has been the "activating something (thing Y) with the player currently carrying decoration X" one. I was thinking of making the decoration a pickup like the fire extinguisher or something but those items cannot be deactivated and they get destroyed after one use which I don't want to happen to this one.
Any clues? It's always annoying to try to remember if something like this was done in DX itself and after so many playthroughs, still blacking out :\ |  |  |  |  |
Thanks, I got the trigger working to the "decoration Y reacts to being activated with Thing X active in the player's hands" part. However, I can't see if my results have brought any progress because UCC gets stuck at "Error: Call to 'SetBool':" part. So what is the correct way to make the code change flags? I've tried both "player.flagBase.SetBool(flagName, flagValue,, flagExpiration);" as in the FlagTrigger as well as the usual MissionScript "flags.SetBool('MS_DestroySub', True,, 15);" stuff. Any clues?
_________________ If you want to give me some pizza money:
 DX Nihilum T O D O A TC T O D A Y
Last edited by FastGamerr on Sat Mar 03, 2012 4:18 pm, edited 1 time in total.
|
| Thu Oct 20, 2011 6:03 pm |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: FGR's Coding Needs (Latest Request: Oct 20th)
Probably it's griping about a variable you haven't declared properly or something. Unrealscript can be so fussy sometimes... Post the code, I'll have a look. 
|
| Fri Oct 21, 2011 10:56 am |
|
 |
|
FastGamerr
UNATCO
Joined: Sat Jul 10, 2010 10:06 am Posts: 141 Location: Finland
|
 Re: FGR's Coding Needs (Latest Request: Oct 20th)
Yeah, that confused me even though MissionScripts don't seem to define it that properly either, even though I left out all the !flags(GETBOOL) stuff. I had something like that on at some point and it still didn't work... But anyhow, here's the trigger, to fix the issue once and for all!
_________________ If you want to give me some pizza money:
 DX Nihilum T O D O A TC T O D A Y
|
| Fri Oct 21, 2011 12:13 pm |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: FGR's Coding Needs (Latest Request: Oct 20th)
Ah, just change TorsoReunited to 'TorsoReunited', in both your setbool functions. It's a name, so needs to be between ' characters. Names are 'like_this' : always between ' characters and can't contain spaces. Strings are "like this" : between " characters and can contain spaces. It's a weird unreal thing: names are special, and get entered into a nametable (for ease of lookup, presumably). There are thus things you can only do with names, not strings. Strings are just standard text. This is why if you look at missionscript.uc you see the hoops they have to jump through to generate a unique name for the missionstarted flag: compiling a string and then using the rather hacky stringtoname function in deusexplayer. Anyway, alternatively, you could define a variable at the top (var() name flagname) and indeed one for the deco (var() class<decoration> carrieddeco) and then you'd have a trigger you could use for other purposes, rather than one hardcoded for a single task. Now you can add that to your map and put torsoreunited, class'alistairtorso' and 70 into the new variable boxes. 
|
| Fri Oct 21, 2011 12:47 pm |
|
 |
|
FastGamerr
UNATCO
Joined: Sat Jul 10, 2010 10:06 am Posts: 141 Location: Finland
|
 Re: FGR's Coding Needs (Latest Request: Oct 20th)
>.< Oh man, just a few apostrophes! Urgh! Thanks! I think I spent like 4 hours trying to figure that one out >_>  Thanks a lot, let's see when I'll have some new problems again :]
_________________ If you want to give me some pizza money:
 DX Nihilum T O D O A TC T O D A Y
|
| Fri Oct 21, 2011 1:58 pm |
|
 |
|
FastGamerr
UNATCO
Joined: Sat Jul 10, 2010 10:06 am Posts: 141 Location: Finland
|
 Re: FGR's Coding Needs (Open requests: March 6th 2012)
Hello again! Here's a new problem! Okay, so my UnrealScript skills are just not adequate enough and I get lost in reading the DX .uc files >_> What I want to do is this: after a certain flag has been flagged 'True', a character named Yakedo would teleport to the spawnpoint named 'Yakeport'. Now, it took me a while to get the actual code to compile properly and now that it actually does compile without any warnings... well, it just doesn't work! Here's the code Any suggestions, fellas?
_________________ If you want to give me some pizza money:
 DX Nihilum T O D O A TC T O D A Y
|
| Tue Mar 06, 2012 5:32 pm |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: FGR's Coding Needs (Open requests: March 6th 2012)
GetSpawnPoint is a shitty function that never really worked terribly well. It might work here, though, but the main problem I'm seeing is that you haven't put your mapname in caps.
Yes, seriously. God knows why, but they coded it up to require a CAPS mapname.
60_HongKong_Streets won't work.
60_HONGKONG_STREETS should work.
|
| Tue Mar 06, 2012 10:35 pm |
|
 |
|
FastGamerr
UNATCO
Joined: Sat Jul 10, 2010 10:06 am Posts: 141 Location: Finland
|
 Re: FGR's Coding Needs (Open requests: March 6th 2012)
Hot damn. It did work! However, he also keeps on being teleported into the same location over and over again. Any clues?
_________________ If you want to give me some pizza money:
 DX Nihilum T O D O A TC T O D A Y
|
| Tue Mar 06, 2012 10:43 pm |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: FGR's Coding Needs (Open requests: March 6th 2012)
Yeah, you need to add a flag that tells the MS it's successfully done it. So
|
| Tue Mar 06, 2012 11:14 pm |
|
 |
|
FastGamerr
UNATCO
Joined: Sat Jul 10, 2010 10:06 am Posts: 141 Location: Finland
|
 Re: FGR's Coding Needs (Open requests: March 6th 2012)
... Bah! So easy! I think I need to figure out some kind of a cheap tactic with UnrealScript, with JK I pretty much ran everything through "if thing X is in frame Y, do stuff".
Thanks a million! :]
_________________ If you want to give me some pizza money:
 DX Nihilum T O D O A TC T O D A Y
|
| Wed Mar 07, 2012 7:41 am |
|
 |
|
FastGamerr
UNATCO
Joined: Sat Jul 10, 2010 10:06 am Posts: 141 Location: Finland
|
 Re: FGR's Coding Needs (Currently no open requests)
*sigh* It appears this is the beginning of a long long thread... Okay, so this time there's an Infolink which triggers an event named 'Launch'. The dispatcher has 3 OutEvents, the first one activates several 'ParticleGenerators', the second one's a DamageTrigger and the third one's a DataLinkTrigger. So the first one runs properly but the DamageTrigger doesn't start, well, damaging. Of course, I'm not sure if the trigger's even supposed to be toggled like TriggerLight for instance, but the thing is that the third DataLinkTrigger won't be triggered either. Even if I take the DamageTrigger out. I did some additional experimenting and came up with this code So I replaced the separate DamageTrigger with a FlagTrigger and expected the timer to work properly. This time I even got the level name right! >_> But of course, the FlagTrigger worked properly but the damage didn't start (the DamageTrigger has a 4000 radius) and the final DataLinkTrigger doesn't get triggered at any point. Maybe 'bInitiallyActive' isn't the key here but I'm all out of ideas! Seems like I've already spent over 2 hours on this stuff... but eh. Hope you can help soon! 
_________________ If you want to give me some pizza money:
 DX Nihilum T O D O A TC T O D A Y
|
| Wed Mar 07, 2012 7:57 pm |
|
 |
|
DDL
Traditional Evil Scientist
Joined: Mon Oct 17, 2005 10:03 am Posts: 3641
|
 Re: FGR's Coding Needs (Open request: March 7th 2012)
Damagetriggers are iffy: they do a lot of stuff on touch(), called when someone enters their radius, this stops them wastefully trying to damage things when nothing is within damage range. Of course if you make them active when someone's ALREADY within their radius, this doesn't necessarily get called, and thus weirdness ensues. They also only damage one thing, so if two pawns walk into radius of a damage trigger, it will only hurt the last one to touch() it. Secondly, your missionscript doesn't actually go looking for the damagetrigger at any point, which will present problems. Thirdly, I'm not entirely sure whether it's safe to call a datalink from within a datalink, even if via a dispatcher. Fourthly, triggering a flagtrigger from within a conversation is a little obtuse when you can simply set the flag in the convo itself. Unless we're talking a substantial delay between infolink and 'start of damage'? So. Short of posting up a revised damage trigger (I'm not sure if I included one in the sheep's moretriggers thread, have a look?), let's do it all via missionscript since you're doing that already.  |  |  |  | Code: // HKMission61Script. //============================================= class HKMission61Script expands MissionScript;
function InitStateMachine() { super.InitStateMachine(); FirstFrame();
}
//as far as I'm aware, this bit here ^^ //is simply so you can test missionscripts using the "play level" option in UED //thus it's not technically necessary, albeit very helpful
function firstframe() { local DamageTrigger D;
if (localURL == "61_HONGKONG_FACTORY") { //make sure the damagetrigger is definitely not active, since we're //now using it merely as a placeholder
foreach Allactors(Class'DamageTrigger', D, 'GettingHurt') D.bIsOn=false; } }
function Timer() { local DamageTrigger D; local float dist; local Actor A; //changed to actor to make it affect everything (decos etc): if unnecessary, change back to scriptedpawn
Super.Timer();
if (localURL == "61_HONGKONG_FACTORY") { if (flags.GetBool('YoonDamageStarts') && !flags.GetBool('YoonDamageDone')) { foreach AllActors(Class'Damagetrigger', D, 'GettingHurt') { foreach RadiusActors(Class'Actor', A, D.collisionradius,D.location) A.takedamage(D.DamageAmount, none, D.location, vect(0,0,0), D.damagetype); } } } }
|  |  |  |  |
So, here we have the damagetrigger as usual, except in firstframe() we disable it. We're not actually going to use the damagetrigger code at all, because it's silly. Instead we'll use it to store various properties (damagetype, damageAmount, radius, location) that we'll then directly apply via the missionscript. So now, as soon as the flag 'YoonDamageStarts' is set, either via infolink or flagtrigger or whatever, the missionscript looks for that GettingHurt tagged trigger, and then hurts all actors within the trigger's collisionradius. It does this once a second (since that's how often timer() is called in missionscripts) so assume your damagetrigger has an effective damageinterval of 1. Once you set the flag 'YoonDamageDone', it will stop doing this.
|
| Thu Mar 08, 2012 10:54 am |
|
 |
|
FastGamerr
UNATCO
Joined: Sat Jul 10, 2010 10:06 am Posts: 141 Location: Finland
|
 Re: FGR's Coding Needs (Open request: March 7th 2012)
Yay! I also managed to fix the DataLinkTrigger problem by utilizing the MissionScript in that situation as well... kind of funny, though. Starting from the moment when the 'YoonDamageStarts' flag was flagged 'True', the datalink just wouldn't start no matter what. I tried to see if it worked before that moment by using the 'legend' command and it did...
... oh well, at least now it works. Thanks again!
Yet I wonder how long it will actually take for me to finish this thing, considering all the problems I've only encountered in these 7 days alone! >_>
_________________ If you want to give me some pizza money:
 DX Nihilum T O D O A TC T O D A Y
|
| Thu Mar 08, 2012 11:52 am |
|
|
Who is online |
Users browsing this forum: Google [Bot] and 1 guest |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|
 |